Results 1 to 3 of 3

Thread: Forwarding to a view based on a request parameter

Hybrid View

  1. #1
    Join Date
    Apr 2010
    Posts
    24

    Default Forwarding to a view based on a request parameter

    I have a need to render a different view based on the value of a request parameter. I am using the on-start tag to set up the objects and evaluating a service that populates the right model for the appropriate page, but then I want to go to the corresponding view from there. Do I use a transition within the on-start, or is there a better way? Each view defined after the on-start will have a different page associated with it.

  2. #2
    Join Date
    Nov 2008
    Posts
    742

    Default

    I wouldn't handle it in the on-start section. Rather, you can either use a decision-state (preferred) or an action-state to evaluate the request parameter and transition to the appropriate view-state.

  3. #3
    Join Date
    Apr 2010
    Posts
    24

    Default

    Here is a sample of what my flow configuration looks like. I want to be able to render a different jsp (JSF page) based on the sorId passed as a parameter. So far, this works to render the page, but it is only one view id. I need several others.

    Code:
    	<input name="loginCode" type="string" />
    	<input name="accountId" type="string" />
    	<input name="sorId" type="string" />
    	<input name="deptId" type="string" />
    
       	<on-start>
       	    <set name="requestParmBean.loginCode" value="loginCode" />
       	    <set name="requestParmBean.accountId" value="accountId" />
       	    <set name="requestParmBean.sorId" value="sorId" />
       	    <set name="requestParmBean.deptId" value="deptId" />
           	<evaluate expression="riskForceController.setMessageContext(messageContext)" />
           	<evaluate expression="riskForceController.init(requestParmBean)" />
       	</on-start>
    
    	<view-state id="displayRiskForce"
    	            view="externalRedirect:contextRelative:/faces/account/displayRiskForce.jsp">
    	</view-state>
    	
    	<bean-import resource="riskforce-beans.xml" />

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •