Author Login
Post Reply
user Digest 3 Apr 2008 20:40:34 -0000 Issue 7962
Topics (messages 184997 through 185025):
Default JSP content type
184997 by: Matthew Seaborn
Freemarker (old version that struts2 uses) disappearing pages
184998 by: Jonny Cavell
Re: <s:radio> issue
184999 by: Dave Newton
Re: Eclipse with struts
185000 by: Musachy Barroso
Re: Security @ Struts2, using Acegy or Inspector
185001 by: Randy Burgess
struts2 datetimepicker multiple selections
185002 by: zakaria ghandour
Re: struts.xml
185003 by: Relph,Brian
185008 by: Relph,Brian
new to sturts
185004 by: ghan_java
185006 by: Musachy Barroso
185007 by: Musachy Barroso
java.lang.NoSuchMethodError:
org.apache.struts.config.ModuleConfig.findActionConfigId(Ljava/lang/String;)
185005 by: DWilkerson
185009 by: Antonio Petrelli
185010 by: DWilkerson
Re: [DEV-IMPLICATIONS] Re: Actionerrors & the Store Interceptor
185011 by: Chris Pratt
185016 by: Al Sutton
Initialization before the Application Startup.
185012 by: JiVi
185015 by: JiVi
connecting s:autocompleter and s:div
185013 by: manishbel
185014 by: manishbel
185022 by: manishbel
185023 by: Musachy Barroso
[OT] Re: Initialization before the Application Startup.
185017 by: Dave Newton
Re: any struts 2 unit testers out there?
185018 by: paulbrickell
185024 by: Relph,Brian
Problem with submitting an additional param in a form
185019 by: Peter Theissen
185021 by: Ryan
clearFieldErrors() - where is it ?
185020 by: it.creteonline.gr
<s:iterator> tag help
185025 by: Eric Nelson
Administrivia:
---------------------------------------------------------------------
To post to the list, e-mail: user@(protected)
To unsubscribe, e-mail: user-digest-unsubscribe@(protected)
For additional commands, e-mail: user-digest-help@(protected)
----------------------------------------------------------------------

Attachment:
user_184997.ezm (zipped)
Does anyone know if it is possible to override the default JSP
page content type and/or page encoding either for an entire web-app or as part
of Struts 2?
Many thanks.
________________________________________________________________________
CONFIDENTIALITY - This email and any files transmitted with it, are confidential, may be legally privileged and are intended solely for the use of the individual or entity to whom they are addressed. If this has come to you in error, you must not copy, distribute, disclose or use any of the information it contains. Please notify the sender immediately and delete them from your system.
SECURITY - Please be aware that communication by email, by its very nature, is not 100% secure and by communicating with Perform Group by email you consent to us monitoring and reading any such correspondence.
VIRUSES - Although this email message has been scanned for the presence of computer viruses, the sender accepts no liability for any damage sustained as a result of a computer virus and it is the recipients responsibility to ensure that email is virus free.
AUTHORITY - Any views or opinions expressed in this email are solely those of the sender and do not necessarily represent those of Perform Group.
COPYRIGHT - Copyright of this email and any attachments belongs to Perform Group, Companies House Registration number 6324278.

Attachment:
user_184998.ezm (zipped)
I have a problem that seems to occur periodically.
My freemarker templates, served by struts2, stop appearing - I get a blank
page. There are no useful messages in the logs, other than saying that it
couldn't find the template (which it could find previously).
First question - does anybody know what this problem might be?
I would like to upgrade to the latest version of Freemarker. However,
Struts2 in its wisdom has locked me down to version 2.3.8, and this was
released way back in 2006. Are there any plans to resolve this issue?
I was hoping that upgrading might fix my problems..
Jonny
--
Sent from the Struts - User mailing list archive at Nabble.com.

