Server-side  Web Programming Lecture 11:  Modular Web Programming
Including Static Resources <ul><li>Pages on same site should have  same layout </li></ul><ul><ul><li>Site identifiable to ...
Including Static Resources <ul><li>Bad idea:  copy and paste  html for navigation bar into each file </li></ul><ul><ul><li...
Server-side Includes <ul><li>Can use  web container  to include files </li></ul><ul><ul><li>Server page being generated fo...
Including Dynamic Resources <ul><li>Can break  dynamically generated  JSP into separate files </li></ul><ul><ul><li>Easier...
Including Dynamic Resources <ul><li>Syntax: <jsp:include page=&quot; relative file location &quot; /> </li></ul>
Sample Included Page
Including Dynamic Resources <ul><li>Why different syntax? </li></ul><ul><li>Steps in creating response: </li></ul><ul><ul>...
Upcoming SlideShare
Loading in...5
×

Lecture11

346

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
346
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
9
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Lecture11

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

    Clipping is a handy way to collect important slides you want to go back to later.

×