Author Login
Post Reply
user Digest 22 Jul 2009 05:40:30 -0000 Issue 8764
Topics (messages 200954 through 200975):
Struts2.16 Source Code study:Help! What happened in request.getParameterMap()?
200954 by: BlackKnight
S2-portlet and spring integration
200955 by: Norris Shelton
200968 by: Edwin Quita
Who moved OgnlValueStack?
200956 by: stanlick
200958 by: Musachy Barroso
200959 by: Dale Newfield
200962 by: stanlick
Re: Struts w/Ajax with Struts again
200957 by: cpanon
200963 by: Martin Gainty
200966 by: Dave Newton
checkbox in an iterator!
200960 by: BlackKnight
Re: unit testing Struts2 application (with Spring and Hibernate)
200961 by: Dimitrios Christodoulakis
200964 by: Haroon Rafique
200965 by: Dimitrios Christodoulakis
Struts2 portlet bug found
200967 by: Tracy12
Re: source code for examples
200969 by: Sam Wun
200970 by: Sam Wun
200972 by: Dave Newton
200973 by: Sam Wun
Re: Fileupload
200971 by: Wes Wannemacher
Redirecting to servlet
200974 by: Kavita Mehta
help getting struts2 validation to work using java 1.6
200975 by: gwen harold autencio
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_200954.ezm (zipped)Hi, guys
I am studying struts2 source code.
I am wondering how struts2 get those parameters from a submitted
webform. So I traced the program from filterdispatch.class into
DefaultActionMapper.class(). I found a method
public void handleSpecialParameters(HttpServletRequest request,
ActionMapping mapping) {
.............
Map parameterMap = request.getParameterMap();//the line
..................
}
The thing I don't understand is before this line was called. debug show
the parameterMap in request is empty! however after this line. the
parameterMap was filled with values!!!And this methods is not traceable.
So my questions are:
1) where did struts2 /xwork2 get parameter from the webform and put them
into the request body.
2) what happened in that line?
Thanks in advance!
Frank

Attachment:
user_200955.ezm (zipped)I have a Struts2-portlet application that works. The correct action is executed, but I get a NPE when I try to access my spring-injected beans. The logs do show that the spring beans were constructed correctly. I do have the struts2-spring-plugin included.
Norris Shelton
Software Engineer
Sun Certified Java 1.1 Programmer
Shelton Consulting, LLC
ICQ# 26487421
AIM NorrisEShelton
YIM norrisshelton

Attachment:
user_200968.ezm (zipped)hi Norris,
i have here a portlet archetype that has spring integration:
http://edwin.quita.googlepages.com/portlet-archetype.zip
http://edwin.quita.googlepages.com/service-archetype.zip
http://edwin.quita.googlepages.com/Maven2HowTo.doc
you can use the project pom files as reference.
HTH,
/kits
On Tue, Jul 21, 2009 at 5:43 PM, Norris Shelton<norrisshelton@(protected):
> I have a Struts2-portlet application that works. The correct action is executed, but I get a NPE when I try to access my spring-injected beans. The logs do show that the spring beans were constructed correctly. I do have the struts2-spring-plugin included.
>
>
> Norris Shelton
> Software Engineer
> Sun Certified Java 1.1 Programmer
> Shelton Consulting, LLC
> ICQ# 26487421
> AIM NorrisEShelton
> YIM norrisshelton
>
>
>
>

Attachment:
user_200956.ezm (zipped)
I am experimenting with struts 2.1.7 and apparently xwork 2.1.4 has moved
OgnlValueStack from package com.opensymphony.xwork2.util to
com.opensymphony.xwork2.ognl! Was this some cruel joke?
Peace,
Scott
--
Sent from the Struts - User mailing list archive at Nabble.com.

Attachment:
user_200958.ezm (zipped)hm..I think it was there all the time.
musachy
On Tue, Jul 21, 2009 at 10:03 AM, stanlick<stanlick@(protected):
>
> I am experimenting with struts 2.1.7 and apparently xwork 2.1.4 has moved
> OgnlValueStack from package com.opensymphony.xwork2.util to
> com.opensymphony.xwork2.ognl! Was this some cruel joke?
>
> Peace,
> Scott
> --
> View this message in context: http://www.nabble.com/Who-moved-OgnlValueStack--tp24591681p24591681.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_200959.ezm (zipped)stanlick wrote:
> I am experimenting with struts 2.1.7 and apparently xwork 2.1.4 has moved
> OgnlValueStack from package com.opensymphony.xwork2.util to
> com.opensymphony.xwork2.ognl! Was this some cruel joke?
Why do you need to reference OgnlValueStack? The more generic
ValueStack is in com.opensymphony.xwork2.util....
-Dale

