You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Paul Benedict (JIRA)" <ji...@apache.org> on 2007/08/19 22:57:34 UTC
[jira] Closed: (STR-1741) ConditionalForwardAction
[ https://issues.apache.org/struts/browse/STR-1741?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Paul Benedict closed STR-1741.
------------------------------
Resolution: Won't Fix
Assignee: (was: Struts Developers)
Conditional logic should be encapsulated in the action, not the mapping. This solution will break apart as more complex cases are needed.
> ConditionalForwardAction
> ------------------------
>
> Key: STR-1741
> URL: https://issues.apache.org/struts/browse/STR-1741
> Project: Struts 1
> Issue Type: Improvement
> Components: Extras
> Affects Versions: 1.1.0
> Environment: Operating System: All
> Platform: All
> Reporter: James Farley
> Priority: Minor
> Attachments: ConditionalForwardAction.java, ConditionalForwardActionMapping.java, ConditionalForwardTest.java, ELConditionalForwardTest.java, ForwardAction.java
>
>
> I had an idea at my current workplace for a very convienent reusable forward-
> based action class that would support basic conditionals. The initial use
> case was something like "if the 'resultSet' attribute does not exist in
> session scope, redirect the user to the search page - otherwise, display the
> results page". The reason is that i have implemented a paged result set and
> the results are stored in session. If the user bookmarks and goes back, the
> whole thing dies. It seemed a good candidate for something like a conditional
> forward. The class I wrote up (*very* rough, but it got the job done) allowed
> me to do this:
> <!-- the action class is completely reusable -->
> <action path="/search/national/page"
> type="com.sa.go.web.struts.ForwardAction"
> parameter="el:${empty sessionScope.buyandsave_advancedSearchResults} =>
> search, paging"
> unknown="false">
> <forward name="search" path="/search" redirect="true" />
> <forward name="paging" path="stad.buyandsave.nationalSearchResults" />
> </action>
> The way I implemented it was to have the parameter be a list of conditionals
> in the form of {conditional type}:{conditional expr} => {forward if true}, ...
> and the first one it came across that resulted in "true" would be forwarded
> to. If no conditional was specified, it would automatically be chosen (giving
> an if () {} else if () {} else {} type structure). The initial implementation
> interfaces with the jakarta-taglibs JSTL/EL library. The prefix
> for "conditional type" is to support (perhaps) multiple different types; for
> now it's just "el:" for JSTL/EL statements.
> Not sure if this is the appropriate forum for submitting suggested features,
> but figured I'd send it out anyway in case the core team thought it (or
> something like it) might be a good idea.
> --James
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.