• 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
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

html:radio

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am new to Java...

I want to use html:radio tags to show a series of radio button in my jsp:

<tr><html:radio property="billOptions" value="1"> All Bill Months</html:radio></tr>
<tr><html:radio property="billOptions" value="2">Current</html:radio></tr>
<tr><html:radio property="billOptions" value="3"> In Progress</html:radio></tr>
<tr><html:radio property="billOptions" value="4"> Custom Bill Months</html:radio></tr>
<tr><html:radio property="billOptions" value="5"> Custom Bill Dates</html:radio></tr>

I am setting billOptions in my form to value 2 - so current is checked.
How do I get the value that the user picks - do I have to iterate through billOptions to see what they choose?
 
Ranch Hand
Posts: 541
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are using request.getParameter("billOptions") then it will return "1" or "2" etc depending on which they selected.
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What framework are you using?

<html:... is not a part of core JSP.
 
Marshal
Posts: 67451
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Probably Struts.

Tracey, it'd behoove you to work through a JSP and Servlets tutorial. This is a very basic concept and being new to Java, getting the basic concepts under you belt will help you greatly goging forward.
 
Abigail Moore
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks you all! I am using struts.

I will use request.getParameter - thanks.

Does anyone know of a good tutorial that covers this sort of question. I have taken a few tutorials but haven't seen this information.
 
Bear Bibeault
Marshal
Posts: 67451
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I cannot imagine any JSP/Servlet tutorial worth its salt not covering how to retrieve submitted parameters.

You might want to consider picking up a book geared towards the beginner. You can visit the JavaRanch Bunkhouse for recommendations. "Head First Servlets and JSP" has garnered a lot of good reviews.
 
Bartender
Posts: 1845
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes request.getParameter("billOptions") will work.

But seeing as you are using Struts, the better way is to access it via your ActionForm.

form.getBillOptions(); (It does have that method right?)

The whole point of struts is that it takes the values from the jsp page and puts them into a java object for you (your ActionForm).
Having said that, you need a good understanding of html/jsp/servlets before struts really makes sense.

Cheers,
evnafets
 
Bear Bibeault
Marshal
Posts: 67451
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, personally I would never recommend usage of Struts for a beginner.
 
Abigail Moore
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for all responses. that is the way I had it - form.getBillOptions but was second guessing myself.
 
Bear Bibeault
Marshal
Posts: 67451
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"tpeter3327",

You have changed your display name to one that is invalid. Take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Accounts with invalid display names are removed.

bear
Forum bartender
[ July 12, 2005: Message edited by: Bear Bibeault ]
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if i have to assign value to html:radio dynamically(like using <jsp:getProperty or <bean:write) what should i do and how?
Thanks in advance.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
R kr
Welcome to JavaRanch!

We're pleased to have you here with us in the JSP forum, but there
are a few rules that need to be followed, and one is that proper names are
required. Please take a look at the
JavaRanch Naming Policy and
adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

You can change it here
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic