struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nitesh Jain" <er.niteshj...@gmail.com>
Subject RE: Freemarker and Select Tag
Date Fri, 17 Jul 2009 06:26:25 GMT
Hi Robin,

	Select tag expects an list object in the list attribute but in your
case you are providing an Map that's why it is not behaving correctly.
I suggest create an object called UserType with two fields id and name. And
put these objects into a list (lets say usertypes). Now use following tag to
display a select box.

<s:select	name="userTypes" headerKey="-1" theme="ajax"
	
headerValue="-- Please Select --" list="#application.usertypes" listKey="id"
listValue="name" label="Select User Type"/>

Hope it will help you.

Regards,

Nitesh Jain

-----Original Message-----
From: Robin Mannering [mailto:robin@mtndesigns.co.uk] 
Sent: 16 July 2009 20:36
To: Struts Users Mailing List
Subject: Freemarker and Select Tag

Hello,

Platform : Struts 2, EJB 3.0, Glassfish 2.1

I'm having trouble using the Freemarker equivalent of the JSP Struts 2 
Select Tag.

I need to convert:

<s:select list="application.userTypes" />

into the Freemarker equivalent.

userTypes is an application defined attribute.  I have checked the 
existence of the attribute within the page and it is shown as expected.

My List/Map is defined as

        Map<Integer, String> userTypes = new HashMap<Integer, String>();
        userTypes.put(1, "AGENCY_USER");
        userTypes.put(2, "SHOP_USER");
        userTypes.put(3, "TOUR_OPERATOR_USER");

I have tried the following, none of which work (or work correclty).

<@s.select list=application.userTypes/>   -- elements are placed into 
the select box, but are valued as 1=AGENCY_USER, 2=SHOP_USER

The following produce empty select boxes (or errors)

<@s.select list="application.userTypes"/>

<@s.select list="${application.userTypes}"/>

Does anybody have any ideas ?

Thanks



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


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


Mime
View raw message