Attachment:
user_200962.ezm (zipped)
Thanks Dale --
Now that might be the better question! It appears we have not been
consistent in a few corporate plug-ins between using the VS or OVS, and
those places referencing OVS stopped working in 2.1.7 when xwork relocated
the OVS.
Peace,
Scott
DNewfield wrote:
>
> stanlick wrote:
>> I am experimenting with struts 2.1.7 and apparently xwork 2.1.4 has moved
>> OgnlValueStack from package com.opensymphony.xwork2.util to
>> com.opensymphony.xwork2.ognl! Was this some cruel joke?
>
> Why do you need to reference OgnlValueStack? The more generic
> ValueStack is in com.opensymphony.xwork2.util....
>
> -Dale
>
> ---------------------------------------------------------------------
> 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_200957.ezm (zipped)Hi Martin
Yes, I did in the line defining both the initial action to bring up the form and the action tasked with processing the Ajax call. Also I put in the Ajax processing action specific setSeeMe("fromAjaxAction") and set that in both the request and the session objects. Still nothing but what the first default process set. The changes set in the Ajax action did not show no matter what life-cycle object they were put in nor what scope the action was defined. This should not be the case, correct? If I set the scope to request, and if I set a change in a actionForm and set it in the request, I should see it on the forwarded form. tia.
--- On Mon, 7/20/09, Martin Gainty <mgainty@(protected):
From: Martin Gainty <mgainty@(protected)>
Subject: RE: Struts w/Ajax with Struts again
To: "Struts Users Mailing List" <user@(protected)>
Date: Monday, July 20, 2009, 10:18 AM
did you check scope="request" in struts-config.xml
as earlier suggested
Martin Gainty
______________________________________________
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.
> Date: Mon, 20 Jul 2009 03:36:36 -0700
> From: cpanon@(protected)
> Subject: Re: Struts w/Ajax with Struts again
> To: user@(protected)
>
> Hi PW
> But I cant access the session objects with JS, nor can I iterate the collections I have in the session to display the updated values that were written in the Ajax processing action. Correct?
>
> --- On Mon, 7/20/09, Paweł Wielgus <poulwiel@(protected):
>
> From: Paweł Wielgus <poulwiel@(protected)>
> Subject: Re: Struts w/Ajax with Struts again
> To: "Struts Users Mailing List" <user@(protected)>
> Date: Monday, July 20, 2009, 2:18 AM
>
> Hi cpanon,
>
> > I am looking for the simplest technique that would reprocess the session objects from the new values, regenerate the full jsp,
>
> then just refresh the whole page, by javascript after completion of ajax.
> Or do not use ajax at all, this will be most simple solution for You.
>
> Best greetings,
> Paweł Wielgus.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
_________________________________________________________________
Windows Live™ Hotmail®: Celebrate the moment with your favorite sports pics. Check it out.
http://www.windowslive.com/Online/Hotmail/Campaign/QuickAdd?ocid=TXT_TAGLM_WL_QA_HM_sports_photos_072009&cat=sports

