Win a copy of Java EE 8 High Performance this week in the Java/Jakarta EE forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

handling html parameters in a jsp  RSS feed

Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi to all!
I have the following code in a jsp page:

<% for (int i = 0; i < collectionArray.length; i++) {
<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] %>" >
catch (XMLDBException e) {
response.getWriter().println("adminstart.jsp Exception occured " + e.errorCode);
finally {
if (col != null) {

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

<form name="insertionForm" action="CollectionFormProcess" method=post >
<input type="submit" name="choice" value="Insert a collection name" >
<input type="text" name="collectionName" >
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
// other code

any help would be highly appreciated
thank you in advance
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!