1 / 50

JSP

JSP. Thanks to http://courses.coreservlets.com/Course-Materials/csajsp2.html. The 10 most popular sites (Summer.10). Keywords in job posting. Java Web Technology in… AIRLINES. Java Web Technology in… TRAVEL. Java Web Technology in… FINANCIAL SERVICES. Java Web Technology in… RETAIL.

hazina
Download Presentation

JSP

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. JSP Thanks to http://courses.coreservlets.com/Course-Materials/csajsp2.html

  2. The 10 most popular sites (Summer.10)

  3. Keywords in job posting

  4. Java Web Technology in…AIRLINES

  5. Java Web Technology in…TRAVEL

  6. Java Web Technology in…FINANCIAL SERVICES

  7. Java Web Technology in…RETAIL

  8. Java Web Technology in…SEARCH PORTALS

  9. Servlets pros and cons

  10. JSP - The idea

  11. JSP advantages

  12. JSP Lifecycle Server Web Pagina JSP Servlet generato Browser Servlet compilato

  13. JSP - MISCONCEPTIONS

  14. What happens when?

  15. Event table

  16. JSP nuts and bolts • Implicit Objects: • request • response • pageContext • session • application • out • config • page • Syntactic elements: • <%@ directives %> • <%! declarations %> • <% scriptlets %> • <%= expressions %> • <jsp:actions/> • <%-- Comment --%>

  17. JSP nuts and bolts • Syntactic elements: • <%@ directives %>  Interaction with the CONTAINER • <%! declarations %>  In the initialization of the JSP • <% scriptlets %>  In the service method • <%= expressions %>  In the service method • <jsp:actions/>

  18. Two sintaxes - why?

  19. xml syntax for HTML4 files

  20. XML syntax for XHTML files

  21. JSP expressions

  22. How is it translated?

  23. Example

  24. Predefined variables

  25. Example

  26. Scope of the predefined variables

  27. Scriptlets

  28. How gets is translated?

  29. Example

  30. A scriptlet does NOT need to be a complete Java expression

  31. JSP declarations

  32. How gets it translated? 1

  33. How gets it translated - 2

  34. Example

  35. jspInit - jspDestroy

  36. Let's recap…

  37. import page directive

  38. contentType -pageEncoding

  39. Session

  40. Error page

  41. isErrorPage

  42. isThreadSafe Don't you be lazy….

  43. What's wrong here?

  44. Should you use "isThreadSafe" ?

  45. @include

  46. jsp:include

  47. jsp:include vs @ include

  48. Augmenting request params

  49. To let Tomcat serve static pages, we must define a “Web Application”. That is, in the Tomcat Document Root (by default $CATALINA_HOME/webapps/) we must create a folder named after our Web Application (e.g. myApp). In that “myApp” folder, we MUST create a WEB-INF folder (that can be empy). In the myApp folder we can then depost the static html files. On our Tomcat server, the URL for the hello.html file becomes: http://machine/port/myApp/hello.html To actually see the webapp, we might have to restart Tomcat webapps myApp hello.html WEB-INF Static pages web.xml

  50. To let Tomcat serve JSP pages, we follow the same procedure that we described for static pages. In the myApp folder we can depost the JSP files. On our Tomcat server, the URL for the hello.jsp file becomes: http://machine/port/myApp/hello.jsp The WEB-INF directory is still empty. To actually see the webapp, you might have to restart Tomcat (depending on the version you have) The same web.xml file as in the static case must be provided. webapps myApp hello.jsp WEB-INF JSP pages web.xml

More Related