DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23104>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23104

ConditionalForwardAction

           Summary: ConditionalForwardAction
           Product: Struts
           Version: 1.1 Final
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Enhancement
          Priority: Other
         Component: Standard Actions
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


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

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to