Bài Giảng Lập Trình JSP P15 End

Bài Giảng Lập Trình JSP _P15 End

Bài Giảng Lập Trình JSP _P15 End

... to general response page } Using Request Properties • Example: Sending custom image types – Send .png image if supported – Send .jpg image otherwise String imagetypes = request.getHeader(“Accept”); boolean ... display response as Excel spreadsheet – response.setContentType(“application/vnd.ms-excel”); – Send response back in simple format: • Cells in same row separated by tab ‘\t’ • Move t...
Ngày tải lên : 14/07/2014, 16:00
  • 15
  • 166
  • 0
Bài Giảng Lập Trình JSP _P1

Bài Giảng Lập Trình JSP _P1

... information 2 Client-Server Web Architecture • Client browser sends request for page to server – May contain form data and other information • Server sends response page and sends to client • May need to generate response ... statements – Connection pooling web container control servlet JSP database database driver JDBC DBMS database server 11 User-friendly Error Handling • Tell user what...
Ngày tải lên : 14/07/2014, 16:00
  • 17
  • 232
  • 1
Bài Giảng Lập Trình JSP _P2

Bài Giảng Lập Trình JSP _P2

... Syllabus</title></head><body>…) • Client browser sends request for page to server • Server sends response page and sends to client ... site Structure shown in the project window Creates an initial index .jsp page (default home page of the new site) The index .jsp is initially just a “Hello world” page Building a Web Application Tomcat ... it in a directory called 6...
Ngày tải lên : 14/07/2014, 16:00
  • 39
  • 209
  • 1
Bài Giảng Lập Trình JSP _P3

Bài Giảng Lập Trình JSP _P3

... library 22 Commenting JSP Files • Crucial to future maintenance of site • Inside of JSP code (between <% and %>): // comment /* comment */ • Outside of JSP code (that is, in html) <! comment > 8 JSP ... 10 JSP Scoping • Variable declared in a block of JSP on a page • May be accessed by any other JSP on same page • No access to variable from any ... middle) 17 Ha...
Ngày tải lên : 14/07/2014, 16:00
  • 23
  • 329
  • 0
Bài Giảng Lập Trình JSP _P4

Bài Giảng Lập Trình JSP _P4

... MULTIPLE> • Sends name=value string for each option selected …peripherals=camera&peripherals=scanner… • getParameter method will not work! 7 Example Result 9 Checkbox JSP • If execute JSP code: String ... monitor is checked – No mention of monitor if not checked 10 Conditions in Java • JSP may need to do different things depending on checkbox – Display “Monitor” if checked – Di...
Ngày tải lên : 14/07/2014, 16:00
  • 27
  • 235
  • 1
Bài Giảng Lập Trình JSP _P5

Bài Giảng Lập Trình JSP _P5

... etc.). – Decide which JSP should be sent back as response. – Forward control (and request data) to that JSP. request Control servlet JSP response JSPs act as views JSP JSP Servlet Details • Important ... JSP) – Methods invoked by a request for the servlet – Usually redirects to a JSP Tomcat Request for servlet Servlet Servlet methods called JSP Redirect to appropriate respo...
Ngày tải lên : 14/07/2014, 16:00
  • 26
  • 350
  • 0
Bài Giảng Lập Trình JSP _P6

Bài Giảng Lập Trình JSP _P6

... context.getInitParameter(“name"); • Accessing from a JSP: – String value = application.getInitParameter(“name"); Built-in object in JSP (like “request”) Context Parameters Form of xml tag Welcome ... Parameters Form of xml tag Welcome Page Properties • Page shown at webapp startup – Default: index .jsp • Can change to a new welcome file Configuration Files • Each webapp has a...
Ngày tải lên : 14/07/2014, 16:00
  • 18
  • 226
  • 1
Bài Giảng Lập Trình JSP _P7

Bài Giảng Lập Trình JSP _P7

... Messages in JSP Calendar Dates in Java • Construct a new GregorianCalendar object – Contains information about current date when created – Must import java.util.* library • Use get(Calendar.fieldname) ... approach: Force JSP to repeat validation done in servlet to determine which messages to display • Better approach: Once servlet detects error, it creates error message and passes to...
Ngày tải lên : 14/07/2014, 16:00
  • 40
  • 235
  • 0
Bài Giảng Lập Trình JSP _P8

Bài Giảng Lập Trình JSP _P8

... other JSPs test whether attribute is null • If so, redirect to another page – Initial page in sequence – Error page telling session has expired • Syntax for redirection from JSP: < ;jsp: forward ... Data • Servlets/JSPs can store data associated with session ID • Servlets/JSPs can look up that data in future when passed the session ID in request Server session ID Client data Servlet or...
Ngày tải lên : 14/07/2014, 16:00
  • 24
  • 217
  • 1
Bài Giảng Lập Trình JSP _P9

Bài Giảng Lập Trình JSP _P9

... list Used together to loop through and show all Items on “shopping cart” page Getting Cost in JSP Order Class Business Model Objects Key idea: • Methods in model objects should implement business ... set/get quantity – Method to get total cost of order • Computed from quantity here instead of in JSP/ servlet – Method to check whether quantity valid in terms of business model • Servlet...
Ngày tải lên : 14/07/2014, 16:00
  • 41
  • 224
  • 0