Win a copy of Kotlin for Android App Development this week in the Kotlin forum!
  • 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
  • Devaka Cooray
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

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.
 
Uh oh, we're definitely being carded. Here, show him this tiny ad:
Programmatically Create PDF Using Free Spire.PDF with Java
https://coderanch.com/wiki/703735/Programmatically-Create-PDF-Free-Spire
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!