struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "K.C. Baltz" <>
Subject Help: Problem with DispatchAction and c:import
Date Tue, 15 Mar 2005 19:03:30 GMT
I've run into an interesting problem involving dispatch actions and 
<c:import> (or tiles:insert).  The problem is this.  I have a page that 
lists some files.  The user can upload another file from this page, but 
if the file is too large, Struts starts the error processing for the 
action.  Here are my two action mappings for referrence:

    <action path="/filestoreAdmin/uploadFile" parameter="dispatch" 
name="uploadFileForm" scope="request" validate="true" 
input="/filestoreAdmin/" >
        <forward name="success" path="/filestoreAdmin/" 
redirect="true" />
        <forward name="error" 
path="/filestoreAdmin/" redirect="false" />

    <action path="/filestoreAdmin/manageFiles" parameter="dispatch" 
name="manageFilesForm" scope="request" validate="true" 
input="/filestoreAdmin/files.jsp" >
        <forward name="listFiles" path="/filestoreAdmin/files.jsp" 
redirect="false" />
        <forward name="success" path="/filestoreAdmin/" 
redirect="true" />
        <forward name="error" path="/filestoreAdmin/files.jsp" 
redirect="false" />
        <forward name="fileListPager" 
path="/filestoreAdmin/fileIncList.jsp" redirect="false" />
        <forward name="viewFolderTree" 
path="/controls/treeControlInc.jsp" redirect="false" />

As you can see, the uploadFile action uses the manageFiles action with a 
dispatch=error for its "input" attribute.  So when the upload fails 
because it's too large, that's what gets invoked.   The error() method 
of ManageFilesAction does some processing and then forwards to a page 
that lists the files and displays the error message.  Here's where the 
problem occurs.  In files.jsp (the page that lists the files), I'm using 
a <c:import> to insert a javascript tree control to display a tree of 
folders.  The URL for that import points to the same manageFiles action, 
although I use a nested <c:param name="dispatch" value="getFolderTree" 
/> to invoke a different method.  However, because <c:import> uses an 
"include" to do this, the original dispatch value of "error" is still in 
the request and gets used first, causing and infinite loop of importing 
the file list, which imports the file list, which ....

Is there a way around this besides setting up a different Action with a 
different dispatch parameter name to fetch the tree?  Is there a way to 
"clear" the request before I call <c:import>   ?

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message