Can a JSP page process HTML FORM data?

Govind Seshadri

Yes. However, unlike servlets, you are not required to implement HTTP-protocol 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();
%>

or

<%= request.getParameter("item") %>

See the Javaworld article "Advanced Form Processing using JSP" by Govind Seshadri for complete details.

0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact