This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JSP and the fly likes handling html parameters in a jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "handling html parameters in a jsp" Watch "handling html parameters in a jsp" New topic
Author

handling html parameters in a jsp

federico tonioni
Greenhorn

Joined: Dec 16, 2002
Posts: 9
Hi to all!
I have the following code in a jsp page:

<% for (int i = 0; i < collectionArray.length; i++) {
%>
<tr>
<td width="18%"><a href="documentview.jsp?id=<%= collectionArray[i]%>"><%= collectionArray[i] %></a></td>
<td width="17%"><input type="checkbox" name="checkbox" value="<%= collectionArray[i] %>" >
</td>
</tr>
<%
}
}
catch (XMLDBException e) {
response.getWriter().println("adminstart.jsp Exception occured " + e.errorCode);
}
finally {
if (col != null) {
col.close();
}
}%>
</table>

<p>
<input type="submit" name="choice" value="Delete Checked Collection" >

</form>
<p>
<form name="insertionForm" action="CollectionFormProcess" method=post >
<input type="submit" name="choice" value="Insert a collection name" >
<input type="text" name="collectionName" >
</form>
</p>
iwould like to know if it is possible to get the value of the submit html variable...
i would like to know if it possible to write the following:
<% if choice.value.equals(null) choice.value= "Insert a collection name" %>
my problem is that the servlet rises a NullPointerException when an user write some text in the collectionName field and press Enter because the servlet makes an if-clause on the "choice" value
if (request.getParameter("choice").equals("Insert a collection name")) {
//some code
}
else
// other code

any help would be highly appreciated
thank you in advance
nicola
 
jQuery in Action, 2nd edition
 
subject: handling html parameters in a jsp
 
Similar Threads
How to get Names of selected checkboxes?
save checked value in checkbox to database
Could somebody give some ideas?
Insert Tables(Urgent)
handling html parameters in a jsp page