Attachment:
user_184999.ezm (zipped)--- Niral Trivedi <niral22@(protected):
> I am using Struts 2.0.11 on RAD7, Webspher 6.1, JDK 1.5.
Hey, me too. My sympathies.
> I am trying to create radio buttons using a dynamic Map as below:
>
> <s:bean name="
java.util.HashMap" id="keepRemoveRadioMap">
> <s:param name="Keep" value="john"/>
> <s:param name="Remove" value="doe"/>
> </s:bean>
>
> <td width="20%" style="background-color:#fffade; vertical-align:center">
> <s:radio name="keepRemove" list="keepRemoveRadioMap" onclick=
> "changeKeep1()" theme="simple"/>
> </td>
>
> But when I try to load the page, it is giving Freemaker Template exception
> as below(I haven't pasted entire stack trace for readability) :
What happens if you use list="#keepRemoveRadioMap"?
While I've never used the <s:bean...> tag, normally when you create an object
in the OGNL context like that you need to refer to it with a leading "#"
meaning that it's a named object, not a property of an object on the value
stack.
Dave

Attachment:
user_185000.ezm (zipped)I think the easiest way to get a project going, is to use the maven
archetype and then ask maven to generate the eclipse project:
http://struts.apache.org/2.x/docs/struts-maven-archetypes.html
regards
musachy
On Wed, Apr 2, 2008 at 12:19 PM, Dave Newton <newton.dave@(protected):
> --- Sam Wun <samwun2@(protected):
>
> > Do you meant unzip the struts-xxx.zip file into the WEB-INF/lib/ folder?
> > or use File->Import in Eclipse or Weblogic?
>
> You should File->Import only the specific S2/etc. libraries you need into
> WEB_INF/lib folder.
>
> In particular do *not* import plugin libraries you're not using, as they'll
> have library dependencies of their own.
>
>
>
> Dave
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
--
"Hey you! Would you help me to carry the stone?" Pink Floyd

Attachment:
user_185001.ezm (zipped)A servlet filter is relatively easy if you are going to put restrictions on
the actions alone and you don't have to mess with interceptor stacks. We've
done both interceptors and a filter and the filter is lower maintenance.
Just put the filter before the struts 2 filter in your web.xml. If you want
to secure more than the actions then I think Acegi is the way to go.
Regards,
Randy Burgess
Sr. Web Applications Developer
Nuvox Communications
> From: Frans Thamura <frans@(protected)>
> Reply-To: Struts Users Mailing List <user@(protected)>
> Date: Thu, 3 Apr 2008 07:13:20 +0700
> To: Struts Users Mailing List <user@(protected)>
> Subject: Re: Security @ Struts2, using Acegy or Inspector
>
>> If you anticipate having the complexity of a full ACL implementation, I'd
>> just go ahead and use AceGI; why re-invent all that machinery? If you decide
>> to roll your own, though, then the interceptor can access the action through
>> the ActionInvocation object and, through the action, can access your POJO
>> via whatever mechanism you want -- via ModelDriven's getModel() method,
>> through an interceptor-specific interface you design, or whatever.
>
>
> my idea is to make a class that extend Action
>
> so, if I extend this action, the action will query and get security
> permission from database.. because i prefer database driven ..
>
> but i thinking a interceptor, but new in this area, i prefer a pattern that
> filter any action
>
> but.. i am loking also in AOP of spring or may be a HTTPFilter mechanism
> (still dont know, how to implement Struts2 based in the httpfilter)
>
>
> F
This email and any attachments ("Message") may contain legally privileged and/or confidential information. If you are not the addressee, or if this Message has been addressed to you in error, you are not authorized to read, copy, or distribute it, and we ask that you please delete it (including all copies) and notify the sender by return email. Delivery of this Message to any person other than the intended recipient(s) shall not be deemed a waiver of confidentiality and/or a privilege.

Attachment:
user_185002.ezm (zipped)
Hi,
i want to know if it 's possible to allow multiple selections in same
datetimepicker struts2 component? (to select more than one date)
thanks
--
Sent from the Struts - User mailing list archive at Nabble.com.

Attachment:
user_185003.ezm (zipped)
You need to have access to the Dispatcher and the ServletContext in your tests, but you could do something like this for per-unit test configurations:
ConfigurationProvider provider = new StrutsXmlConfigurationProvider(
"struts-test.xml", true, servletContext);
dispatcher.getConfigurationManager().addConfigurationProvider(provider);
dispatcher.getConfigurationManager().reload();
If you set devMode = true for your tests, you might be able to avoid the reload() call.
If you have a just a single "struts-test.xml" for all of your tests, you could do something like this in your setUp():
Map<String, String> testConfig = new HashMap<String, String>();
testConfig.put("config", "struts-default.xml,struts-plugin.xml,struts.xml,struts-test.xml");
dispatcher = new Dispatcher(servletContext,
new HashMap<String, String>());
dispatcher.init();
Dispatcher.setInstance(dispatcher);
-----Original Message-----
From: Adam Hardy [mailto:ahardy.struts@(protected)]
Sent: Thursday, April 03, 2008 5:00 AM
To: Struts Users Mailing List
Subject: Re: struts.xml
Adam Hardy on 02/04/08 12:23, wrote:
> Can I have a second struts.xml in my test directory, and if so, how do
> I configure it?
>
> I'm testing some stuff using HttpUnit which launches the whole webapp
> in my tests. Having a test-only struts.xml will keep the test mappings
> out of the real webapp, allow me to drop stuff I don't need for the
> tests, and make the tests faster.
From the lack of replies, I assume the answer is 'No, you cannot have an alternative struts.xml'.
I was checking the low-down on the wiki, where I found that the struts configuration xml can be in multiple files listed by the property in the
struts.properties:
### A list of configuration files automatically loaded by Struts struts.configuration.files=struts-default.xml,struts-plugin.xml,struts.xml
Using this property, I can set up my maven environment to filter struts.properties as a resource and set that property explicitly, so in testing I can have 'struts-test.xml'
This works to a limited extent, i.e. one struts.xml for all testing, another for in-container deployment.
It's not quite ideal though, as I would prefer to choose the struts.xml on a per-test basis.
Does anyone know of something I've missed that allows this?
Thanks
Adam
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)
----------------------------------------------------------------------
CONFIDENTIALITY NOTICE This message and any included attachments are from Cerner Corporation and are intended only for the addressee. The information contained in this message is confidential and may constitute inside or non-public information under international, federal, or state securities laws. Unauthorized forwarding, printing, copying, distribution, or use of such information is strictly prohibited and may be unlawful. If you are not the addressee, please promptly delete this message and notify the sender of the delivery error by e-mail or you may call Cerner's corporate offices in Kansas City, Missouri, U.S.A at (+1) (816)221-1024.

