Friday, March 13, 2009

Can a JSP page process HTML FORM data (JSP)

Question :Can a JSP page process HTML FORM data? (JSP)
Answer :Yes. However, unlike servlets, you are not required to implement HTTPprotocol
specific methods like doGet() or doPost() within your JSP page.
You can obtain the data for the FORM input elements via the request
implicit object within a scriptlet or expression as:
String item = request.getParameter("item");
int howMany = new Integer(request.getParameter("units")).intValue();
<%= request.getParameter("item") %>

No comments: