Author Login
Post Reply
user Digest 25 Dec 2009 19:45:41 -0000 Issue 8968
Topics (messages 204393 through 204406):
Re: Struts 1.2.x and File I/O
204393 by: vineith kaul
Re: best practices in struts 2.1 - Tiles and Convention - clean URLs with minimum number of actions
204394 by: Pawe³ Wielgus
204397 by: Wes Wannemacher
Dispatch does not work ( Struts2 + tile)
204395 by: Emi Lu
204396 by: Wes Wannemacher
Forwarding to a Java Application
204398 by: Rafael Muneton
204399 by: Wes Wannemacher
204400 by: Vitor E. Silva Souza
204401 by: Rafael Muneton
204402 by: Rafael Muneton
204403 by: Wes Wannemacher
204404 by: Rafael Muneton
how to access struts2 propery from jsp or vice versa
204405 by: Parm Lehal
204406 by: Wes Wannemacher
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_204393.ezm (zipped)Related to this file upload thing , I am using the struts2 file upload.I
know struts2 file-upload deletes the uploaded temp file.From a security
stand point, do we still need to validate the input file (for bad input) or
the fact that it got deleted should take of everything?
Thanks!
Kaul
On Wed, Dec 23, 2009 at 11:09 AM, Dan Vargas <davargas123@(protected):
> Ok, that's what I had figured, thanks.
>
> 2009/12/23 Paweł Wielgus <poulwiel@(protected)>
>
> > Hi Dan,
> > struts see only files on server,
> > so if You want to do something with a local file You have to upload it
> > to the server.
> > Also it's not struts related, all HTTP based solutions behave that way.
> >
> > Best greetings,
> > Pawel Wielgus
> >
> > 2009/12/23, davargas123 <davargas123@(protected)>:
> > >
> > > Is it necessary to upload a file to the server to process it in Struts,
> > or
> > > does it have access to the local file system? I was getting errors in
> my
> > > code when it was attempting to use the file from my local machine, but
> if
> > I
> > > upload it to the server first and use the file from the server, it
> works
> > > okay. That led me to wonder if it was just me messing up the code, or
> > Struts
> > > only seeing the directories on the server on which it is installed, and
> > > that's what I want to know.
> > >
> > > Thanks,
> > > Dan
> > > --
> > > View this message in context:
> > >
> http://old.nabble.com/Struts-1.2.x-and-File-I-O-tp26903855p26903855.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)
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@(protected)
> > For additional commands, e-mail: user-help@(protected)
> >
> >
>

Attachment:
user_204394.ezm (zipped)Hi Chuck,
i'm also addicted to convention and i do it like that:
/register!input
(i don't remember well if it is ! or some other character but that is
possible for sure)
If one call such an address his browser will land on input result with
no validation being fired.
Also if You want to depent on request method chech the REST plugin,
maybe it will suits your needs best.
Best greetings,
Pawel Wielgus.
2009/12/22, Charles Parker <chuck.t.parker@(protected)>:
> I'm using struts 2.1.8.1 here and have a question about best practices
> in the following situation:
>
> I have a form page, 'register'. It takes several fields, username,
> password, etc.
>
> I want the initial form page to be rendered via GET:
>
> http://my.server.net/register
>
> This shows the blank form (the tile definition below), without
> attempting to validate the fields.
>
> <definition name="registrationPage" extends="defaultLayout">
> <put-attribute name="content"
> value="/WEB-INF/pages/registration.jsp"/>
> </definition>
>
> On POST to the same URL 'http://my.server.net/register', I want to
> perform validation on the form, (via register-validation.xml or
> Annotation). If the form validates then perform the action that triggers
> the underlying business logic. Otherwise re-display the form with
> validation errors (again, same URL, 'http://my.server.net/register').
>
> I am using the Convention plugin and the Tiles plugin. The combination
> of these two seems to throw a wrench in the works.
> It seems that with the Convention plugin, I can only depend on execute()
> being called, or I need to define multiple actions.
>
> The approach I'm using now works reasonably well but there must be a
> cleaner way:
>
> @ParentPackage("testing")
> public class Register extends ActionSupport
> {
> @Action(value="register",results={@(protected)",
> type="tiles", location="registrationPage")})
> @SkipValidation
> public String execute() throws Exception
> {
> return this.isBlank() ? INPUT : "submit";
> }
>
> @Action
> (
> value="register-submit",
> results=
> {
> @Result(name="input", type="tiles",
> location="registrationPage"),
> @Result(name="error", type="tiles",
> location="registrationPage"),
> @Result(name="success", type="tiles",
> location="registrationSuccessfulPage")
> }
> )
> public String executeValidate() throws Exception
> {
> // perform business logic
> return SUCCESS;
> }
>
> private boolean isBlank()
> {
> return StringUtils.isBlank(this.username) &&
> StringUtils.isBlank(this.password)
> }
> }
>
> Someone can still link in to /register-submit, which isn't awful, since
> validation is performed. But I'd like to minimize the number of
> actionable URLs on my site and avoid writing an isBlank() method for
> each form.
>
> It would seem more straightforward if I could depend on an INPUT result
> on the first load of the page (with @SkipValidation), and then execute()
> thereafter, with only a single action defined at the class level instead
> of multiple actions at the method level.
>
>
> Is this possible, and if so, what is the most appropriate way to do this
> via struts 2.1?
>
> I am addicted to the Convention plugin annotation, and I cannot do
> without Tiles.
>
> For reference, I'm using the following in struts.xml:
>
> <constant name="struts.convention.action.alwaysMapExecute" value="false"/>
>
> <package name="testing" extends="struts-default">
> <!-- Set the tiles result type as the default for this package. -->
> <result-types>
> <result-type name="tiles"
> class="
org.apache.struts2.views.tiles.TilesResult" default="true"/>
> </result-types>
> </package>
>
> Many thanks for any alternatives or refinements of this approach.
>
> / chuck
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

