Solved

struts dropdown lists

Posted on 2011-02-10
1
895 Views
Last Modified: 2012-05-11
i used to parse xml values and display in the jsp form...
they are displaing well ...

when i change the values I am getting all changed values to my
action class when i use struts...

but problem with dropdown lists...

I had attached my code for drop down list of the jsp page...

let me know whether my syntax is correct or not...


along with this there are many textboxes and radio buttons no problem for
thing I am getting all values in the action form except for this dropdown
lists... I am alwaays getting value "T" even though if I select "F"...

so how should it be solved.....
my jsp code....


<td align="right">apple: </td> 
	<td>
		<% if (request.getAttribute("apple_value").equals("T")) 
		{
		%>
		<select id="apple" name="apple">
		<option value ="T" name="apple" selected ="yes">True</option>
		<option value ="T" name ="apple" >False</option>
		</select>
		</td>
		<%
		}
		else
		{
		%>
		<select id="apple" name="apple">
		<option value ="T" name="apple" >True</option>
		<option value ="T" name ="apple" selected ="yes">False</option>
		</select>
		</td>
		<%
		}
		%>
<td align="right">grape: </td> 
	<td>
		<% if (request.getAttribute("grape_value").equals("T")) 
		{
		%>
			<select id="grape" name="grape">
		<option value ="T" name="grape" selected ="yes">True</option>
		<option value ="T" name ="grape" >False</option>
		</select>
		</td>
		<%
		}
		else
		{
		%>
		<select id="grape" name="grape">
		<option value ="T" name="grape" >True</option>
		<option value ="T" name ="grape" selected ="yes">False</option>
		</select>
		</td>
		<%
		}
		%>

Open in new window

0
Comment
Question by:shragi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 5

Accepted Solution

by:
aciuica earned 500 total points
ID: 34865706
You should change the value of the second option to "F".
Instead of:
<option value ="T" name="apple" selected ="yes">True</option>
<option value ="T" name ="apple" >False</option>
you need:
<option value ="T" name="apple" selected ="yes">True</option>
<option value ="F" name ="apple" >False</option>
0

Featured Post

More Than Just A Video Library

Train for your certification. Learn the latest DevOps tools. Grow your skillset to do better work.

At Linux Academy, we release new training modules every week so you'll always be up to date on the latest tech.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
I had a project requirement for a displaying a user workbench .This workbench would consist multiple data grids .In each grid the user will be able to see a large number of data. These data grids should allow the user to 1. Sort 2. Export the …
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
This video teaches viewers about errors in exception handling.

690 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question