Dakota Jack wrote the following on 1/7/2006 10:09 AM:
In my opinion, Eric, this is a bad solution.  There are lots of reasons this
is bad.  Rather than go through them, I would suggest you just add the logic
in /search.do?query=42 at the point you get the failure form
/retrieve.do?id=42.

I agree with Jack here. The code to get back your Collection of objects based on "id 42" should be about one line. Then maybe another to populate the request so you aren't really saving maybe lines of code forwarding to another action. So for example if whatever action is processing your /retrieve.do?id=42 simply do something like...

retrieveAction(..) -->

String forwardName = "success";
Item item = service.getItemFromDB( 42 );
if ( item == null ) {
    Collection items = service.performSearch( 42 );
    request.setAttribute("items", items );
    forwardName = "itemNotFound";
}else {
   //probably put item in scope
   request.setAttribute("item", item );
}
return (mapping.findForward(forwardName ));



--
Rick

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

Reply via email to