Attachment:
user_204397.ezm (zipped)Charles,
I haven't really found any way to get around the setup you are talking
about... If you want validation, you pretty much have to map to
different actionable URLs. From the framework's perspective, it really
can't know that you want validation or not without different request
URLs. The alternative is to try to code around it, but then your UI
logic becomes entangled into your application code.
-Wes
On Tue, Dec 22, 2009 at 11:05 AM, Charles Parker
<chuck.t.parker@(protected):
> I'm using struts 2.1.8.1 here and have a question about best practices in
> the following situation:
>
> I have a form page, 'register'. It takes several fields, username, password,
> etc.
>
> I want the initial form page to be rendered via GET:
>
> http://my.server.net/register
>
> This shows the blank form (the tile definition below), without attempting to
> validate the fields.
>
> <definition name="registrationPage" extends="defaultLayout">
> <put-attribute name="content" value="/WEB-INF/pages/registration.jsp"/>
> </definition>
>
> On POST to the same URL 'http://my.server.net/register', I want to perform
> validation on the form, (via register-validation.xml or Annotation). If the
> form validates then perform the action that triggers the underlying business
> logic. Otherwise re-display the form with validation errors (again, same
> URL, 'http://my.server.net/register').
>
> I am using the Convention plugin and the Tiles plugin. The combination of
> these two seems to throw a wrench in the works.
> It seems that with the Convention plugin, I can only depend on execute()
> being called, or I need to define multiple actions.
>
> The approach I'm using now works reasonably well but there must be a cleaner
> way:
>
> @ParentPackage("testing")
> public class Register extends ActionSupport
> {
> @Action(value="register",results={@(protected)",
> location="registrationPage")})
> @(protected)
> public String execute() throws Exception
> {
> return this.isBlank() ? INPUT : "submit";
> }
>
> @(protected)
> (
> value="register-submit",
> results=
> {
> @(protected)"),
> @(protected)"),
> @(protected)",
> location="registrationSuccessfulPage")
> }
> )
> public String executeValidate() throws Exception
> {
> // perform business logic
> return SUCCESS;
> }
>
> private boolean isBlank()
> {
> return StringUtils.isBlank(this.username) &&
> StringUtils.isBlank(this.password)
> }
> }
>
> Someone can still link in to /register-submit, which isn't awful, since
> validation is performed. But I'd like to minimize the number of actionable
> URLs on my site and avoid writing an isBlank() method for each form.
>
> It would seem more straightforward if I could depend on an INPUT result on
> the first load of the page (with @SkipValidation), and then execute()
> thereafter, with only a single action defined at the class level instead of
> multiple actions at the method level.
>
>
> Is this possible, and if so, what is the most appropriate way to do this via
> struts 2.1?
>
> I am addicted to the Convention plugin annotation, and I cannot do without
> Tiles.
>
> For reference, I'm using the following in struts.xml:
>
> <constant name="struts.convention.action.alwaysMapExecute" value="false"/>
>
> <package name="testing" extends="struts-default">
> <!-- Set the tiles result type as the default for this package. -->
> <result-types>
> <result-type name="tiles"
> class="
org.apache.struts2.views.tiles.TilesResult" default="true"/>
> </result-types>
> </package>
>
> Many thanks for any alternatives or refinements of this approach.
>
> / chuck
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
--
Wes Wannemacher
Head Engineer, WanTii, Inc.
Need Training? Struts, Spring, Maven, Tomcat...
Ask me for a quote!