Attachment:
user_185008.ezm (zipped)
Copy paste error, you need to initialize the Dispatcher with your testConfig map:
Map<String, String> testConfig = new HashMap<String, String>();
testConfig.put("config", "struts-default.xml,struts-plugin.xml,struts.xml,struts-test.xml");
dispatcher = new Dispatcher(servletContext,
testConfig);
dispatcher.init();
Dispatcher.setInstance(dispatcher);
-----Original Message-----
From: Relph,Brian [mailto:Brian.Relph@(protected)]
Sent: Thursday, April 03, 2008 9:48 AM
To: Struts Users Mailing List
Subject: RE: struts.xml
You need to have access to the Dispatcher and the ServletContext in your tests, but you could do something like this for per-unit test configurations:
ConfigurationProvider provider = new StrutsXmlConfigurationProvider(
"struts-test.xml", true, servletContext);
dispatcher.getConfigurationManager().addConfigurationProvider(provider);
dispatcher.getConfigurationManager().reload();
If you set devMode = true for your tests, you might be able to avoid the reload() call.
If you have a just a single "struts-test.xml" for all of your tests, you could do something like this in your setUp():
Map<String, String> testConfig = new HashMap<String, String>();
testConfig.put("config", "struts-default.xml,struts-plugin.xml,struts.xml,struts-test.xml");
dispatcher = new Dispatcher(servletContext,
new HashMap<String, String>());
dispatcher.init();
Dispatcher.setInstance(dispatcher);
-----Original Message-----
From: Adam Hardy [mailto:ahardy.struts@(protected)]
Sent: Thursday, April 03, 2008 5:00 AM
To: Struts Users Mailing List
Subject: Re: struts.xml
Adam Hardy on 02/04/08 12:23, wrote:
> Can I have a second struts.xml in my test directory, and if so, how do
> I configure it?
>
> I'm testing some stuff using HttpUnit which launches the whole webapp
> in my tests. Having a test-only struts.xml will keep the test mappings
> out of the real webapp, allow me to drop stuff I don't need for the
> tests, and make the tests faster.
From the lack of replies, I assume the answer is 'No, you cannot have an alternative struts.xml'.
I was checking the low-down on the wiki, where I found that the struts configuration xml can be in multiple files listed by the property in the
struts.properties:
### A list of configuration files automatically loaded by Struts struts.configuration.files=struts-default.xml,struts-plugin.xml,struts.xml
Using this property, I can set up my maven environment to filter struts.properties as a resource and set that property explicitly, so in testing I can have 'struts-test.xml'
This works to a limited extent, i.e. one struts.xml for all testing, another for in-container deployment.
It's not quite ideal though, as I would prefer to choose the struts.xml on a per-test basis.
Does anyone know of something I've missed that allows this?
Thanks
Adam
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)
----------------------------------------------------------------------
CONFIDENTIALITY NOTICE This message and any included attachments are from Cerner Corporation and are intended only for the addressee. The information contained in this message is confidential and may constitute inside or non-public information under international, federal, or state securities laws. Unauthorized forwarding, printing, copying, distribution, or use of such information is strictly prohibited and may be unlawful. If you are not the addressee, please promptly delete this message and notify the sender of the delivery error by e-mail or you may call Cerner's corporate offices in Kansas City, Missouri, U.S.A at (+1) (816)221-1024.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)

Attachment:
user_185004.ezm (zipped)
hi all, i am new to struts 2 ,
i have download a struts's application (struts showcase) and run it . it's
working fine , but i am not able to get how it's(page) header set (where
are different tabs for different application) .
if i want to change this header , we i need to change ??
--
Sent from the Struts - User mailing list archive at Nabble.com.

