• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Devaka Cooray
Saloon Keepers:
  • Ganesh Patekar
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
Bartenders:
  • Ron McLeod
  • Frits Walraven
  • Pete Letkeman

to get boolean value in jsp  RSS feed

 
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 ....
 
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
 
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!