Andreas, If I understand correctly, you have a LoginAction and a NewUserAction. If the user identifies himself as a new user, you want LoginAction to forward to a page where the user name is populated and the processing is handled by NewUserAction.
One approach would be to place the user name as a request parameter (not attribute) in the query string and forward to the new user page. The form on the new user page will render the form with the new user name populated in the appropriate field. In this fashion you let Struts do most of the work for you. In order for this to work the user name field name must be identical in the login form and the new user form. You must also bind the new user form to the NewUserAction by assigning its name to the input attribute of the form element in the struts-config file. For example you should have something like the following in your struts config file: <form-beans> <form-bean name="loginForm" type="com.mycompany.BaseForm"> <form-bean name="newUserForm" type="com.mycompany.BaseForm"> </form-beans> <action-mappings> <action path="/do/login" parameter="" validate="true" scope="request" name="loginForm" type="com.mycompany.BaseAction" input="/login.jsp"> <forward name="success" path="/account/index.jsp"/> <forward name="newuser" path="/createAccount.jsp"/> </action> <action path="/do/createAccount" parameter="" validate="true" scope="request" name="newUserForm" type="com.mycompany.BaseAction" input="/createAccount.jsp"> <forward name="success" path="/account/index.jsp"/> </action> The createAccount.jsp should have a form element which "points" to the createAccount action. <html:form action="createAccount" ..../> The LoginAction code would look something like this: MyForm form = (MyForm)form; String userName = form.getUserName(); if (isNewUser(userName)) { // determine if the user is a new user forward = mapping.findForward("newuser"); /* * NOTE: * There are cleaner ways to attach a parameter * to the path. Search for * ParameterActionForward in the mailing list archives. */ String path = forward.getPath() + "?userName=" + userName; forward = new ActionForward(path); } else { // do something else } return forward; One last thing. The reason your data is getting "lost" is because you are redirecting instead of forwarding. When you redirect, a new request is created thereby loosing all of your existing data. A quick solution would be to set the redirect flag in the forward to false or just omit it since forwarding is the default behavior for an ActionForward. HTH, robert > -----Original Message----- > From: Andreas Winkler [mailto:[EMAIL PROTECTED]] > Sent: Monday, January 20, 2003 4:45 AM > To: Struts Users Mailing List > Subject: Forwarding parameters > > > I'm a newbie and I've already been looking around for the answer > but I didn't find it, so here it goes: > > We are writing for an web application a login where the user > enters his name. > He selects wether he is a new user or an existing and in the next > line he can input his password. > He presses then a button which activates an action. > > My Problem is I want to forward the username to the next form > when the user selected "new user", where I have a form and an action. > Here is what I tried till now: > > form = new AccountRegisterForm(); > request.setAttribute( mapping.getAttribute(), form ); > AccountRegisterForm accReg = ( AccountRegisterForm )form; > accReg.setUsername( username ); > //saveToken(request); -> I found in an example this command but > I am not sure what it is doing > return mapping.findForward( "newAccount" ); > > I also set the flag redirect for the action but nothing happens. > What did I do wrong? > > Thanks in advance > Andreas Winkler -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>