Results 1 to 2 of 2

Thread: Redirect

  1. #1
    Join Date
    Sep 2008
    Posts
    7

    Question Redirect

    Hi,
    I am trying to create a file and then download it to the users browser.
    When the user clicks on a filename in a jsp-page a getFile method in my
    MultiAction subclass is called. This metod creates the file and then it
    redirects to an URL that can display the file. The redirect looks like this:

    Code:
    String url = "download.do?type=file&period=" +
        info.getTabellInfo().getPeriod() + "&filename=" + fileName;
    ((ServletExternalContext)context.getExternalContext()).getResponse().sendRedirect(url);
    My flow xml file looks like this:

    HTML Code:
    view-state id="bekrafta" view="flows/bekrafta">
    	<render-actions>
    		<action bean="formAction" method="setupForm"/>
    	</render-actions>
    	<transition on="previous" to="preGor" />
    	<transition on="next" to="postBekrafta">
            <action bean="formAction" method="bindAndValidate">
    			<attribute name="validatorMethod" value="validateGor"/>
    		</action>
          </transition>
    	<transition on="getFile" to="getFile"/>
    </view-state>
    
    <action-state id="getFile">
    	<action bean="gorAction"/>
    	<transition on="success" to="preBekrafta"/>
    </action-state>
    The file gets displayed in the browser, but the problem is that there is an
    exception on the server: java.lang.IllegalStateException "Request processing
    failed". Is it because you canīt do both a redirect and have a transition in
    the getFile action??? Or.....???

    I use Spring web Flow 1.0.2.

    Thanks! :-)

  2. #2
    Join Date
    Sep 2008
    Posts
    7

    Default Redirect

    Hi,
    If someone else has the same problem here is how I
    solved it:

    HTML Code:
    <view-state id="bekraftaLon" view="smb/flows/bekraftaLon">
    	<render-actions>
    		<action bean="formAction" method="setupForm"/>
    	</render-actions>
    	<transition on="previous" to="preGorLon" />
    	<transition on="next" to="postBekraftaLon">
            <action bean="formAction" method="bindAndValidate">
    			<attribute name="validatorMethod" value="validateGorLon"/>
    		</action>
          </transition>
    	<transition on="getFile" to="getFile"/>
    </view-state>
    
    <view-state id="getFile">
    	<render-actions>
    		<action bean="gorLonAction" method="getFile"/>
    	</render-actions>
    	<transition on="success" to="bekraftaLon"/>
    </view-state>
    I changed <action-state id="getFile"> to <view-state id="getFile">.

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
  •