Attachment:
user_204395.ezm (zipped)Hello all,
I am using struts2.1.8.1 & tiles2.0.7.
The following doc says that dispatch will work, but when I setup:
http://www.vaannila.com/struts-2/struts-2-example/dispatchAction-in-struts-2-example-1.html
My page goes to the correct URL, but the action class "ProcessTest" is
not called at all; only after refresh the page, the "edit" function is
called. Someone knows why and how?
My configurations are:
===========================
(1) jsp
<s:form namespace="/Edit" action="ProcessTest">
... ...
<s:submit value="Edit" theme="simple" action="edit">
</s:form>
(2) struts.xml
<package name="Edit" namespace="/Edit" extends="struts-default">
<result-types>
<result-type name="tiles"
class="
org.apache.struts2.views.tiles.TilesResult"/>
</result-types>
<action name="editProcessTest" class="ProcessTest" method="edit">
<result name="input" type="tiles">edit_it </result>
<result name="error" type="tiles">browse_it </result>
</action>
(3) In Tiles
<definition name= "edit_degname"
template="/WEB-INF/layouts/mainLayout-page.jsp">
<put-attribute name="title" value="Edit" />
<put-attribute name="body" value="/WEB-INF/p1.jsp" />
</definition>
After clicking (1)."Edit", browser goes to /Edit/ProcessTest, but the
method "edit" in ProcessTest.java class never being called?
Thank you for your help!
--
Lu Ying

Attachment:
user_204396.ezm (zipped)On Wed, Dec 23, 2009 at 12:27 PM, Emi Lu <emilu@(protected):
> (1) jsp
> <s:form namespace="/Edit" action="ProcessTest">
[snip]
> <action name="editProcessTest" class="ProcessTest" method="edit">
That form doesn't look like it is calling the action... Your action is
named 'editProcessTest', but the form points to 'ProcessTest'. Are
there more pieces (spring configuration, etc.) that we need to see?
-Wes
--
Wes Wannemacher
Head Engineer, WanTii, Inc.
Need Training? Struts, Spring, Maven, Tomcat...
Ask me for a quote!

Attachment:
user_204398.ezm (zipped)
In a Web Application I need to redirect the flow of the information to a Java class nor to a Servlet or a JSP.
However in the web i have found a lot of material but none mentions what i am looking for.
How is this achieved?
Any idea is welcome.
Rafael
_________________________________________________________________
Keep your friends updated—even when you’re not signed in.
http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_5:092010

Attachment:
user_204399.ezm (zipped)Will the Java App(let) be up and running, or will you need to launch
it with the information passed to it?
-Wes
On Thu, Dec 24, 2009 at 10:52 AM, Rafael Muneton
<rafael_muneton@(protected):
>
> In a Web Application I need to redirect the flow of the information to a Java class nor to a Servlet or a JSP.
>
> However in the web i have found a lot of material but none mentions what i am looking for.
>
> How is this achieved?
>
>
>
> Any idea is welcome.
>
>
>
> Rafael
>
> _________________________________________________________________
> Keep your friends updated—even when you’re not signed in.
> http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_5:092010
--
Wes Wannemacher
Head Engineer, WanTii, Inc.
Need Training? Struts, Spring, Maven, Tomcat...
Ask me for a quote!

Attachment:
user_204400.ezm (zipped)On Thursday 24 December 2009 16:52:35 Rafael Muneton wrote:
> In a Web Application I need to redirect the flow of the information to a
> Java class nor to a Servlet or a JSP.
>
> However in the web i have found a lot of material but none mentions what i
> am looking for.
>
> How is this achieved?
When information are sent to the web server, they are always directed towards
a Servlet, but it can be intercepted by a Filter or Listener. Even with JSP,
we're talking about a Servlet that was created automatically by the container
from the JSP page. AFAIK, these are the only classes that can interact
*directly* with the web application.
Then come the frameworks, which deliver a set of classes (again, Servlets,
Filters, Listeners...) that abstract all the complexity for us and we can
develop simpler classes that interact with the WebApp. But in reality, they
are interacting with the classes the framework provides.
With Struts2, you can create Actions, register them with the framework and
they can receive the data directly from the web pages. Struts2 will
automatically convert and inject them in the action's properties, given the
rules have been followed correctly.
I don't know if I understood your question right, so I don't know if I
answered it well.
Ciao,
Vítor Souza

