struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yaman Kumar" <yam...@nous.soft.net>
Subject help needed - default selection in dynamic select boxes.
Date Thu, 14 Mar 2002 14:15:38 GMT
Hi,
I am using struts v1.0.2 and heard this does not support generation of
dynamic html controls through struts tags(????).

I have a collection of ComboBoxBeans with name-value pair in a Vector to
show
html options  and would like to use it with 2nd collection .
I have a problem in rendering default selection in select boxes that are
rendered by 2nd collection.
( In mvc lt looks like this ).

<%for(int k=0;(vectStudents!=null && k<vectStudents.size());k++){
   Student student = (student)vectStudents.elementAt(k);
   String type = student.getType();
%>

<select name="studentType" >

<% LinkedList studentTypes = myBean.getAllTypes();
   String strSelected = "";
   for(int I=0;i<studentTypes.size();i++){
       ComboBoxBean objCombBean = (ComboBoxBean)studentTypes.get(i);
       String code = objCombBean.getCode();
       String description = objCombBean.getDescription();
       strSelected = description.trim().equals(type .trim())?"selected":"";
%>
     <option <%= strSelected %> value="<%= code %>"> <%= description
%>
</option>

<%	 }%>
</select>
<%}%>


Can I get the above code in struts implemented ? is it possible with 1.0.2?"
Is there any nested tag information available .
TIA
rayaku

-----Original Message-----
From: SATISH.T [mailto:satish.terala@wipro.com]
Sent: Friday, 14 June 2002 2:36 PM
To: 'Struts Users Mailing List'
Subject: RE: select dropdown with a nested name-attribute doesnt work in
any browser - sends wrong value in request


Hi I have tried out nested:select in both IE and netscape and it works
fine. The property bandList is the one I set in my nested beans which is
a collection (Arraylist ) of label Value beans(name-value pairs).
This is the syntax I use and the values are returned properly.
<nested:define id="Y" property="bandList"/>
	 <nested:select property="bandName"
onchange="<%=\"trial(\"+counter+\")\"%>" >
	<html:options collection="Y" property="label"
labelProperty="value"/>
 </nested:select>


-----Original Message-----
From: adam.hardy@cyberspaceroad.com
[mailto:adam.hardy@cyberspaceroad.com]
Sent: Friday, June 14, 2002 2:21 PM
To: Struts Users Mailing List
Subject: select dropdown with a nested name-attribute doesnt work in any
browser - sends wrong value in request

Neither Mozilla nor IE are handling my HTML produced from nested tags.
They ignore any selection I make in a select dropdown when I submit. The
incoming parameters at the server show that the original value is always
sent.

My HTML:

<select name="operationList[0].locationIdString">
<option value="0" selected="selected">-- please select --</option>
<option value="1">Strange Location</option>
<option value="2">Up a tree</option>
<option value="3">Kebabhouse</option>
</select>

In my debug logging, I see all the other parameters with correct values,
but I get operation[0].locationIdString=0 no matter what I select.

Is anybody successfully using nested dropdowns / select boxes? Why does
this affect both browsers? Am I going mad?

Adam

--
To unsubscribe, e-mail:
<mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:struts-user-help@jakarta.apache.org>



--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message