struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nils-Helge Garli Hegvik <nil...@gmail.com>
Subject Re: How to pass HTTPRequest between two JSP ?
Date Mon, 01 Mar 2010 09:50:15 GMT
Either:

- Don't do a redirect, but a regular dispatch [1]
- Store it in the session

Regards,

Nils-Helge Garli Hegvik

[1] - http://struts.apache.org/2.1.8.1/docs/dispatcher-result.html


On Mon, Mar 1, 2010 at 10:40 AM, Frederik Minatchy <frederik78@yahoo.fr> wrote:
>
>
> --- En date de : Lun 1.3.10, Alex Rodriguez Lopez <alopez@flordeutopia.pt> a écrit :
>
>> De: Alex Rodriguez Lopez <alopez@flordeutopia.pt>
>> Objet: Re: How to pass HTTPRequest between two JSP ?
>> À: "Struts Users Mailing List" <user@struts.apache.org>
>> Date: Lundi 1 mars 2010, 9h21
>> Em 28-02-2010 23:26, Frederik
>> Minatchy escreveu:
>> > Hello...
>> >
>> > Since a few days I am working with Struts 2. (2.1.6)
>> > I am facing a big problem with HttpRequest and JSPs.
>> >
>> > Well... I have to forward a HTTPRequest from page1.jsp
>> to page2.jsp
>> >
>> > So... How can I pass HTTPRequest attribute betwen 2
>> pages?
>> >
>> > Here is a part my web.xml file :
>> >
>> > ...
>> > <filter>
>> >
>> <filter-name>struts2</filter-name>
>> >
>> <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
>> >      </filter>
>> >     <filter-mapping>
>> >
>> <filter-name>struts2</filter-name>
>> >
>> <url-pattern>/*</url-pattern>
>> >     </filter-mapping>
>> > ...
>> >
>> >
>> > the struts.xml file :
>> >
>> > ...
>> >
>> > <action name="bnf-detail"
>> class="fr.bnf.platon.bnf.actions.ConsultationBnfDetailAction">
>> >
>> <result
>> name="success">/pages/bnf/administration/detailBnf.jsp</result>
>> >         </action>
>> >
>> >
>> >
>> >         <action
>> name="bnf-detail_modification"
>> class="fr.bnf.platon.bnf.actions.ConsultationBnfDetailAction"
>> method="modificationSubmit">
>> >
>> <result
>> name="success">/pages/bnf/administration/detailBnf.jsp</result>
>> >         </action>
>> > ...
>> >
>> > and a part of the action java file (which
>> implementents RequestAware):
>> >
>> >    public String execute() throws Exception
>> >     {
>> >        request.put("test", 58);
>> >        return SUCCESS;
>> >      }
>> >
>> >     public String
>> modificationSubmit() throws TechniqueException,
>> FonctionnelleException
>> >     {
>> >        request.get("test"); // is
>> null
>> >        editMode = true;
>> >        return SUCCESS;
>> >     }
>> >
>> >
>> >
>> > So... How can I pass the request attribute from on
>> page to an other?
>> >
>> >
>> >
>> >
>> >
>> >
>> ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> > For additional commands, e-mail: user-help@struts.apache.org
>> >
>> I think you should be able to redirect with something like
>> this:
>> http://struts.apache.org/2.0.14/docs/redirect-action-result.html
>>
>> use return type redirect-action, work at request level
>> redirecting
>> requests, no jsps. I think request params are retained this
>> way.
>>
>>
>> Regards.
>> Alex Lopez
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>
>
>
> Thank you for your answer...
>
> But as I have to manage passwords I cannot pass values by using Request parameters (as
they will appear in the url). I am forced to use Request Attributes. For the moment I am using
SessionAware but it is not a good solution. Using Request attributes to store values seem
to be a better way. (I remember that it was possible in strut 1.x wasn't it?)
>
>
> I have read that with Dispatch result HTTPRequest was "kept" on the server and was not
lost... I am trying to implement things as it is written in documentation but it fails...
>
> I appreciate your help...
>
> Fred
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

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


Mime
View raw message