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/StrutsManualActionWebComponent ------------------------------------------------------------------------------ '''Attention: this page describes functionality that is not yet available! Work in progress!''' - Struts 1.4 allows building portlet-like web components. A web component is an independent server-side object that is able to accept user input and to render itself. ''Struts web component'' uses Action class to process incoming events, and employs JSP technology to render a view. + Struts 1.4 allows building portlet-like web components. A web component is an independent server-side object that is able to accept user input and to render itself. - A Struts Web Component is a combination of: + A ''Struts Web Component'' is a combination of: * one Action class that handles input events and updates component state; - * one or more JSP files that represent one or more subviews; + * one or more JSP files that represent one or more component subviews; * an optional form bean that holds input/output data. - == Use Case: Home Page With Login Component == + Struts web component uses Action class to process incoming events, and employs JSP technology to render a view. - Consider a website with a login form that authorizes access to member-only area of the website. A non-logged-in user must be presented with login form, a logged-in user should be able to log out. The screenshot from www.java.net website illustrates this use case. + == Use Case: Login Component == + + Consider a website's ''composite page'' that contains a login component. The login component authorizes access to member-only area of the website. A non-logged-in user must be presented with login form, a logged-in user should be able to log out. The screenshot from http://www.java.net website illustrates this use case. A casual visitor sees a login form: inline:javanet_notloggedin.gif - After a visitor logs in, he is presented with exactly the same page. The only difference is that login form is replaced with logout form: + After a visitor logs in, he is presented with exactly the same page, the only difference is the login form replaced with logout form: inline:javanet_loggedin.gif - In a regular web application it is responsibility of login/logout module to navigate to a proper location after processing user input. In the above case a user must be transferred to the same location that he was browsing before logging in. Therefore login/logout module should be tightly integrated with its parent page. Another solution is that a parent page itself must process login/logout events. + In a regular web application the login/logout module would be responsible to navigate to a proper location after processing user input. In the example above a user must be transferred to the same location that he was browsing before logging in. Therefore login/logout module should be tightly integrated with its parent page, or the parent page must process login/logout events itself. == Struts Web Components Are Independent == - With Struts you can build web component that bears no knowledge about page it is included into. Furthermore, a composite page itself does not need to know what components does it contain. A web component must handle its own input and render its own markup. Struts takes care about everything else. This boring tasks include: + With Struts you can build truly independent web components that bear no knowledge about a page they are included into. Furthermore, a composite page does not need to know about components contained in it. A web component should mean its own business, that is handle its input and render its markup. Struts takes care about the rest. These boring tasks include: - * Calculating the location of a composite page, used to reload a composite page. + * Calculating the location of a composite page (used to automatically reload a composite page). - * Calculating the location of a component, can be used as submit target. + * Calculating the location of a component (can be used as submission target). * Save page/component locations between requests. * Checking whether a browser supports Javascript and if it does, using Ajax to replace component markup in place instead of reloading a whole composite page. - - When you develop a Struts Web Component you have to deal only with component's input and component's output. You do not need to care how exactly the composite page will be updated. == Building Struts Web Components ==