0% found this document useful (0 votes)
45 views6 pages

The Cross-Platform Method of Generating Dynamic Content For The Web

JSP is a server-side technology that complements servlets by focusing on user interface and presentation. It enhances servlet capabilities and allows non-programmers to design webpages through any text editor. JSP pages are compiled into servlets, mapped to directories, and automatically reloaded on modification. Data is passed between the client and server through HTML forms mapped to JavaBeans using JSP tags to set and get property values that correspond to form element names.

Uploaded by

Apsara .k.s
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
45 views6 pages

The Cross-Platform Method of Generating Dynamic Content For The Web

JSP is a server-side technology that complements servlets by focusing on user interface and presentation. It enhances servlet capabilities and allows non-programmers to design webpages through any text editor. JSP pages are compiled into servlets, mapped to directories, and automatically reloaded on modification. Data is passed between the client and server through HTML forms mapped to JavaBeans using JSP tags to set and get property values that correspond to form element names.

Uploaded by

Apsara .k.s
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 6

JSP

the cross-platform method of


generating dynamic content for the Web.
JSP and Servlet
• Limitations of servlet
– It is difficult to write HTML
– It’s ineffective to design webpages
– It’s inaccessible to non-programmers

• JSP is a complement to servlet


– JSP focuses on user interface and presentation
– JSP enhances the design capability of servlet
– JSP pages can be written with any text editor, including
HTML editor
– JSP is a server side technology

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

• A JSP page is usually composed of regular HTML tags and JSP


scripting elements

• JSP page is implicitly compiled to servlet class and loaded into


memory
– when the page is requested the first time after creation, or
– when the page is requested the first time after modification
– Refer to table 10.1 in the textbook and the next slide

3
Servlet and JSP
Servlet JSP

Development java classes (.java) scripting file (.jsp)

Deployment Manually compiled; Directly mapped: copy JSP


Specifically mapped files to intended directories

Execution No need of source Automatic compilation;


files automatic reloaded; source
files (.jsp) are necessary

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.

You might also like