The Cross-Platform Method of Generating Dynamic Content For The Web
The Cross-Platform Method of Generating Dynamic Content For The Web
2
JSP Pages
• JSP page file ends with “.jsp” by default
• JSP pages are organized like any other HTML files using the
normal directory/file structure
3
Servlet and JSP
Servlet JSP
4
How Data is Passed Between the Client and
the Server
How To Create a Form
1. Start writing a JSP source file, creating an HTML form and giving each form
element a name.
2. Write the bean in a .java file, defining properties, get, and set methods that
correspond to the form element names (unless you want to set one property
value at a time explicitly).
3. Return to the JSP source file. Add a <jsp:useBean> tag to create or locate an
instance of the bean.
4. Add a <jsp:setProperty> tag to set properties in the bean from the HTML
form (the bean needs a matching set method).
5. Add a <jsp:getProperty> tag to retrieve the data from the bean (the bean
needs a matching get method).
6. If you need to do even more processing on the user data, use the request
object from within a scriptlet.