Solved

struts dropdown lists

Posted on 2011-02-10
1
752 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
Comment Utility
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

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 …
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…

772 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

11 Experts available now in Live!

Get 1:1 Help Now