You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Balwinder Kumar <ba...@gmail.com> on 2009/07/15 18:58:50 UTC
Initializing Application
Hi All,
I am trying to develop a framework based on Struts 2, I am finding it
very difficult to decide where to put the code that is generally
called in ActionServlet init method. Any pointer towards this.
Thanks in advance.
Regards,
Balwinder Kumar
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
RE: Freemarker and Select Tag
Posted by Nitesh Jain <er...@gmail.com>.
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
Freemarker and Select Tag
Posted by Robin Mannering <ro...@mtndesigns.co.uk>.
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
Re: Initializing Application
Posted by Balwinder Kumar <ba...@gmail.com>.
Thanks Pawel and David for your response. I would like to evaluate both
option before proceeding.
Regards,
Balwinder Kumar
Paweł Wielgus wrote:
> Hi,
> i'm initing my apps by implementing ServletContextListener and
> registering it in web.xml like that:
> <web-app>
> <listener>
> <listener-class>com.my.ServletContextListenerImplementation</listener-class>
> </listener>
> </web-app>
>
> It has nothing to do with struts but i hope that's what You are looking for.
>
> Best greetings,
> Paweł Wielgus.
>
>
> 2009/7/15 David Canos <da...@gmail.com>:
>
>> I think Struts 2 uses a Struts2Filter to do the init issues of the each
>> request
>>
>> 2009/7/15 Balwinder Kumar <ba...@gmail.com>
>>
>>
>>> Hi All,
>>>
>>> I am trying to develop a framework based on Struts 2, I am finding it very
>>> difficult to decide where to put the code that is generally called in
>>> ActionServlet init method. Any pointer towards this.
>>> Thanks in advance.
>>>
>>> Regards,
>>> Balwinder Kumar
>>>
>>> ---------------------------------------------------------------------
>>> 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
>
>
>
Re: Initializing Application
Posted by Paweł Wielgus <po...@gmail.com>.
Hi,
i'm initing my apps by implementing ServletContextListener and
registering it in web.xml like that:
<web-app>
<listener>
<listener-class>com.my.ServletContextListenerImplementation</listener-class>
</listener>
</web-app>
It has nothing to do with struts but i hope that's what You are looking for.
Best greetings,
Paweł Wielgus.
2009/7/15 David Canos <da...@gmail.com>:
> I think Struts 2 uses a Struts2Filter to do the init issues of the each
> request
>
> 2009/7/15 Balwinder Kumar <ba...@gmail.com>
>
>> Hi All,
>>
>> I am trying to develop a framework based on Struts 2, I am finding it very
>> difficult to decide where to put the code that is generally called in
>> ActionServlet init method. Any pointer towards this.
>> Thanks in advance.
>>
>> Regards,
>> Balwinder Kumar
>>
>> ---------------------------------------------------------------------
>> 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
Re: Initializing Application
Posted by David Canos <da...@gmail.com>.
I think Struts 2 uses a Struts2Filter to do the init issues of the each
request
2009/7/15 Balwinder Kumar <ba...@gmail.com>
> Hi All,
>
> I am trying to develop a framework based on Struts 2, I am finding it very
> difficult to decide where to put the code that is generally called in
> ActionServlet init method. Any pointer towards this.
> Thanks in advance.
>
> Regards,
> Balwinder Kumar
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>