exercises

[Exercises] Summary of Exercises for Java EE Security

  1. FORM Based Authentication - Without Container Template

    1. Create a Dynamic Web Project with a web.xml file; name it as ServletSecurity.

    2. Create a servlet RestrictedServlet with url pattern “/RestrictedServlet” that print “Restricted Servlet” to client.

    3. Create a servlet LoginServlet with url pattern “/LoginServlet” that gets the username and password from client and validate it against a dummy hashmap of username and password.

Getting Started With Java Server Pages (JSPs) Lab

JSPs allow you to write html, css, javascript etc. just as if you were writing an html file.  JSPs can be considered as html pages (except for the .jsp extension and some extra lines) with some java code inside.  JSPs may also contain no Java at all. In this example we will create our first JSP page, deploy it on Apache Tomcat and then runt it.

 

Prerequisites

  • JDK (1.7 or more)

  • Eclipse IDE (Mars or more)

[Exercises] Summary of exercises for JSP

  1. JSP Scripting Elements

    1. Do the following with only JSPs (and no servlets) and using JSP scripting elements

      1. Create a method that take two int numbers and return their sum as int.

      2. Invoke the method from within template text using JSP elements (example o/p - Sum of 3 and 4 is 7.)

      3. Print above line to console as well using JSP elements.

    2. Deploy the project into tomcat, restart server and compare the source jsp with the generated servlet.

[Exercises] Summary of Exercises for REST Web Services With JAX-RS

  1. Use Resteasy instead of Jersey in one of the examples.

[Exercises] Summary of Exercises for Http and Servlets

  1. Forms and parameters

    1. Create a servlet and name it as AuthServlet

    2. Create an html file

    3. Create a form that accepts a name, password and pass it on to the above servlet.

    4. The receiving servlet (AuthServlet) should check the name and password against a hard coded list of name-password pairs stored in a HashMap. HashMap should be initialized with some dummy usernames and passwords in the constructor/init method of the servlet.

Search the Web

Custom Search

Searches whole web. Use the search in the right sidebar to search only within javajee.com!!!