Attachment:
user_204401.ezm (zipped)
Hi Wes:
Well, this web application is the entry to a whole application, it is the MainMenu screen where I have several menu options the user can choose from.And depending on the User , I allow some options or allow all the options.
Rafael
> Date: Thu, 24 Dec 2009 11:37:42 -0500
> Subject: Re: Forwarding to a Java Application
> From: wesw@(protected)
> To: user@(protected)
>
> Will the Java App(let) be up and running, or will you need to launch
> it with the information passed to it?
>
> -Wes
>
> On Thu, Dec 24, 2009 at 10:52 AM, Rafael Muneton
> <rafael_muneton@(protected):
> >
> > In a Web Application I need to redirect the flow of the information to a Java class nor to a Servlet or a JSP.
> >
> > However in the web i have found a lot of material but none mentions what i am looking for.
> >
> > How is this achieved?
> >
> >
> >
> > Any idea is welcome.
> >
> >
> >
> > Rafael
> >
> > _________________________________________________________________
> > Keep your friends updated—even when you’re not signed in.
> > http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_5:092010
>
>
>
> --
> Wes Wannemacher
>
> Head Engineer, WanTii, Inc.
> Need Training? Struts, Spring, Maven, Tomcat...
> Ask me for a quote!
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
_________________________________________________________________
Windows Live: Keep your friends up to date with what you do online.
http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_1:092010

Attachment:
user_204402.ezm (zipped)
Hi Vitor:
What I am trying to achieve is that , after a user can log in to the Web Application, this user receives the MainMenu screen of the Application, where there are several options, that he/she can choose from.This MainMenu is a Java application not a Servlet.
And after reading your answer, I think that maybe I need to upgrade to Struts 2.
I am using Struts 1.1
Thanks.
Rafael
> From: vitorsouza@(protected)
> To: user@(protected)
> Subject: Re: Forwarding to a Java Application
> Date: Thu, 24 Dec 2009 18:38:33 +0100
>
> On Thursday 24 December 2009 16:52:35 Rafael Muneton wrote:
> > In a Web Application I need to redirect the flow of the information to a
> > Java class nor to a Servlet or a JSP.
> >
> > However in the web i have found a lot of material but none mentions what i
> > am looking for.
> >
> > How is this achieved?
>
> When information are sent to the web server, they are always directed towards
> a Servlet, but it can be intercepted by a Filter or Listener. Even with JSP,
> we're talking about a Servlet that was created automatically by the container
> from the JSP page. AFAIK, these are the only classes that can interact
> *directly* with the web application.
>
> Then come the frameworks, which deliver a set of classes (again, Servlets,
> Filters, Listeners...) that abstract all the complexity for us and we can
> develop simpler classes that interact with the WebApp. But in reality, they
> are interacting with the classes the framework provides.
>
> With Struts2, you can create Actions, register them with the framework and
> they can receive the data directly from the web pages. Struts2 will
> automatically convert and inject them in the action's properties, given the
> rules have been followed correctly.
>
> I don't know if I understood your question right, so I don't know if I
> answered it well.
>
> Ciao,
>
> Vítor Souza
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
_________________________________________________________________
Windows Live: Make it easier for your friends to see what you’re up to on Facebook.
http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_2:092009

Attachment:
user_204403.ezm (zipped)On Thu, Dec 24, 2009 at 12:52 PM, Rafael Muneton
<rafael_muneton@(protected):
>
> Hi Vitor:
>
> What I am trying to achieve is that , after a user can log in to the Web Application, this user receives the MainMenu screen of the Application, where there are several options, that he/she can choose from.This MainMenu is a Java application not a Servlet.
>
> And after reading your answer, I think that maybe I need to upgrade to Struts 2.
>
> I am using Struts 1.1
>
I don't think an upgrade is necessary. I think you just need to
understand a little better how things work in a JSP/Servlet
environment... The page that launches the MainMenu application is
bound to have either an <applet... or <object... tag. It has been a
while for me, I can't remember which. But, if there is information
that needs passed to the MainMenu, then you need to make that
information into params. Then, when the page that launches the
MainMenu is rendered, pass the information to the MainMenu by
rendering the appropriate <param... tags.
-Wes
--
Wes Wannemacher
Head Engineer, WanTii, Inc.
Need Training? Struts, Spring, Maven, Tomcat...
Ask me for a quote!

