JSP Scripting Elements
Do the following with only JSPs (and no servlets) and using JSP scripting elements
Create a method that take two int numbers and return their sum as int.
Invoke the method from within template text using JSP elements (example o/p - Sum of 3 and 4 is 7.)
Print above line to console as well using JSP elements.
Deploy the project into tomcat, restart server and compare the source jsp with the generated servlet.
JSP Forms and Standard Actions
Create a JSP web form to submit the name and age of an employee.
Form should be submitted to a JSP file.
Create a bean class called Employee for storing the name and age of the employee
Within the JSP to which form is submitted, do the following using only standard actions
Declare an instance of the Employee JavaBean
Populate the Employee object with values from form submission
Retrieve the values and display it with proper template text:
Employee name is John
Employee age is 30
JSP and web.xml
Create two simple JSP files.
A JSP web form that will submit data to the second JSP
Second JSP may simply print the values of the form submission
Create an entry in the web.xml for first jsp file alone
Declare load-on-startup element with a positive value
Define a url pattern
Package the application as a war
Deploy the war into tomcat and start the server
Check tomcat jsp generation folder for class files generated
Run a url with the url pattern defined
Check tomcat jsp generation folder again for class files generated
List down the classes generated before running the url and after running the url and explain the reason.
For any doubts related to any exercises given here, use the forum section @ http://javajee.com/forums/java-ee-web-component-developer-certified-expert.