Attachment:
user_200963.ezm (zipped)
post the complete contents of struts-config.xml
event timing is crucial specifically you'll need your Ajax control to detect ON_COMPLETE
a fairly comprehensive example of handling ON_COMPLETE at
http://struts.apache.org/2.0.14/docs/ajax-validation.html
any objections to using new version struts-2.1.6..its stable enough for G/A?
Martin Gainty
______________________________________________
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.?
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.
> Date: Tue, 21 Jul 2009 10:09:43 -0700
> From: cpanon@(protected)
> Subject: RE: Struts w/Ajax with Struts again
> To: user@(protected)
>
> Hi Martin
> Yes, I did in the line defining both the initial action to bring up the form and the action tasked with processing the Ajax call. Also I put in the Ajax processing action specific setSeeMe("fromAjaxAction") and set that in both the request and the session objects. Still nothing but what the first default process set. The changes set in the Ajax action did not show no matter what life-cycle object they were put in nor what scope the action was defined. This should not be the case, correct? If I set the scope to request, and if I set a change in a actionForm and set it in the request, I should see it on the forwarded form. tia.
>
> --- On Mon, 7/20/09, Martin Gainty <mgainty@(protected):
>
> From: Martin Gainty <mgainty@(protected)>
> Subject: RE: Struts w/Ajax with Struts again
> To: "Struts Users Mailing List" <user@(protected)>
> Date: Monday, July 20, 2009, 10:18 AM
>
>
> did you check scope="request" in struts-config.xml
>
> as earlier suggested
>
> Martin Gainty
> ______________________________________________
> Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
>
>
> Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
> Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.
>
>
>
>
>
> > Date: Mon, 20 Jul 2009 03:36:36 -0700
> > From: cpanon@(protected)
> > Subject: Re: Struts w/Ajax with Struts again
> > To: user@(protected)
> >
> > Hi PW
> > But I cant access the session objects with JS, nor can I iterate the collections I have in the session to display the updated values that were written in the Ajax processing action. Correct?
> >
> > --- On Mon, 7/20/09, Paweł Wielgus <poulwiel@(protected):
> >
> > From: Paweł Wielgus <poulwiel@(protected)>
> > Subject: Re: Struts w/Ajax with Struts again
> > To: "Struts Users Mailing List" <user@(protected)>
> > Date: Monday, July 20, 2009, 2:18 AM
> >
> > Hi cpanon,
> >
> > > I am looking for the simplest technique that would reprocess the session objects from the new values, regenerate the full jsp,
> >
> > then just refresh the whole page, by javascript after completion of ajax.
> > Or do not use ajax at all, this will be most simple solution for You.
> >
> > Best greetings,
> > Paweł Wielgus.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@(protected)
> > For additional commands, e-mail: user-help@(protected)
> >
>
> _________________________________________________________________
> Windows Live™ Hotmail®: Celebrate the moment with your favorite sports pics. Check it out.
> http://www.windowslive.com/Online/Hotmail/Campaign/QuickAdd?ocid=TXT_TAGLM_WL_QA_HM_sports_photos_072009&cat=sports
_________________________________________________________________
NEW mobile Hotmail. Optimized for YOUR phone. Click here.
http://windowslive.com/Mobile?ocid=TXT_TAGLM_WL_CS_MB_new_hotmail_072009

Attachment:
user_200966.ezm (zipped)Martin Gainty wrote:
>
> post the complete contents of struts-config.xml
> event timing is crucial specifically you'll need your Ajax control to detect ON_COMPLETE
> a fairly comprehensive example of handling ON_COMPLETE at
> http://struts.apache.org/2.0.14/docs/ajax-validation.html
>
> any objections to using new version struts-2.1.6..its stable enough for G/A?
Still Struts 1.
Dave

Attachment:
user_200960.ezm (zipped)Hi guys,
I have a checkbox
<s:checkbox name="test" ></s:checkbox>
in an iterator.
However after the validation fail.
The value of the varible "test" in the valuestack became "true, ",
then after servral fail submit the value of the the varible "test" in
the valuestack became "true,
true,true,true,true,true..........". Any Suggestions?
Thanks!
Frank