Attachment:
user_204404.ezm (zipped)
OK Wes:
I am trying to understand you.
I will test my Appl and will keep you posted.
Thanks a lot.
Rafael
> Date: Thu, 24 Dec 2009 13:48:49 -0500
> Subject: Re: Forwarding to a Java Application
> From: wesw@(protected)
> To: user@(protected)
>
> On Thu, Dec 24, 2009 at 12:52 PM, Rafael Muneton
> <rafael_muneton@(protected):
> >
> > Hi Vitor:
> >
> > What I am trying to achieve is that , after a user can log in to the Web Application, this user receives the MainMenu screen of the Application, where there are several options, that he/she can choose from.This MainMenu is a Java application not a Servlet.
> >
> > And after reading your answer, I think that maybe I need to upgrade to Struts 2.
> >
> > I am using Struts 1.1
> >
>
> I don't think an upgrade is necessary. I think you just need to
> understand a little better how things work in a JSP/Servlet
> environment... The page that launches the MainMenu application is
> bound to have either an <applet... or <object... tag. It has been a
> while for me, I can't remember which. But, if there is information
> that needs passed to the MainMenu, then you need to make that
> information into params. Then, when the page that launches the
> MainMenu is rendered, pass the information to the MainMenu by
> rendering the appropriate <param... tags.
>
> -Wes
>
>
>
> --
> Wes Wannemacher
>
> Head Engineer, WanTii, Inc.
> Need Training? Struts, Spring, Maven, Tomcat...
> Ask me for a quote!
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
_________________________________________________________________
Windows Live: Friends get your Flickr, Yelp, and Digg updates when they e-mail you.
http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_3:092010

Attachment:
user_204405.ezm (zipped)Hello,
I am stuck in trying to access some variables from value stack in jsp
page. Is there anyway to do it easily?
Is there anyway to communicate with a bean defined in jsp with
<jsp:useBean tag from struts2? I can access values in struts but not
from jsp side. ..Basically I am trying to do something similar to
<%
response.sendRedirect(..........url based on....<s:property
value="%{GRTGRTGT}"/> .....);
Please, tell me if and how can I accomplish something like this.
Regards,
Parminder Lehal
________________________________________________________________________
-----Original Message-----
From: Wes Wannemacher <wesw@(protected)>
Reply-to: "Struts Users Mailing List" <user@(protected)>
To: Struts Users Mailing List <user@(protected)>
Subject: Re: if tag with #parameters
Date: Wed, 23 Dec 2009 09:35:59 -0500
I have used a similar construct quite a bit, but normally, I refer to
parameters like this -
<s:if test="%{#parameters['view'] != null}">
view
</s:if>
<s:else>
not view
</s:else>
In cases like this, I just want to affect the way a view is rendered.
So, leaving the getter/setter off of the action is the way to go.
-Wes
On Tue, Dec 22, 2009 at 6:05 AM, foo bar <linutrix@(protected):
> Hi,
>
> I would prefer not to use getter/setter.
> What I really want to know is, why is this not working as expected ?
>
> Anyway, I solved it
>
> <s:if test="#parameters.messageKey[0] == 'yes'">
>
> #parameters.messageKey is of type String[], which make sense now
>
>
> On Tue, Dec 22, 2009 at 9:46 PM, Saeed Iqbal <saeedcs@(protected):
>> If it is a request parameter, then make a setter for it to get set and
>> getter to retrieve it and use % instead of #
>>
>> If you want to have the parameter in the page context use the s:set with id
>>
>>
>>
>> On Tue, Dec 22, 2009 at 3:36 PM, foo bar <linutrix@(protected):
>>
>>> Hi all,
>>>
>>> I'm testing for the existence of a request parameter in a jsp page in
>>> Struts 2
>>>
>>> <%@(protected)"%>
>>> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
>>> "http://www.w3.org/TR/html4/strict.dtd">
>>> <s:property value="#parameters.messageKey"/><br/>
>>> <s:if test="%{#parameters.messageKey == 'yes'}">
>>> yes
>>> </s:if>
>>> <s:else>
>>> no
>>> </s:else>
>>>
>>> But, whatever I do, result is always "no"
>>>
>>> Tested with these cases:
>>>
>>> test.jsp
>>> test.jsp?messageKey=
>>> test.jsp?messageKey=yes
>>> test.jsp?messageKey=no
>>>
>>> Changed it to <s:if test="#parameters.messageKey == 'yes'">, same results
>>> Changed it to <s:if test="{#parameters.messageKey == 'yes'}">, results
>>> are negated as above, ie you got "no" when previously you got "yes"
>>>
>>> What's the solution here ?
>>>
>>> Cheers
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>>> For additional commands, e-mail: user-help@(protected)
>>>
>>>
>>
>>
>> --
>> Saeed Iqbal
>> Independant Consultant
>> J2EE - Application Architect / Developer
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

