Solved

struts dropdown lists

Posted on 2011-02-10
1
890 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
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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
object oriented programming comparison 5 77
table example 4 32
HashTable highest marks enumeration alternative 9 43
jboss 7.1 start up error 1 39
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
The viewer will learn how to implement Singleton Design Pattern in Java.

860 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