Attachment:
user_200961.ezm (zipped)I have used this testing code to a certain extend, and seems to work
fine. So I am interested in making it work against a complete test
case scenario.
So, when trying to load a child entity after the parent is retrieved,
I get a LazyInitializationException Error. Sure enough, when the
system tries to load the dependent collection, it doesn't find a
session or thinks the session was closed.
During development this is solved by the
org.springframework.orm.jpa.support.OpenEntityManagerInViewFilterfilter declared in the web.xml file.
So, I tried adding that file in the BaseStrutsTestCase in the
CONFIG_LOCATIONS String:
private static final String CONFIG_LOCATIONS =
"..../WEB-INF/applicationContext.xml," + ".../WEB-INF/web.xml";
This time the error is:
ERROR ContextLoader:215 - Context initialization failed
org.springframework.beans.factory.parsing.BeanDefinitionParsingException:
Configuration problem: Unable to locate Spring NamespaceHandler for
XML schema namespace [http://java.sun.com/xml/ns/j2ee]
Offending resource: URL [file:/C:/...../WebContent/WEB-INF/web.xml]
The CONFIG_LOCATIONS is used to initialize the servletContext which in
turn is used to initialize the applicationContext, right? So, I am not
sure where is the correct place to add the web.xml file, or how to
tell BaseStrutsTestCase to include OpenEntityManagerInViewFilter
during the recreation of the framework.
Is that a limitation of this test class, or I am trying to include my
web.xml file the wrong way?
I am not sure if other folks using this example code dealt with
something like this in the past and solved it. Haroon, I hope you
don't mind my asking you again about this :)
Also, a more general question: Can the proxy class be used to create
and run two actions sequentially? Let's say I want to test an action
in my secure namespace, meaning that some sort of login or
registration action comes first.
So, could I do something like this in my test method?:
@Test
public void testExecute() throws Exception{
Login testLogin = createAction(Login.class, "/", "Login");
//set my fields
testLogin.setPassword("...");
//execute proxy once
proxy.execute();
//Then create my secure action
UpdateProfile testUpdateProfile =
createAction(UpdateProfile.class, "/secure", "UpdateProfile");
//and then execute proxy again
proxy.execute();
}
This doesn't seem to work when I tried it. Could that be a violation
of the ActionProxy rules? Before digging any deeper I just thought to
ask this, in case there is another way to link and execute several
sequential actions within the same test?
Up until now I manually created mock objects to satisfy any
dependencies of the class under test: Created a user object and put in
on a Session map manually to simulate a successful login action. So
the motive here was to use this example test code to actually create
and execute a successful test of the predecessor action (so the login
action itself could add the logged in user to the session) before the
actual action that I am primarily testing (updateProfile).
Anyway, I sure hope I am not stretching this conversation too far by
experimenting a bit further with this example. Any suggestions are
appreciated.
Regards.
On Mon, Jul 20, 2009 at 5:02 PM, Haroon
Rafique<haroon.rafique@(protected):
> On Today at 4:32pm, DC=>Dimitrios Christodoulakis <dimi.chr@(protected):
>
> DC> Thanks Haroon for the handy advice. That seems to do the trick as far
> DC> as the session object is concerned. The test passes now.
> DC>
>
> Glad it worked out.
>
> DC>
> DC> Would it be easy for someone to extend your code to include actions
> DC> that implement the -aware interfaces? If I wanted to take a shot at
> DC> that, is there a particular point you would suggest I start with?
> DC>
>
> Did you add that code in your Test class? I was actually suggesting that
> you modify the code inside BaseStrutsTestCase. So, I would recommend
> adding a private static HashMap variable called sessionMap in
> BaseStrutsTestCase. And then in the createAction method, issue the
> statement:
> proxy.getInvocation().getInvocationContext().setSession(sessionMap);
>
> Hope that helps.
>
> The only other fringe case that I have dealth with in our code, is when we
> have actions that implement Preparable and are used with a
> ParamsPrepareParams interceptor. I created a method to allow action
> parameters to be set.
>
> /**
> * Sets the action parameters
> * @param parameters Parameters to set
> */
> protected void setActionParameters(Map<String, String>
> parameters) {
> proxy.getInvocation().getInvocationContext().
> setParameters(parameters);
> }
>
> Then inside my Action Test class, I can issue:
> proxy.setActionParameters(...);
> before:
> proxy.execute();
>
> Cheers,
> --
> Haroon Rafique
> <haroon.rafique@(protected)>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

Attachment:
user_200964.ezm (zipped)On Today at 2:02pm, DC=>Dimitrios Christodoulakis <dimi.chr@(protected):
DC> [..snip..]
DC>
DC> The CONFIG_LOCATIONS is used to initialize the servletContext which in
DC> turn is used to initialize the applicationContext, right? So, I am not
DC> sure where is the correct place to add the web.xml file, or how to
DC> tell BaseStrutsTestCase to include OpenEntityManagerInViewFilter
DC> during the recreation of the framework.
DC>
The CONFIG_LOCATIONS variable is used to initialize spring only. I don't
use spring-orm, so I can't comment on how to tell BaseStrutsTestCase to
include that particular filter (or any other filter for that matter).
DC>
DC> Is that a limitation of this test class, or I am trying to include my
DC> web.xml file the wrong way?
DC>
Most probably a limitation.
DC>
DC> I am not sure if other folks using this example code dealt with
DC> something like this in the past and solved it. Haroon, I hope you
DC> don't mind my asking you again about this :)
DC>
DC> Also, a more general question: Can the proxy class be used to create
DC> and run two actions sequentially? Let's say I want to test an action
DC> in my secure namespace, meaning that some sort of login or
DC> registration action comes first.
DC>
I think you're over-stepping the bounds of unit testing here. In any case,
I have created multiple invocations of the same action in the same test
method without any problems. E.g.,
createAction(SomeAction.class, "/namespace", "actionName");
//... set some parameters
assertEquals(SUCCESS, proxy.execute());
//create action again
createAction(SomeAction.class, "/namespace", "actionName");
//... set some *different* parameters so that we expect INPUT to be
// returned
assertEquals(INPUT, proxy.execute());
There's nothing to prevent you from recreating another Action all
together. You just have to remember that every time you execute
createAction, it creates a new mock request and mock response, so you have
to populate things properly.
DC>
DC> So, could I do something like this in my test method?:
DC>
In your code below, where you say // and then execute proxy again, are you
missing some stepls where you need to supply some parameters to the
action?
DC>
DC> @Test
DC> public void testExecute() throws Exception{
DC> Login testLogin = createAction(Login.class, "/", "Login");
DC> //set my fields
DC> testLogin.setPassword("...");
DC> //execute proxy once
DC> proxy.execute();
DC> //Then create my secure action
DC> UpdateProfile testUpdateProfile =
DC> createAction(UpdateProfile.class, "/secure", "UpdateProfile");
DC> //and then execute proxy again
DC> proxy.execute();
DC> }
DC>
DC> [..snip..]
DC>
DC> Up until now I manually created mock objects to satisfy any
DC> dependencies of the class under test: Created a user object and put in
DC> on a Session map manually to simulate a successful login action. So
DC> the motive here was to use this example test code to actually create
DC> and execute a successful test of the predecessor action (so the login
DC> action itself could add the logged in user to the session) before the
DC> actual action that I am primarily testing (updateProfile).
DC>
Smells like functional testing to me.
DC>
DC> Anyway, I sure hope I am not stretching this conversation too far by
DC> experimenting a bit further with this example. Any suggestions are
DC> appreciated.
DC>
DC> Regards.
Cheers,
--
Haroon Rafique
<haroon.rafique@(protected)>

Attachment:
user_200965.ezm (zipped)>
> In your code below, where you say // and then execute proxy again, are you
> missing some stepls where you need to supply some parameters to the
> action?
>
Yes, that wasn't actual code, just the steps I was considering.
-In any case it's good to know the limitations of the example. You are
right, sometimes I need to test a broader unit of work, which can
include a couple of actions, rather than just one. So, in that sense,
I could be stepping into the functional testing area.
I appreciate all the helpful information. I've already learned a lot,
by the example code, and the discussions on this thread!
On Tue, Jul 21, 2009 at 3:31 PM, Haroon
Rafique<haroon.rafique@(protected):
> On Today at 2:02pm, DC=>Dimitrios Christodoulakis <dimi.chr@(protected):
>
> DC> [..snip..]
> DC>
> DC> The CONFIG_LOCATIONS is used to initialize the servletContext which in
> DC> turn is used to initialize the applicationContext, right? So, I am not
> DC> sure where is the correct place to add the web.xml file, or how to
> DC> tell BaseStrutsTestCase to include OpenEntityManagerInViewFilter
> DC> during the recreation of the framework.
> DC>
>
> The CONFIG_LOCATIONS variable is used to initialize spring only. I don't
> use spring-orm, so I can't comment on how to tell BaseStrutsTestCase to
> include that particular filter (or any other filter for that matter).
>
> DC>
> DC> Is that a limitation of this test class, or I am trying to include my
> DC> web.xml file the wrong way?
> DC>
>
> Most probably a limitation.
>
> DC>
> DC> I am not sure if other folks using this example code dealt with
> DC> something like this in the past and solved it. Haroon, I hope you
> DC> don't mind my asking you again about this :)
> DC>
> DC> Also, a more general question: Can the proxy class be used to create
> DC> and run two actions sequentially? Let's say I want to test an action
> DC> in my secure namespace, meaning that some sort of login or
> DC> registration action comes first.
> DC>
>
> I think you're over-stepping the bounds of unit testing here. In any case,
> I have created multiple invocations of the same action in the same test
> method without any problems. E.g.,
>
> createAction(SomeAction.class, "/namespace", "actionName");
> //... set some parameters
> assertEquals(SUCCESS, proxy.execute());
> //create action again
> createAction(SomeAction.class, "/namespace", "actionName");
> //... set some *different* parameters so that we expect INPUT to be
> // returned
> assertEquals(INPUT, proxy.execute());
>
> There's nothing to prevent you from recreating another Action all
> together. You just have to remember that every time you execute
> createAction, it creates a new mock request and mock response, so you have
> to populate things properly.
>
>
> DC>
> DC> So, could I do something like this in my test method?:
> DC>
>
> In your code below, where you say // and then execute proxy again, are you
> missing some stepls where you need to supply some parameters to the
> action?
>
> DC>
> DC> @Test
> DC> public void testExecute() throws Exception{
> DC> Login testLogin = createAction(Login.class, "/", "Login");
> DC> //set my fields
> DC> testLogin.setPassword("...");
> DC> //execute proxy once
> DC> proxy.execute();
> DC> //Then create my secure action
> DC> UpdateProfile testUpdateProfile =
> DC> createAction(UpdateProfile.class, "/secure", "UpdateProfile");
> DC> //and then execute proxy again
> DC> proxy.execute();
> DC> }
> DC>
> DC> [..snip..]
> DC>
> DC> Up until now I manually created mock objects to satisfy any
> DC> dependencies of the class under test: Created a user object and put in
> DC> on a Session map manually to simulate a successful login action. So
> DC> the motive here was to use this example test code to actually create
> DC> and execute a successful test of the predecessor action (so the login
> DC> action itself could add the logged in user to the session) before the
> DC> actual action that I am primarily testing (updateProfile).
> DC>
>
> Smells like functional testing to me.
>
> DC>
> DC> Anyway, I sure hope I am not stretching this conversation too far by
> DC> experimenting a bit further with this example. Any suggestions are
> DC> appreciated.
> DC>
> DC> Regards.
>
> Cheers,
> --
> Haroon Rafique
> <haroon.rafique@(protected)>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

Attachment:
user_200967.ezm (zipped)
Hi,
We got a struts 2.0.6 portlet application with uPortal 2.5.3 ( inside
Pluto 1.0.x) with no issues and running fine.
Now we deployed the same struts 2.0.6 application in uPortal 3.1.1 (inside
pluto 1.1.7) and found following issue.
in our action classes we had the following, where session is of type
PortletSession.
session.setAttribute("studentId","1111111",PortletSession.APPLICATION_SCOPE)
We trieved the above studentId in the jsp as follows.
<s:property value="#session.studentId"/>
The above worked with no issues in uPortal 2.5.3 but with uPortal 3.1.1 this
is not working,
Then I tried the following
<s:property value="#application.studentId"/> but didnt work,
I interacted with the uPortal forum and this is what it
tells...http://www.nabble.com/Re%3A-is-this-a-bug-in-struts2-portlets-td24581733.html
I thought based on that <s:property value="#application.studentId"/> should
work,
What else could I try, This looks to me a bug. Can't understand why it is
not in the value stack.
If not pls let me know how to retrieve the above
PortletSession.APPLICATION_SCOPE variable in the jsp.
If this has been fixed let me know which struts 2 version is that.
I did try the following also with no luck
<s:property value="%{#application['studentId']}"/>
waiting for a quick reply
Thanks
--
Sent from the Struts - User mailing list archive at Nabble.com.

Attachment:
user_200969.ezm (zipped)Just downloaded the source.
but there are only *.jsp files there:
# pwd
/usr/struts-layout/struts-layout-1.3/doc/example
# cd example/
./ images/ logon3.html
registration3.html subscription2.html
../ logon.html registration.html
selectDependent.html subscription3.html
config/ logon2.html registration2.html
subscription.html
Where are the java class files?
I would expect to see how this struts-tag MVC is applied to this example.
Thanks
On Tue, Jul 21, 2009 at 10:44 PM, Dave Newton<newton.dave@(protected):
> Sam Wun wrote:
>>
>> Can anyone show me a link where I can download the example source
>> codes from the following link:
>>
>> http://struts.improve-technologies.com/faqs/lists.html
>
> http://struts.improve-technologies.com/download.html?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

Attachment:
user_200970.ezm (zipped)For example, where is the source code for collections.do?
Here is the link for the example demo, but there is no source code.
http://struts.improve-technologies.com/struts-layout/examples/collections.do?reqCode=view
Thanks
Sam
On Wed, Jul 22, 2009 at 12:18 PM, Sam Wun<swun2010@(protected):
> Just downloaded the source.
> but there are only *.jsp files there:
> # pwd
> /usr/struts-layout/struts-layout-1.3/doc/example
>
> # cd example/
> ./ images/ logon3.html
> registration3.html subscription2.html
> ../ logon.html registration.html
> selectDependent.html subscription3.html
> config/ logon2.html registration2.html
> subscription.html
>
> Where are the java class files?
> I would expect to see how this struts-tag MVC is applied to this example.
>
> Thanks
>
> On Tue, Jul 21, 2009 at 10:44 PM, Dave Newton<newton.dave@(protected):
>> Sam Wun wrote:
>>>
>>> Can anyone show me a link where I can download the example source
>>> codes from the following link:
>>>
>>> http://struts.improve-technologies.com/faqs/lists.html
>>
>> http://struts.improve-technologies.com/download.html?
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>> For additional commands, e-mail: user-help@(protected)
>>
>>
>

Attachment:
user_200972.ezm (zipped)Sam Wun wrote:
> For example, where is the source code for collections.do?
> Here is the link for the example demo, but there is no source code.
> http://struts.improve-technologies.com/struts-layout/examples/collections.do?reqCode=view
Have you tried contacting the project owner?
Dave

Attachment:
user_200973.ezm (zipped)I thought the "project owner" read this mailing list?
On Wed, Jul 22, 2009 at 1:20 PM, Dave Newton<newton.dave@(protected):
> Sam Wun wrote:
>>
>> For example, where is the source code for collections.do?
>> Here is the link for the example demo, but there is no source code.
>>
>> http://struts.improve-technologies.com/struts-layout/examples/collections.do?reqCode=view
>
> Have you tried contacting the project owner?
>
> Dave
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

Attachment:
user_200971.ezm (zipped)On Tuesday 21 July 2009 03:40:55 am taltun wrote:
> Hi,
>
> When uploading an image using file upload calling this code:
>
> InputStream stream = new BufferedInputStream(new FileInputStream(file));
>
> It seems like the webapplication try to access the filesystem temporary to
> create the file using FileInputStream.
>
> On Windows it works, but it seems like on Unix server it does not have
> permission to access the filesystem using FileInputStream, , am I right ?
>
> - What should I do ?
> - Is there other way to convert a file to inputStream without accessing the
> filesystem ?
>
> -taltun
It is possible that filesystem permissions are a problem. I think your best bet
is probably to give permissions to a directory where the upload components can
create a file. The existing components use a constant called
'struts.multipart.saveDir' to figure out where to put the temp files it creates
during the upload. Set it to a directory where the user running your app
server (tomcat) can write (/tmp).
-Wes
--
Wes Wannemacher
Author - Struts 2 In Practice
Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more
http://www.manning.com/wannemacher

Attachment:
user_200974.ezm (zipped)Hi,
I have an application in struts2.0 . I want a servlet in it to cater to a
specific HTTP request. How can I make sure that the request to servlet
does not go through struts.xml as it searches for the action class with
the same name.
thanks,
Kavita
*****************************************************DISCLAIMER*****************************************************
This message and/or attachment(s) contained here are confidential, proprietary to HUGHES SYSTIQUE and its customers.
Contents may be privileged or otherwise protected by law. The information is solely intended for the entity it is
addressed to. If you are not the intended recipient of this message, it is strictly prohibited to read, forward,
print, retain, copy or disseminate this message or any part of it. If you have received this e-mail in error,
please notify the sender immediately and delete the message.
********************************************************************************************************************

Attachment:
user_200975.ezm (zipped)