Dear Wiki user, You have subscribed to a wiki page or wiki category on "Struts Wiki" for change notification.
The following page has been changed by MichaelJouravlev: http://wiki.apache.org/struts/StrutsNavigationBasics ------------------------------------------------------------------------------ - == Navigation Between Pages == + == Web Resources And Navigation == A typical web application is a collection of web resources linked with each other. When using Struts, every web resource is represented with one or more action class/form bean pairs. When web resource is asked to render itself, a corresponding action class selects a view that reflects current state of the web resource, and sends it to the browser. + + Struts approach is different from page-oriented framewors like ASP.NET, where a user requests a page and web server displays it. In ASP.NET web resource is equal to web page, while in Struts one web resource can have several corresponding web pages. inline:basic_action_asp.gif - Struts approach is different from page-oriented framewors like ASP.NET, where a user requests a page and web server displays it. In ASP.NET web resource is equal to web page, while in Struts one web resource can have several corresponding web pages. + Struts allows to separate logical state of a web resource from its visual representation. Struts is agnostic to presentation technology, so a page can be generated using JSP file, Tile definition, Velocity template, XSLT stylesheet or other rendering techniques. + + ==== Example ==== + + Consider the Action that performs a search. The author of this code should not bother neither about how exactly the search criteria is obtained, nor about how the search results are presented. His only job is to say "what happened" after the search took place. + + There are three interesting outcomes: + * No results were found => outcome "none". + * Exactly one result was found => outcome "single". + * More than one result was found => outcome "multiple". + + The search Action should return these three results as three separate logical outcomes. It is up to the application architect to decide to send all three outcomes to the "here's the list of responses" table page. It's also up to the application architect (perhaps later, in response to user feedback) to say "let's do this instead": + + * If there's no results, go to a page that says "sorry, no results were found, please try your search again." + * If there's exactly one response, go to the details page to display the corresponding data. + * If there's more than one response, go to the list page (as per the previous behavior). + + Note that the code of the search action is not affected by this decision. == Round Trip And Postback ==