Hi Tuomo, I've had a quick look - seems good. I only do struts part time so I can't really keep up with you, which is a shame. I'll try to use your code - if you'd like to post it here or mail latest version(s).
Someone is working on a workflow component for struts, which I think is the same job as this. See http://jakarta.apache.org/struts/proposal-workflow.html I guess this project won't be finished for ages - so is no use to us! I prefer just 1 returnStamp at a time - lighter load on server & simpler to program - anything that sets up a return stamp deletes whatever is already there. Maybe you would need multiple returnStamps for when the user opens a second browser & runs the same app. keep up the good work! Keith. --- Tuomo Syv�nper� <[EMAIL PROTECTED]> wrote: > Sorry.. I forgot one method from the ActionBase - > class.. > Attached is the new version. > > /tuomo > > Page A: > - has the following <app:returnStamp> tag > <app:returnStamp to="pageA.do" from="pageB.do" /> > > - if there is access to page B from some other page > C we should also add the > tag to page C otherwise there is the possibility > that we would return > to page A accidentally > <app:returnStamp to="pageC.do" from="pageB.do" /> > > // > ---------------------------------------------------------------------------- > > // > // ActionBase class. Handles all redirects required > by ReturnStamp > // > class ActionBase extends Action { > // > // ... > // > public final ActionForward perform( ActionMapping > mapping, ActionForm form, > HttpServletRequest request, > HttpServletResponse response ) > throws IOException, ServletException { > > // NOTE: we first have to call the doPerform - > method so that after > // we get the stamp from the session and > store it in the request, > // it doesn't mess up this actions request > processing > ActionForward forward = doPerform( mapping, > form, request, response ); > > // Check for possible return stamps > HttpSession session = request.getSession(); > ReturnStamps stamps = > (ReturnStamps)session.getAttribute( > Constants.RETURN_STAMPS_KEY ); > ActionForward stampForward = null; > > if( stamps != null ) { > ReturnStamp stamp = stamps.findStamp( > request.getServletPath()); > if( stamp != null ) { > stampForward = new ActionForward( > stamp.getTo()); > > // Remove this stamp from the session and > store it in the request > stamps.removeStamp( stamp ); > session.setAttribute( > Constants.RETURN_STAMPS_KEY, stamps ); > request.setAttribute( > Constants.RETURN_STAMP_KEY, stamp ); > } > } > if( stampForward != null ) return stampForward; > > return forward; > } > > // All implementing classes should call this > method to retrieve > // parameters or attributes from the request > public Object getParabute( String parabuteName, > HttpServletRequest request ) { > Object obj = null; > > ReturnStamp stamp = > (ReturnStamp)request.getAttribute( > Constants.RETURN_STAMP_KEY ); > > if( stamp != null ) { > if( (obj = stamp.getAttribute( parabuteName )) > != null ) { > stdOutLog( "getParabute() called. ", 2 ); > stdOutLog( " parabute fround in return > stamp.", 2, false ); > return obj; > } > } > > if( (obj = request.getAttribute( parabuteName )) > == null ) { > obj = request.getParameter( parabuteName ); > stdOutLog( "getParabute() called. ", 2 ); > stdOutLog( " parabute fround in request > parameters.", 2, false ); > } else { > stdOutLog( "getParabute() called. ", 2 ); > stdOutLog( " parabute fround in request > attributes.", 2, false ); > } > > return obj; > } > } > > // > ---------------------------------------------------------------------------- > > // > // ReturnStampTag implementation > // > import java.util.Enumeration; > > import javax.servlet.ServletRequest; > import javax.servlet.http.HttpSession; > import javax.servlet.jsp.JspException; > import javax.servlet.jsp.tagext.TagSupport; > > import common.Constants; > import common.ReturnStamp; > import common.ReturnStamps; > > public final class ReturnStampTag extends TagSupport > { > protected String to = null; > protected String from = null; > > public String getTo() { > return to; > } > > public void setTo( String to ) { > this.to = to; > } > > public String getFrom() { > return from; > } > > public void setFrom( String from ) { > this.from = from; > } > > public int doStartTag() throws JspException { > return SKIP_BODY; > } > > public int doEndTag() throws JspException { > HttpSession session = pageContext.getSession(); > > if( session == null ) { > return EVAL_PAGE; > } > > ServletRequest request = > pageContext.getRequest(); > > ReturnStamps stamps = > (ReturnStamps)session.getAttribute( > Constants.RETURN_STAMPS_KEY ); > > if( stamps == null ) { > stamps = new ReturnStamps(); > } > > ReturnStamp stamp = new ReturnStamp( getTo(), > getFrom()); > > for( Enumeration e = > request.getParameterNames(); e.hasMoreElements(); ) > { > String name = (String)e.nextElement(); > if( name != null ) { > stamp.addAttribute( name, > request.getParameter( name )); > } > } > > for( Enumeration e = > request.getAttributeNames(); e.hasMoreElements(); ) > { > String name = (String)e.nextElement(); > if( name != null ) { > stamp.addAttribute( name, > request.getAttribute( name )); > } > } > > stamps.removeStamp( stamp ); > stamps.addStamp( stamp ); > > session.setAttribute( > Constants.RETURN_STAMPS_KEY, stamps ); > > return EVAL_PAGE; > } > } > > // > ---------------------------------------------------------------------------- > > // > // ReturnStamps implementation > // > === message truncated ===> -- > To unsubscribe, e-mail: > <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> __________________________________________________ Do You Yahoo!? Check out Yahoo! Shopping and Yahoo! Auctions for all of your unique holiday gifts! Buy at http://shopping.yahoo.com or bid at http://auctions.yahoo.com -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

