I am trying to send a string from my JSP to the Servlet after a button is clicked. Currently I am doing in JSP:
<form method="POST" action="/deleteList.html">
<input type="submit" value="delete me!"/>
<input type="hidden" name="deleteStringName" value=<%=somevalue%> />
</form>
And Servlet:
String desiredString = request.getParameter("deleteStringName");
This works when somevalue doesn't include whitespaces, such as string test123 would be printed the same in JSP as Servlet. However, with string such as test 132, if I were to print the string in the servlet:
String desiredString = request.getParameter("deleteStringName");
System.out.println(desiredString);
this would print just test omitting everything after whitespace. Why does this happen? And is there a way to fix it such that I could transmit the entire string from JSP to servlet? Thank you
Aucun commentaire:
Enregistrer un commentaire