Attachment:
user_185006.ezm (zipped)Showcase uses sitemesh and the tab links are on the sitemesh template.
If you are just starting you will find it easier to play with
struts-blank (distributed with struts).
musachy
On Thu, Apr 3, 2008 at 10:50 AM, ghan_java <ghanshyam_ambah@(protected):
>
> hi all, i am new to struts 2 ,
> i have download a struts's application (struts showcase) and run it . it's
> working fine , but i am not able to get how it's(page) header set (where
> are different tabs for different application) .
>
> if i want to change this header , we i need to change ??
>
> --
> View this message in context: http://www.nabble.com/new-to-sturts-tp16467538p16467538.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
--
"Hey you! Would you help me to carry the stone?" Pink Floyd

Attachment:
user_185007.ezm (zipped)Showcase uses sitemesh and the tab links are on the sitemesh template.
If you are just starting you will find it easier to play with
struts-blank (distributed with struts).
musachy
On Thu, Apr 3, 2008 at 10:50 AM, ghan_java <ghanshyam_ambah@(protected):
>
> hi all, i am new to struts 2 ,
> i have download a struts's application (struts showcase) and run it . it's
> working fine , but i am not able to get how it's(page) header set (where
> are different tabs for different application) .
>
> if i want to change this header , we i need to change ??
>
> --
> View this message in context: http://www.nabble.com/new-to-sturts-tp16467538p16467538.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
--
"Hey you! Would you help me to carry the stone?" Pink Floyd

Attachment:
user_185005.ezm (zipped)
Attachment:
user_185009.ezm (zipped)2008/4/3, DWilkerson <dwilkerson@(protected)>:
>
> I am using MyEclipse, JBoss 4.0.2, and Struts 1.3.8
>
...
>
java.lang.NoSuchMethodError:
>
>
org.apache.struts.config.ModuleConfig.findActionConfigId(Ljava/lang/String;)
ModuleConfig.findActionConfigId has been introduced since Struts 1.3.6.
http://struts.apache.org/1.x/apidocs/org/apache/struts/config/ModuleConfig.html#findActionConfigId(
java.lang.String)
Probably you are messing with JARs of the taglib and the core. Are you sure
that they are of the same Struts version?
Antonio

Attachment:
user_185010.ezm (zipped)Thanks for the reply Antonio. I sincerely appreciate it.
I solved the problem. Figures as soon as I go on a posting spree...lol. It's
the way it always works.
When clicking "Redeploy" in MyEclipse to push your updated files to the
server, MyEclipse didn't delete the Struts 2 jars from my deployed
WEB-INF/lib directory. I had been experimenting with Struts 2. Now, I can
see why I got that error. The fix was to remove the war file using the
remove button on the MyEclipse deployment dialog, bounce JBoss, then
redeploy. Now only the 1.3.8 jars are there and no more error. Life is good
again.
Thanks again!
dw
-----Original Message-----
From: Antonio Petrelli [mailto:antonio.petrelli@(protected)]
Sent: Thursday, April 03, 2008 11:05 AM
To: Struts Users Mailing List
Subject: Re:
java.lang.NoSuchMethodError:
org.apache.struts.config.ModuleConfig.findActionConfigId(Ljava/lang/String;)
2008/4/3, DWilkerson <dwilkerson@(protected)>:
>
> I am using MyEclipse, JBoss 4.0.2, and Struts 1.3.8
>
...
>
java.lang.NoSuchMethodError:
>
>
org.apache.struts.config.ModuleConfig.findActionConfigId(Ljava/lang/St
> ring;)
ModuleConfig.findActionConfigId has been introduced since Struts 1.3.6.
http://struts.apache.org/1.x/apidocs/org/apache/struts/config/ModuleConfig.h
tml#findActionConfigId(
java.lang.String)
Probably you are messing with JARs of the taglib and the core. Are you sure
that they are of the same Struts version?
Antonio

Attachment:
user_185011.ezm (zipped)On Thu, Apr 3, 2008 at 1:03 AM, Al Sutton <al.sutton@(protected):
> Chris,
>
> I'm familiar with the code, but the main problem is that there is a "paper
> wall" between the StoreInterceptor and the jsp tags, so that one does not
> know or rely on how the other works.
>
> As far as I'm aware this is only a philosophical decision, and there is no
> technical reason why the tags can't removed information stored in the
> StoreInterceptor, but I'm pretty sure it would need the nod of those on the
> dev list to get into the final build.
>
Actually it wouldn't be removing information stored in the
StoreInterceptor as much as removing the already shown messages from
the lists stored in the Action. So, by the time he StoreInterceptor
got control, there would be nothing to store.
(*Chris*)

