You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by PC Leung <pc...@gmail.com> on 2006/02/22 15:56:26 UTC

How to get the value of combo box of previous page?

<bean:write name="userForm" property="eng_name"/>

The above line returns blank. Where goes wrong?

In previous page as below, the combo box has values.

         <td>
            	<html:select name="userForm" property="eng_name">
                	<html:options collection="userList" property="eng_name"/>
            	</html:select>
         </td>

struts-config.xml is

		<action path="/setupSelectUser"
			input="user.selectUser"
			name="userForm"
			scope="session"
			validate="false"
			type="com.user.struts.action.SetupSelectUserAction">
			<forward name="success" path="user.selectUser" />		
		</action>

		<action path="/setupAssignUserSystem"
			input="user.assignUserSystem"
			name="userSystemForm"
			scope="session"
			validate="false"
			type="com.user.struts.action.SetupAssignUserSystemAction">
			<forward name="success" path="user.assignUserSystem" />		
		</action>


public final class SetupSelectUserAction extends Action {
	private Log log =
LogFactory.getFactory().getInstance(this.getClass().getName());
	public ActionForward execute (ActionMapping mapping,
			ActionForm form,
			HttpServletRequest request,
			HttpServletResponse response)
	throws Exception {					
		UserProfileService service = new UserProfileService();
        Collection userList = service.getUserProfileList(null);
        HttpSession session = request.getSession();
        session.setAttribute( "userList", userList );
		UserForm userForm = (UserForm)form;     		
		userForm.setMethod("create");
		log.info("SetupSelectUserAction:" + userForm.getMethod());
		return mapping.findForward("success");
	}

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


Re: How to get the value of combo box of previous page?

Posted by Michael Jouravlev <jm...@gmail.com>.
Try this first: http://wiki.apache.org/struts/StrutsWidgets

On 2/22/06, PC Leung <pc...@gmail.com> wrote:
> <bean:write name="userForm" property="eng_name"/>
>
> The above line returns blank. Where goes wrong?
>
> In previous page as below, the combo box has values.
>
>          <td>
>                 <html:select name="userForm" property="eng_name">
>                         <html:options collection="userList" property="eng_name"/>
>                 </html:select>
>          </td>
>
> struts-config.xml is
>
>                 <action path="/setupSelectUser"
>                         input="user.selectUser"
>                         name="userForm"
>                         scope="session"
>                         validate="false"
>                         type="com.user.struts.action.SetupSelectUserAction">
>                         <forward name="success" path="user.selectUser" />
>                 </action>
>
>                 <action path="/setupAssignUserSystem"
>                         input="user.assignUserSystem"
>                         name="userSystemForm"
>                         scope="session"
>                         validate="false"
>                         type="com.user.struts.action.SetupAssignUserSystemAction">
>                         <forward name="success" path="user.assignUserSystem" />
>                 </action>
>
>
> public final class SetupSelectUserAction extends Action {
>         private Log log =
> LogFactory.getFactory().getInstance(this.getClass().getName());
>         public ActionForward execute (ActionMapping mapping,
>                         ActionForm form,
>                         HttpServletRequest request,
>                         HttpServletResponse response)
>         throws Exception {
>                 UserProfileService service = new UserProfileService();
>         Collection userList = service.getUserProfileList(null);
>         HttpSession session = request.getSession();
>         session.setAttribute( "userList", userList );
>                 UserForm userForm = (UserForm)form;
>                 userForm.setMethod("create");
>                 log.info("SetupSelectUserAction:" + userForm.getMethod());
>                 return mapping.findForward("success");
>         }
>
> ---------------------------------------------------------------------
> 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


Re: How to get the value of combo box of previous page?

Posted by Laurie Harper <la...@holoweb.net>.
The first thing that jumps out is that you have the html:select and the 
html:options tags bound to the same form bean property (eng_name). 
That's almost certainly not what you want to do, although I don't think 
it explains the problem you're asking about.

What's the 'action' attribute set to for the form in the first page? Is 
it set up to submit to the /setupAssignUserSystem action? And what does 
the SetupAssignUserSystemAction class look like?

It would help if you posted all the relevant code and configuration so 
we can see all the pieces in context.

L.

PC Leung wrote:
> <bean:write name="userForm" property="eng_name"/>
> 
> The above line returns blank. Where goes wrong?
> 
> In previous page as below, the combo box has values.
> 
>          <td>
>             	<html:select name="userForm" property="eng_name">
>                 	<html:options collection="userList" property="eng_name"/>
>             	</html:select>
>          </td>
> 
> struts-config.xml is
> 
> 		<action path="/setupSelectUser"
> 			input="user.selectUser"
> 			name="userForm"
> 			scope="session"
> 			validate="false"
> 			type="com.user.struts.action.SetupSelectUserAction">
> 			<forward name="success" path="user.selectUser" />		
> 		</action>
> 
> 		<action path="/setupAssignUserSystem"
> 			input="user.assignUserSystem"
> 			name="userSystemForm"
> 			scope="session"
> 			validate="false"
> 			type="com.user.struts.action.SetupAssignUserSystemAction">
> 			<forward name="success" path="user.assignUserSystem" />		
> 		</action>
> 
> 
> public final class SetupSelectUserAction extends Action {
> 	private Log log =
> LogFactory.getFactory().getInstance(this.getClass().getName());
> 	public ActionForward execute (ActionMapping mapping,
> 			ActionForm form,
> 			HttpServletRequest request,
> 			HttpServletResponse response)
> 	throws Exception {					
> 		UserProfileService service = new UserProfileService();
>         Collection userList = service.getUserProfileList(null);
>         HttpSession session = request.getSession();
>         session.setAttribute( "userList", userList );
> 		UserForm userForm = (UserForm)form;     		
> 		userForm.setMethod("create");
> 		log.info("SetupSelectUserAction:" + userForm.getMethod());
> 		return mapping.findForward("success");
> 	}


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