Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

to get boolean value in jsp  RSS feed

 
gaurav kumawat
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Can you please tell me how to get boolean value in jsp.Means i want to get a value whose value is being passed from javascript to jsp.
It makes you clear my prob.

like for passing any string value(say name). we use..
<SCRIPT>
function form
...
..
document.formname.action="formname.jsp?name="+name; location.href = document.formname.action;
</SCRIPT>
String name;

name = request.getParameter("name");


like if i want to pass a boolean value then..how to do it..

thanks ....
 
Dhananjay Inamdar
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Gaurav,

HttpRequest.getParameter() has a return type as a String in it's signature. You can't get any other data-type from request.

Thanks
Dhananjay
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As said previously, getParamter only returns String.
So use that String to instanciate a Boolean.
Look at the constructor Boolean(String s).
"true" is true.
Everything else is false.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!