| Author |
html:radio
|
Abigail Moore
Greenhorn
Joined: May 13, 2004
Posts: 12
|
|
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?
|
 |
Tim Baker
Ranch Hand
Joined: Oct 04, 2003
Posts: 541
|
|
|
If you are using request.getParameter("billOptions") then it will return "1" or "2" etc depending on which they selected.
|
Kim Jong II (North Korea's Dear Leader) said:Nuclear weapons don't kill people, people kill people.
|
 |
Ben Souther
Sheriff
Joined: Dec 11, 2004
Posts: 13410
|
|
What framework are you using? <html:... is not a part of core JSP.
|
Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56204
|
|
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.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Abigail Moore
Greenhorn
Joined: May 13, 2004
Posts: 12
|
|
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
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56204
|
|
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.
|
 |
Stefan Evans
Bartender
Joined: Jul 06, 2005
Posts: 1005
|
|
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
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56204
|
|
|
Yes, personally I would never recommend usage of Struts for a beginner.
|
 |
Abigail Moore
Greenhorn
Joined: May 13, 2004
Posts: 12
|
|
|
Thanks for all responses. that is the way I had it - form.getBillOptions but was second guessing myself.
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56204
|
|
"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 ]
|
 |
R kr
Greenhorn
Joined: Mar 21, 2006
Posts: 1
|
|
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
Joined: Dec 11, 2004
Posts: 13410
|
|
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
|
 |
 |
|
|
subject: html:radio
|
|
|