Attachment:
user_185016.ezm (zipped)The action messages and errors are stored in a request attribute which is
why the don't survive a redirect.
I played around with some ideas and found that Freemarker (the template
language used for the tags), is just too dumb to clear session scoped
variables (which would survive a redirect and are used by the
MessageStoreInterceptor), so I guess we're kind of stuffed until someone
works on the core code and comes up with a method that works.
Al.
P.S. The errors are delt with inside Xwork and not S2.1, so it's not a
simple job :(.
----- Original Message -----
From: "Chris Pratt" <thechrispratt@(protected)>
To: "Struts Users Mailing List" <user@(protected)>
Sent: Thursday, April 03, 2008 4:42 PM
Subject: Re: [DEV-IMPLICATIONS] Re: Actionerrors & the Store Interceptor
> On Thu, Apr 3, 2008 at 1:03 AM, Al Sutton <al.sutton@(protected):
>> Chris,
>>
>> I'm familiar with the code, but the main problem is that there is a
>> "paper
>> wall" between the StoreInterceptor and the jsp tags, so that one does not
>> know or rely on how the other works.
>>
>> As far as I'm aware this is only a philosophical decision, and there is
>> no
>> technical reason why the tags can't removed information stored in the
>> StoreInterceptor, but I'm pretty sure it would need the nod of those on
>> the
>> dev list to get into the final build.
>>
>
> Actually it wouldn't be removing information stored in the
> StoreInterceptor as much as removing the already shown messages from
> the lists stored in the Action. So, by the time he StoreInterceptor
> got control, there would be nothing to store.
> (*Chris*)
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>

Attachment:
user_185012.ezm (zipped)
Hi All,
I'm new to Struts2 . I dont know about Struts1.x either. Jus thought of
starting with Struts2.
I'm creating a web application. I jus want to initialize the system before
the application startup. Like reading certain config files, initializing the
Connection Pool, creating DAO factory.. etc.
I read somewhere that Struts1 has plugins to support this. But i couldnt
find anything in Struts2.
Please help me out.
Thanks and Regards,
Jijo
--
Sent from the Struts - User mailing list archive at Nabble.com.

Attachment:
user_185015.ezm (zipped)
Hi All,
I'm new to Struts2 . I dont know about Struts1.x either. Jus thought of
starting with Struts2.
I'm creating a web application. I jus want to initialize the system before
the application startup. Like reading certain config files, initializing the
Connection Pool, creating DAO factory.. etc.
I read somewhere that Struts1 has plugins to support this. But i couldnt
find anything in Struts2.
Please help me out.
Thanks and Regards,
Jijo
--
Sent from the Struts - User mailing list archive at Nabble.com.

Attachment:
user_185013.ezm (zipped)
Hello,
I wish to connect the s:autocompleter and s:div so that when the value in
autocompleter changes i need to refresh the div content to retrieve its
values.
here the code that i currently have
<s:div cssClass="formcontainer" href="%{EmailDistributionList_Load}"
theme="ajax" listenTopics="distributionListNameChange" autoStart="false"
formId="EmailDistributionList" >
<s:autocompleter name="emailDistributionList.distributionListName"
keyName="emailDistributionList.id"
list="emailDistributionLists" listKey="id"
listValue="distributionListName" searchType="substring"
notifyTopics="distributionListNameChange" theme="ajax" />
this cuases the div to load over again and again.
Thanks
Manish
--
Sent from the Struts - User mailing list archive at Nabble.com.

Attachment:
user_185014.ezm (zipped)
Hello,
I wish to connect the s:autocompleter and s:div so that when the value in
autocompleter changes i need to refresh the div content to retrieve its
values.
here the code that i currently have
<s:div cssClass="formcontainer" href="%{EmailDistributionList_Load}"
theme="ajax" listenTopics="distributionListNameChange" autoStart="false"
formId="EmailDistributionList" >
<s:autocompleter name="emailDistributionList.distributionListName"
keyName="emailDistributionList.id"
list="emailDistributionLists" listKey="id"
listValue="distributionListName" searchType="substring"
notifyTopics="distributionListNameChange" theme="ajax" />
this cuases the div to load over again and again even without changing the
value int eh autocompleter. i do not know to set the valuechanged.
Thanks
Manish
--
Sent from the Struts - User mailing list archive at Nabble.com.

Attachment:
user_185022.ezm (zipped)
Hello There,
I am new to struts and have a requirement where i have to connect the
autocompleter with the div e.g. when autocompleter's value changes i need
to refresh the contents of the div. i have written the following code to
achieve that.
The Div Code
--------------
<s:div cssClass="formcontainer" href="%{EmailDistributionList_Load}"
theme="ajax" listenTopics="distributionListNameChange" autoStart="false"
formId="EmailDistributionList" >
The AutoCompleter Code
-------------------------
<s:autocompleter name="emailDistributionList.distributionListName"
keyName="emailDistributionList.id"
list="emailDistributionLists" listKey="id"
listValue="distributionListName" searchType="substring"
notifyTopics="distributionListNameChange" theme="ajax" />
When the jsp loads it tries to refresh the page over and over submitting the
request to EmailDistributionList_Load action.
Any pointers would be greatly appreciated.
Thanks
Manish
--
Sent from the Struts - User mailing list archive at Nabble.com.

Attachment:
user_185023.ezm (zipped)The problem is that the notify topics are published multiple times
(before request, after request and on error). A parameter is passed to
the topic listener indicating when the topic is fired. Search the
archives for examples (dojo.event.topic.subscribe), also look at the
ajax examples on showcase.
musachy
On Thu, Apr 3, 2008 at 1:00 PM, manishbel <manishbel@(protected):
>
> Hello There,
>
> I am new to struts and have a requirement where i have to connect the
> autocompleter with the div e.g. when autocompleter's value changes i need
> to refresh the contents of the div. i have written the following code to
> achieve that.
>
> The Div Code
> --------------
> <s:div cssClass="formcontainer" href="%{EmailDistributionList_Load}"
> theme="ajax" listenTopics="distributionListNameChange" autoStart="false"
> formId="EmailDistributionList" >
>
> The AutoCompleter Code
> -------------------------
> <s:autocompleter name="emailDistributionList.distributionListName"
> keyName="emailDistributionList.id"
> list="emailDistributionLists" listKey="id"
> listValue="distributionListName" searchType="substring"
> notifyTopics="distributionListNameChange" theme="ajax" />
>
> When the jsp loads it tries to refresh the page over and over submitting the
> request to EmailDistributionList_Load action.
>
> Any pointers would be greatly appreciated.
>
> Thanks
> Manish
>
> --
> View this message in context: http://www.nabble.com/Connecting-s%3Aautocompleter-and-s%3Adiv-tp16467820p16467820.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
--
"Hey you! Would you help me to carry the stone?" Pink Floyd

Attachment:
user_185017.ezm (zipped)--- JiVi <jijo.vincent@(protected):
> I'm new to Struts2 . I dont know about Struts1.x either. Jus thought of
> starting with Struts2.
>
> I'm creating a web application. I jus want to initialize the system before
> the application startup. Like reading certain config files, initializing
> the
> Connection Pool, creating DAO factory.. etc.
> I read somewhere that Struts1 has plugins to support this. But i couldnt
> find anything in Struts2.
> Please help me out.
You may want to use a ServletContextListener.
http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/ServletContextListener.html
Dave

Attachment:
user_185018.ezm (zipped)I am trying to deal with the same issue. Did you get any resolution?
Following on from the reply asking for a stack trace, here is what I am
getting...
java.lang.NullPointerException at
com.opensymphony.xwork2.util.LocalizedTextUtil.findText (
LocalizedTextUtil.java:299)
at
com.opensymphony.xwork2.TextProviderSupport.getText (
TextProviderSupport.java:172)
at
com.opensymphony.xwork2.TextProviderSupport.getText (
TextProviderSupport.java:87)
at
com.opensymphony.xwork2.ActionSupport.getText (
ActionSupport.java:80)
<SNIP>
at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke (
NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke (
DelegatingMethodAccessorImpl.java:25)
at
java.lang.reflect.Method.invoke (
Method.java:585)
at org.junit.internal.runners.TestMethod.invoke(TestMethod.java:59)
at
org.junit.internal.runners.MethodRoadie.runTestMethod(MethodRoadie.java:98)
at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:79)
at
org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:87)
at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:77)
at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:42)
at
org.junit.internal.runners.JUnit4ClassRunner.invokeTestMethod(JUnit4ClassRunner.java:88)
at
org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51)
at
org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44)
at
org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)
at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
at
org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests (
RemoteTestRunner.java:460)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests (
RemoteTestRunner.java:673)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run (
RemoteTestRunner.java:386)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main (
RemoteTestRunner.java:196)
It is caused by ActionContext.getContext() returning null. Quite obviously I
do not have an action context during my unit testing.
Now I can certainly use the ActionContext.setContext() in my tests setup
method to push one into thread local storage and that works OK. It isn't
ideal though because ActionContext is a concrete class and so my choices
then become a bit limited.
I could create an instance but when I try this I find I have to create a
rather large object model to make it actually work. To the point where I
despair and give up.
Alternatively I could use a mock library (like easy mock). But I am not
inclined to include a mocking library that requires byte code rewriting (not
even for testing).
What I really want to do is inject a text provider into the ActionSupport
class. At the top of the ActionSupport class is this...
private final transient TextProvider textProvider = new
TextProviderFactory().createInstance(getClass(), this);
Damn its final and so I cannot inject my own text provider.
BUT it uses a factory, thats good. I know I will have a look at the factory
I bet I can monkey with that and inject a mock. Nope. It's all instance
based. No way I can get in there. And thats that. Now what do I do?
I can see two (half) workable solutions.
One is to override the the getText method in the action class when I
instantiate it during testing. So I end up doing this in all my action unit
tests...
Action action = new MyAction()
{
@Override
public String getText(String textName)
{
return "mocked";
}
};
It works, but its cheese.
Or two I can add a level of indirection in my action class, like so...
String text =
MyTextProviderFactory.getInstance(class.name).getText("some.property");
Then I can use a delegate to the real text provider during live code and a
mock of my own text provider during testing. The question here is, Why for
the love of Pete, why?
So in conclusion there are at least four options for testing Action classes
that use get text.
1. Build an action context by hand. (Too hard)
2. Use a class rewriting mocking library. (Not on my watch)
3. Mock the get text method. (Cheese)
4. Add another level of indirection. (Man thats just annoying)
Comments?
BTW If you got this far, thanks for taking the time.
Paul B.
Session Mwamufiya wrote:
>
> Hi All,
>
> Would someone let me know whether it's possible to tweak something so that
> JUnit test code can run on an action method that calls the ActionSupport
> method getText() to fetch string resources from a package.properties file.
> As it stands, I keep getting a null exception when getText() is called
> during the unit test.
>
> Thanks,
> Session
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
>
--
Sent from the Struts - User mailing list archive at Nabble.com.

