29.01.2013 Views

WebSphere Application Server - IBM Redbooks

WebSphere Application Server - IBM Redbooks

WebSphere Application Server - IBM Redbooks

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

8.1 JSP overview<br />

In the early days of Java development it soon became apparent that, while<br />

servlets provided an excellent mechanism for the handling of requests for<br />

dynamic content, they did not provide a useful way of displaying the response.<br />

The hard-coding of presentation within the servlet code meant that changing the<br />

“look and feel” of the presentation layer required changes to the Java files that<br />

also provided the business logic, and the resultant recompiling, testing, and<br />

deploying. The roles of Web designer and Java programmer were not distinct,<br />

leading to development process problems.<br />

Using JSPs offers the following advantages:<br />

► Separation of dynamic and static content<br />

This allows for separation of application logic and Web page design reducing<br />

the complexity of Web site development and making the site easier to<br />

maintain.<br />

► Platform independence<br />

Because JSPs are Java-based, they are platform independent. JSPs can run<br />

on any Web application server. JSPs can be developed on any platform and<br />

be viewed by any browser because the output of a compiled JSP page is<br />

HTML.<br />

► Component reuse<br />

Using JavaBeans and tag libraries, JSPs leverage the inherent reusability<br />

offered by these technologies. This enables code sharing among developers,<br />

thus speeding development efforts.<br />

► Scripting and tags<br />

JSPs support both embedded JavaScript and tags. JavaScript is typically<br />

used to add page-level functionality to the JSP. Tags provide an easy way to<br />

embed and modify JavaBean properties and to specify other directives and<br />

actions.<br />

The JSP level mandated by J2EE 1.3 is JSP 1.2.<br />

8.1.1 JSP execution model<br />

In order to effectively use JSPs, it is first important to understand how they work.<br />

Essentially, a JSP file can be thought of as an HTML page with embedded<br />

segments of Java code that are executed at runtime. As such, a JSP file looks<br />

mostly like normal HTML, and can be edited by a Web designer who maintains<br />

responsibility for the look and feel of the site.<br />

242 <strong>IBM</strong> <strong>WebSphere</strong> <strong>Application</strong> <strong>Server</strong> - Express V5.0.2 Developer Handbook

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!