Solved

struts dropdown lists

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

863 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now