Attachment:
user_185024.ezm (zipped)I recommend creating an action context. Here is the basic guide I followed to do so:
http://arsenalist.com/2007/06/18/unit-testing-struts-2-actions-spring-junit/
If you are not using spring or the struts2 spring plugin, you can cut out all the code around the applicationContext.
-----Original Message-----
From: paulbrickell [mailto:paul.brickell@(protected)]
Sent: Thursday, April 03, 2008 11:44 AM
To: user@(protected)
Subject: Re: any struts 2 unit testers out there?
I am trying to deal with the same issue. Did you get any resolution?
Following on from the reply asking for a stack trace, here is what I am getting...
java.lang.NullPointerException at
com.opensymphony.xwork2.util.LocalizedTextUtil.findText (
LocalizedTextUtil.java:299)
at
com.opensymphony.xwork2.TextProviderSupport.getText (
TextProviderSupport.java:172)
at
com.opensymphony.xwork2.TextProviderSupport.getText (
TextProviderSupport.java:87)
at
com.opensymphony.xwork2.ActionSupport.getText (
ActionSupport.java:80)
<SNIP>
at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke (
NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke (
DelegatingMethodAccessorImpl.java:25)
at
java.lang.reflect.Method.invoke (
Method.java:585)
at org.junit.internal.runners.TestMethod.invoke(TestMethod.java:59)
at
org.junit.internal.runners.MethodRoadie.runTestMethod(MethodRoadie.java:98)
at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:79)
at
org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:87)
at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:77)
at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:42)
at
org.junit.internal.runners.JUnit4ClassRunner.invokeTestMethod(JUnit4ClassRunner.java:88)
at
org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51)
at
org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44)
at
org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)
at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
at
org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests (
RemoteTestRunner.java:460)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests (
RemoteTestRunner.java:673)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run (
RemoteTestRunner.java:386)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main (
RemoteTestRunner.java:196)
It is caused by ActionContext.getContext() returning null. Quite obviously I do not have an action context during my unit testing.
Now I can certainly use the ActionContext.setContext() in my tests setup method to push one into thread local storage and that works OK. It isn't ideal though because ActionContext is a concrete class and so my choices then become a bit limited.
I could create an instance but when I try this I find I have to create a rather large object model to make it actually work. To the point where I despair and give up.
Alternatively I could use a mock library (like easy mock). But I am not inclined to include a mocking library that requires byte code rewriting (not even for testing).
What I really want to do is inject a text provider into the ActionSupport class. At the top of the ActionSupport class is this...
private final transient TextProvider textProvider = new TextProviderFactory().createInstance(getClass(), this);
Damn its final and so I cannot inject my own text provider.
BUT it uses a factory, thats good. I know I will have a look at the factory I bet I can monkey with that and inject a mock. Nope. It's all instance based. No way I can get in there. And thats that. Now what do I do?
I can see two (half) workable solutions.
One is to override the the getText method in the action class when I instantiate it during testing. So I end up doing this in all my action unit tests...
Action action = new MyAction()
{
@Override
public String getText(String textName)
{
return "mocked";
}
};
It works, but its cheese.
Or two I can add a level of indirection in my action class, like so...
String text =
MyTextProviderFactory.getInstance(class.name).getText("some.property");
Then I can use a delegate to the real text provider during live code and a mock of my own text provider during testing. The question here is, Why for the love of Pete, why?
So in conclusion there are at least four options for testing Action classes that use get text.
1. Build an action context by hand. (Too hard) 2. Use a class rewriting mocking library. (Not on my watch) 3. Mock the get text method. (Cheese) 4. Add another level of indirection. (Man thats just annoying)
Comments?
BTW If you got this far, thanks for taking the time.
Paul B.
Session Mwamufiya wrote:
>
> Hi All,
>
> Would someone let me know whether it's possible to tweak something so
> that JUnit test code can run on an action method that calls the
> ActionSupport method getText() to fetch string resources from a package.properties file.
> As it stands, I keep getting a null exception when getText() is called
> during the unit test.
>
> Thanks,
> Session
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
>
--
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)
----------------------------------------------------------------------
CONFIDENTIALITY NOTICE This message and any included attachments are from Cerner Corporation and are intended only for the addressee. The information contained in this message is confidential and may constitute inside or non-public information under international, federal, or state securities laws. Unauthorized forwarding, printing, copying, distribution, or use of such information is strictly prohibited and may be unlawful. If you are not the addressee, please promptly delete this message and notify the sender of the delivery error by e-mail or you may call Cerner's corporate offices in Kansas City, Missouri, U.S.A at (+1) (816)221-1024.

