Your SlideShare is downloading. ×
Lecture11
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Saving this for later?

Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime - even offline.

Text the download link to your phone

Standard text messaging rates apply

Lecture11

307
views

Published on

Published in: Technology

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
307
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
8
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Server-side Web Programming Lecture 11: Modular Web Programming
  • 2. Including Static Resources
    • Pages on same site should have same layout
      • Site identifiable to user
      • User knows where to look for major components (navbar, etc.)
      • Example: CSS style sheets to unify appearance
    • Example: All pages on site have same navigation bar
  • 3. Including Static Resources
    • Bad idea: copy and paste html for navigation bar into each file
      • If change layout, must modify every file on the site
    • Better idea: “include” single file containing navigation bar into every page on site
      • Just need to modify single file
      • Done client side with frames
    navbar.htm JSPs included in
  • 4. Server-side Includes
    • Can use web container to include files
      • Server page being generated for response
      • Just include files
    • Syntax: <%@ include file=&quot; relative file location &quot; %> For example: <%@ include file=“navbar.html&quot; %>
  • 5. Including Dynamic Resources
    • Can break dynamically generated JSP into separate files
      • Easier to develop and maintain as group
    Configuration.jsp Information.jsp CreditCard.jsp
  • 6. Including Dynamic Resources
    • Syntax: <jsp:include page=&quot; relative file location &quot; />
  • 7. Sample Included Page
  • 8. Including Dynamic Resources
    • Why different syntax?
    • Steps in creating response:
      • JSP translated into an equivalent servlet.
      • Servlet is compiled.
      • The doGet or doPost method of servlet run to create response page
    • <%@ include file=“ … &quot; %> executed once when compiled
      • More efficient
    • <jsp:include page=“ … &quot; /> must be executed every time page called
      • Will generate different html each time based on user parameters
    • <%@ include file=””%>
    • <jsp:include page=“” />