1 / 27

Web Programming with Servlets & JSP ASSIGNMENT GUIDELINE

Web Programming with Servlets & JSP ASSIGNMENT GUIDELINE. Objectives. Assignment Guideline 9 Assignment Guideline 10 Assignment Guideline 11 Assignment Guideline 12 Assignment Guideline 13 Assignment Guideline 14 Assignment Guideline 15. Assignment Guideline 1 Assignment Guideline 2

Download Presentation

Web Programming with Servlets & JSP ASSIGNMENT GUIDELINE

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. Web Programming with Servlets & JSPASSIGNMENT GUIDELINE

  2. Objectives • Assignment Guideline 9 • Assignment Guideline 10 • Assignment Guideline 11 • Assignment Guideline 12 • Assignment Guideline 13 • Assignment Guideline 14 • Assignment Guideline 15 Assignment Guideline 1 Assignment Guideline 2 Assignment Guideline 3 Assignment Guideline 4 Assignment Guideline 5 Assignment Guideline 6 Assignment Guideline 7 Assignment Guideline 8

  3. Assignment Guideline 1

  4. Assignment Guideline 2 • Using methods • Remote Host: request.getRemoteHost() • Remote Port: request.getRemotePort() • Request URI: request.getRequestURI() • Server name: request.getServerName() • Server port: request.getServerPort() 4

  5. Assignment Guideline 3 – 1 • Building 2 servlets • InputServlet includes the form and inputted controls • DisplayServlet presents the inputted value 5

  6. Assignment Guideline 3 – 2 • 301 (Moved Permanently) • Requested document permanently moved elsewhere (indicated in Location header). • Browsers go to new location automatically • Hints: • Using setStatus and setHeader as following • response.setStatus(301); • response.setHeader( "Location", "http://localhost:8084/AssM3/MovePermanently.html" ); • response.setHeader(“Connection”, “close”); • Using sendError with the same status code 6

  7. Assignment Guideline 4 – 1 • Building 2 servlets • CookiesServlet includes the form and inputted controls depending on the checking cookies result • WelcomeServlet checking the user in cookies to show welcome message and add the cookie if the new user is 7

  8. Assignment Guideline 4 – 2 • Building a servlet • Session Tracking applies the HttpSession interface methods and Session technologies to view above GUI 8

  9. Assignment Guideline 5 • Building html file same as the left above image • Building 2 servlet • First Servlet • Using the getParameter method of request object • Then using the setAttribute and getRequestDispatch methods of ServletContext Interface to store the parameter and forward the Second Servlet • Second Servlet: retrieve the object using the getAttribute method, then print it 9

  10. Assignment Guideline 6_1 • Building a servlet uses the “Basic” header and Base64Decoder to checking username and password from users • The results should be presented as above images 10

  11. Assignment Guideline 6_2 11

  12. Assignment Guideline 6_2 (cont) 12

  13. Assignment Guideline 6_2 (cont) • Creating a html file with form including 3 text box (name, age, address), and a button Submit • Building a CheckingServlet uses validation the inputted information • Do not allow null with name and age fields • The age value must be a numeric and larger than 18 • The Welcome message will be present with the link transfer to the protect resource (test.html in admin directory) • Configuring the web deployment descriptor to the BASIC authentication with role as manager, users • The test.html file only present the message • The results should be presented as above images 13

  14. Assignment Guideline 7 • Creating a index.jsp file present the current Date applying the Calendar and Date package of java.util library • Creating a second.jsp file includes the image control which gets the image from the images directory at your web page directory 14

  15. Assignment Guideline 8_1 • Creating a index.jsp file present header using (reference request object in chapter 2) • request.getHeaderNames () • request.getHeader() • request.getHeaders 15

  16. Assignment Guideline 8_2 • Creating 02 index.jsp page • First, the Login form with action the process.jsp • Second, the process.jsp file is implemented the session mechanism with cookies same as the chapter 4 • The results are similar to the above images 16

  17. Assignment Guideline 9_1 • Creating a JavaBean named AmountBean include the amount property with int data-type and the DISCOUNT is 30% • Creating includeForward.jsp file are the form with textbox and button, and applying the AmountBean to calculate the returned amount after the user submit • Creating the products.jsp file using jsp:include applying the includeForward.jsp file • Creating the forward.jsp file using jsp:forward applying the products.jsp file. The forward.jsp file is the default page of application 17

  18. Assignment Guideline 9_2 • Creating first.jsp file using request.setAttribute with value of “user” attribute is “Aptechie” and using jsp:forward to the second.jsp file • The second.jsp file uses jsp:include the lastPage.html file and present the value of “user” attribute to the browser • The lastPage.html presents the message This is the last page of this WebSite • The results of program should be same as the image 18

  19. Assignment Guideline 10_1 • Creating the JSP page using • The Arithmetic Operations • The Logic Operations • The header – EL Implicit Object with the “User-Agent” value • The Result must be same as the image 19

  20. Assignment Guideline 10_2 • Creating the JSP page using • The param – EL Implicit Object to process the inputted value • Applying the addition series calculation for Total Amount • The Result must be same as the image 20

  21. Assignment Guideline 11_1 • Creating the JSP page using • Declaring the String array with form of each elements as productName:price • Using c:forEach, c:forTokens, and c:out to traverse and print each element of array as above image 21

  22. Assignment Guideline 11_2 • Creating the JSP page using • Declaring the String array with form of each elements as destinationName:price • Building the form with a textbox and a button • Using c:forEach, c:forTokens, c:if, c:set, and c:out to traverse, checking the existing destination and print as above image 22

  23. Assignment Guideline 12_1 • Creating the I18N in Servlets as the above image using Servlets • Should reference the steps in Workshop. However, convert the reference code to the servlet 23

  24. Assignment Guideline 12_2 • Creating the JSP page using • I18N and formatting Tag library to do the exercise (using format setLocale, formatNumer and Decision making tag library to present the result) 24

  25. Assignment Guideline 13 • Do it again the workshop 3 of Chapter 13 in CD with construct if Cond Then Else 25

  26. Assignment Guideline 14 • Do it again the workshop 2 of Chapter 13 in CD that creating the custom Tag with upper case all the body content using BodyTagSupport Class 26

  27. Assignment Guideline 15 • Building 03 tag files and a JSP file can do • Upper case all the body content in tag • The heading row with 6 columns (6 attributes) • The column row with 5 inputted column, and the 6th column averaged from 3 last column and format as a images (using JSTL tag lib) • The JSP file is contains the combination of 3 above tags same as the image 27

More Related