Attachment:
user_185019.ezm (zipped)Hello everbody,
I'm new to Struts2 and also this mailing list.
I'm programming a user management for a non-profit organisation.
My question is now:
I have started with the basic struts2 application. In the index.jsp
there is a form which looks (nearly) like this:
>>>
<s:form action="saveReg" validate="true">
<s:param name="status" value="waiting" />
<s:textfield id="id" name="registration.id"
cssStyle="display:none"/>
<s:textfield id="firstName" label="First Name"
name="registration.firstName"/>
<s:textfield id="lastName" label="Laste Name"
name="registration.lastName"/>
<s:textfield id="email" label="Email"
name="registration.email"/>
<s:submit theme="ajax" targets="registrations"
notifyTopics="/save"/>
</s:form>
<<<
Why cant I append the paramter 'status' and pass it through to the
action class?
I read a lot of docs and faqs but didnt find the answer.
Is it my mistake, a bug or do I need a certain workaround?
I thought about taking a display:none textfield, but it would make me
quite unhappy to start the project with dirty tricks and workarounds ;-)
Any help appreciated.
Best regards
Peter

Attachment:
user_185021.ezm (zipped)I think what you are looking for is:
<s:hidden name="status" value="waiting" />
This creates a hidden input field in the form which then passes the "status"
parameter to the request when the form submits.
On 4/3/08, Peter Theissen <peter.theissen@(protected):
>
> Hello everbody,
>
> I'm new to Struts2 and also this mailing list.
> I'm programming a user management for a non-profit organisation.
>
> My question is now:
> I have started with the basic struts2 application. In the index.jsp
> there is a form which looks (nearly) like this:
> >>>
> <s:form action="saveReg" validate="true">
> <s:param name="status" value="waiting" />
> <s:textfield id="id" name="registration.id" cssStyle="display:none"/>
> <s:textfield id="firstName" label="First Name"
> name="registration.firstName"/>
> <s:textfield id="lastName" label="Laste Name"
> name="registration.lastName"/>
> <s:textfield id="email" label="Email"
> name="registration.email"/>
> <s:submit theme="ajax" targets="registrations"
> notifyTopics="/save"/>
> </s:form>
> <<<
> Why cant I append the paramter 'status' and pass it through to the action
> class?
> I read a lot of docs and faqs but didnt find the answer.
> Is it my mistake, a bug or do I need a certain workaround?
> I thought about taking a display:none textfield, but it would make me
> quite unhappy to start the project with dirty tricks and workarounds ;-)
>
> Any help appreciated.
>
> Best regards
> Peter
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

Attachment:
user_185020.ezm (zipped)Hi guys,
in struts2 i have a class that extends ActionSupport.
In my validate method i can use clearErrorsAndMessages(); but when i try
clearFieldErrors() eclipse can not find it .
Should i put setFieldErrors(null); or extend another class ?
I appreciate your replies.
Regards,
Leon

Attachment:
user_185025.ezm (zipped)Hi. This question may be very simple to answer, but it's driving me
crazy. If I have code similar to:
<s:iterator value="intList">
</s:iterator>
Where intList is of type List<Integer>, how do I reference to current
Integer on the value stack without using <s:property />? So I want to
reference the current Integer with OGNL or EL expression language like:
<select>
<s:iterator value="intList">
<option value="${currInt}" <s:if test="${currInt ==
1}">selected</s:if>>${currInt}</option>
</s:iterator>
</select>
Here, currInt is the reference to the current Integer on the value
stack. I hope this makes sense. Any help would be greatly appreciated.
Thanks,
Eric Nelson
Software Engineer Program Manager