Attachment:
user_204406.ezm (zipped)There is an http header result type and two redirect result types that
are much better suited for this. You can use properties in the
struts.xml file as params for the result. I am on my phone, but
perhaps someone else can post an example.
-W
On 12/24/09, Parm Lehal <plehal@(protected):
> Hello,
>
> I am stuck in trying to access some variables from value stack in jsp
> page. Is there anyway to do it easily?
> Is there anyway to communicate with a bean defined in jsp with
> <jsp:useBean tag from struts2? I can access values in struts but not
> from jsp side. ..Basically I am trying to do something similar to
>
> <%
>
> response.sendRedirect(..........url based on....<s:property
> value="%{GRTGRTGT}"/> .....);
>
>
> Please, tell me if and how can I accomplish something like this.
>
>
>
> Regards,
>
> Parminder Lehal
>
>
>
> ________________________________________________________________________
>
>
> -----Original Message-----
> From: Wes Wannemacher <wesw@(protected)>
> Reply-to: "Struts Users Mailing List" <user@(protected)>
> To: Struts Users Mailing List <user@(protected)>
> Subject: Re: if tag with #parameters
> Date: Wed, 23 Dec 2009 09:35:59 -0500
>
>
> I have used a similar construct quite a bit, but normally, I refer to
> parameters like this -
>
> <s:if test="%{#parameters['view'] != null}">
> view
> </s:if>
> <s:else>
> not view
> </s:else>
>
> In cases like this, I just want to affect the way a view is rendered.
> So, leaving the getter/setter off of the action is the way to go.
>
> -Wes
>
> On Tue, Dec 22, 2009 at 6:05 AM, foo bar <linutrix@(protected):
>> Hi,
>>
>> I would prefer not to use getter/setter.
>> What I really want to know is, why is this not working as expected ?
>>
>> Anyway, I solved it
>>
>> <s:if test="#parameters.messageKey[0] == 'yes'">
>>
>> #parameters.messageKey is of type String[], which make sense now
>>
>>
>> On Tue, Dec 22, 2009 at 9:46 PM, Saeed Iqbal <saeedcs@(protected):
>>> If it is a request parameter, then make a setter for it to get set and
>>> getter to retrieve it and use % instead of #
>>>
>>> If you want to have the parameter in the page context use the s:set with
>>> id
>>>
>>>
>>>
>>> On Tue, Dec 22, 2009 at 3:36 PM, foo bar <linutrix@(protected):
>>>
>>>> Hi all,
>>>>
>>>> I'm testing for the existence of a request parameter in a jsp page in
>>>> Struts 2
>>>>
>>>> <%@(protected)"%>
>>>> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
>>>> "http://www.w3.org/TR/html4/strict.dtd">
>>>> <s:property value="#parameters.messageKey"/><br/>
>>>> <s:if test="%{#parameters.messageKey == 'yes'}">
>>>> yes
>>>> </s:if>
>>>> <s:else>
>>>> no
>>>> </s:else>
>>>>
>>>> But, whatever I do, result is always "no"
>>>>
>>>> Tested with these cases:
>>>>
>>>> test.jsp
>>>> test.jsp?messageKey=
>>>> test.jsp?messageKey=yes
>>>> test.jsp?messageKey=no
>>>>
>>>> Changed it to <s:if test="#parameters.messageKey == 'yes'">, same
>>>> results
>>>> Changed it to <s:if test="{#parameters.messageKey == 'yes'}">, results
>>>> are negated as above, ie you got "no" when previously you got "yes"
>>>>
>>>> What's the solution here ?
>>>>
>>>> Cheers
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>>>> For additional commands, e-mail: user-help@(protected)
>>>>
>>>>
>>>
>>>
>>> --
>>> Saeed Iqbal
>>> Independant Consultant
>>> J2EE - Application Architect / Developer
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>> For additional commands, e-mail: user-help@(protected)
>>
>>
>
>
>
>
--
Wes Wannemacher
Head Engineer, WanTii, Inc.
Need Training? Struts, Spring, Maven, Tomcat...
Ask me for a quote!