struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Hill" <andrew.david.h...@gridnode.com>
Subject RE: Passing a request parameter within Struts framework
Date Mon, 07 Oct 2002 12:06:39 GMT
In your action you can create a new forward object and return that.
ie: get the forward for target, extract its url and append required
parameter(s) and create a new forward using that and the redirect value from
the one you looked up, and return the new one.

>  -----Original Message-----
> From: 	Tuan H. Le [mailto:tuan.le@phsadc.com]
> Sent:	Monday, October 07, 2002 20:01
> To:	Struts Users Mailing List (E-mail)
> Subject:	Passing a request parameter within Struts framework
>
> Hi,
>
> How do I pass a request attribute to another form? In my case, after a
successful login, it would forward the user to
> the main form (MainMeu.jsp which has a frameset). In the main form, it has
several tabs. By default, it displays the
> first tab.
>
> Currently, in the perform() method of LoginAction class, I have the
following code
>
> //...
> request.setAttribute( "selTopNav", "1" );
> return( mapping.findForward( target ) );
>
>
> Here's the code for the MainMenu.jsp
>
>
> <%@ page language="java" %>
> <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
> <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
>
> <!-- frame -->
> <HTML>
> <HEAD>
> <TITLE><bean:message key="app.label.title" /></TITLE>
> </HEAD>
> <frameset rows="159,*,125" frameborder="0" noresize framespacing="0">
>     <frame src="Top.jsp" name="top" id="top" frameborder="0"
scrolling="no" noresize marginwidth="0" marginheight="0" framespacing="0">
>     <frameset  cols="95%,*" framespacing="0">
>         <frame src="Mid.jsp" name="mid" marginwidth="0" marginheight="0"
scrolling="yes" frameborder="0" noresize framespacing="0">
>         <frame src="RightSide.jsp" name="rightSide" marginwidth="10"
marginheight="10" scrolling="no" frameborder="0" noresize framespacing="0">
>     </frameset>
>     <frame src="Bottom.jsp" name="btm" id="btm" frameborder="0"
scrolling="no" marginwidth="0" marginheight="0" noresize framespacing="0">
> </frameset>
> <noframes>
> <bean:message key="app.msg.noframe" />
> </noframes>
> </html>
>
>
> And, in the Top.jsp, I have a test code to get a value of the request
attribute, but it always returns a null value
>
> Top Nav: <%= request.getParameter( "selTopNav" ) %>
>
> Here's a partial of my struts-config.xml file
>
>   <form-beans>
>     <form-bean name="loginForm"
type="com.phs.ezhr.presentation.form.LoginForm" />
>     <form-bean name="mainMenuForm"
type="com.phs.ezhr.presentation.form.MainMenuForm" />
>   </form-beans>
>
>   <global-forwards>
>     <forward name="login" path="/Login.jsp"/>
>   </global-forwards>
>
>   <!-- Action Mapping Definitions -->
>   <action-mappings>
>     <!-- Process a user login -->
>     <action path="/login"
>             type="com.phs.ezhr.presentation.action.LoginAction"
>             validate="true"
>             input="/Login.jsp"
>             name="loginForm"
>             scope="session" >
>             <forward name="success"
>                      path="/MainMenu.jsp" />
>             <forward name="failure"
>                      path="/Login.jsp" />
>     </action>
>     <!-- Process a user logoff -->
>     <action path="/logoff"
>             type="com.phs.ezhr.presentation.action.LogoffAction">
>             <forward name="success" path="/login.jsp" />
>     </action>
>     <action path="/top"
>             type="com.phs.ezhr.presentation.action.MainMenuAction"
>             validate="false"
>             input="/Top.jsp"
>             name="mainMenuForm"
>             scope="request" >
>     </action>
>   </action-mappings>
>
>
> Do you know what I'm missing?
>
> Thanks,
> Tuan
>
>  << File: ATT00078.txt >>


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


Mime
View raw message