|
JavaServer Pages™ (JSP) is a web-scripting technology similar to Netscape server-side JavaScript (SSJS) or Microsoft Active Server Pages (ASP). However, its more easily extensible than SSJS or ASP, and it isnt proprietary to any one vendor or any particular web server. ... Theyve already announced that the next version of Netscape Application Server (NAS) will use JSP as a presentation layer technology. ...
JSP BASICS
JSP is a presentation layer technology that sits on top of a Java servlets model and makes working with HTML easier. Like SSJS, it allows you to mix static HTML content with server-side scripting to produce dynamic output. By default, JSP uses Java as its scripting language; however, the specification allows other languages to be used, just as ASP can use other languages (such as JavaScript and VBScript). While JSP with Java will be more flexible and robust than scripting platforms based on simpler languages like JavaScript and VBScript, Java also has a steeper learning curve than simple scripting languages.
To offer the best of both worlds - a robust web application platform and a simple, easy-to-use language and tool set - JSP provides a number of server-side tags that allow developers to perform most dynamic content operations without ever writing a single line of Java code. So developers who are only familiar with scripting, or even those who are simply HTML designers, can use JSP tags for generating simple output without having to learn Java. Advanced scripters or Java developers can also use the tags, or they can use the full Java language if they want to perform advanced operations in JSP pages.
Pages Are Passé, Components Are Cool
To understand how JSP can accomplish the magic act of ease of use combined with "unlimited" power, you must first understand the difference between component-centric and page-centric web development.
Both SSJS and ASP were designed years ago when the web was young and no one knew any better than to dump all their business, data, and presentation logic into scripted web pages. ... The logic written for the scripted environments was locked inside pages and was reusable only through cut and paste. ... HTML and graphics designers handed over the implementation of their designs to web scripters, who had to duplicate the work - often by hand, because no decent tools existed for combining server-side scripting with HTML content generation. ...
Around the same time that people were looking around for better ways to build web applications, components were all the rage in the client-server world. JavaBeans and ActiveX were being pushed to Java and Windows application developers by rapid application development (RAD) tools vendors as the way to develop complex applications quickly. ... For example, the developer of a Java application that charts the mating habits of lemmings need not know anything about lemmings; she can just invoke the LemmingsInLove JavaBeans component to obtain the relevant domain-specific information, and focus instead on making the application easy to use. It was only a matter of time before a technology emerged to bring component-centric programming to the world of server-side Web applications. ... Its based on a model in which JavaBeans and Enterprise JavaBeans (EJB) components contain the business and data logic for an application, and it provides tags and a scripting platform for exposing the content generated or returned by the beans in HTML pages. Because of the component-centric nature of JSP, it can be used by non-Java and Java developers alike. Non-Java developers can use the JSP tags to work with beans that experienced Java developers created. Java developers can not only make and use beans but also use Java in JSP pages for finer-grained control over presentation logic thats based on underlying beans. ... Other, more complicated request models include calling out to other JSP pages or Java servlets from the requested JSP page.
TAG, YOURE IT
Before learning how to go about scripting your JSP pages with Java, you need to know about the server-side JSP elements, called actions, that perform server-side tasks without requiring Java coding. Action tags can be employed by advanced content designers or by scripters who might not be familiar with Java but still want to display values held in JavaBeans components. ... First Ill describe some of the action tags provided, and then Ill show you an example JSP page that uses only tags to display information from a bean - no Java coding required. ... The same rules apply for application beans except that they expire when an application is reloaded or when the server is restarted. ... For example, if you store values in a session bean, you can access those values from any JSP page thereafter for a single user just as you could do from SSJS pages for properties that you store in the client object. ...
Keep in mind that you can use the INCLUDE method of redirection to access static HTML pages, JSP pages, servlets, SSJS pages, ASP pages - just about any resource that responds to HTTP requests and generates a response that you want to include in your page. ... SuperSimpleBean"/>
Counter:
|