April 20, 2014
Hot Topics:
RSS RSS feed Download our iPhone app

Introducing Java Page Flow Architecture, Page 2

  • August 31, 2005
  • By Kunal Mittal & Srinivas Kanchanavally
  • Send Email »
  • More Articles »

Action and Forward Classes

Integral parts of using a Page Flow controller are the action classes and the forward classes. Let's quickly take a look at what they offer.

Action

The following are the annotations that are available for an action class:

  • Jpf.Catch []: The different exceptions caught by this action.
  • Jpf.Forward []: The different forwards defined by this action.
  • boolean loginRequired: Does this action require that the user be logged in?
  • boolean readOnly: A guarantee that this action does not change any Page Flow variables.
  • String [] rolesAllowed: The roles that can access this action.
  • String useFormBean: The form bean that this action class uses.
  • Jpf.ValidatableProperty [] validatableProperties: The properties of the form bean that need to be validated.
  • Jpf.Forward validationErrorForward: The forward to use when there is any validation error.
Forward

The following are the annotations offered by the forward classes:

  • Jpf.ActionOutput [] actionOutputs: List of action outputs.
  • boolean externalRedirect: Redirect to some external action
  • Jpf.NavigateTo navigateTo: The page or action to navigate to
  • String outputFormBean: Output form bean
  • Class outputFormBeanType: Output form bean type
  • String path: The path to forward too, usually a JSP
  • boolean redirect: Redirect or not
  • boolean restoreQueryString: Whether the original query string will be restored on a rerun of a previous action
  • String returnAction: The action to be executed on the original Page Flow
Tip: We recommend you look at the different methods on the Forward object. They will prove to be useful as you start building complex Page Flow applications.

NetUI Components

NetUI is a set of tag libraries that you will use as part of your JSPs. These tag libraries are JSP 2.0 complaint. Three tag libraries make up NetUI:

  • NetUI
  • NetUI-data
  • NetUI-template
Caution: The NetUI-data and NetUI-template tag libraries depend on the NetUI tag libraries. All the base classes for the three tag libraries are provided as part of the NetUI (HTML) tag library.

The basic functionality in these tag libraries is to simplify JSP development and provide automatic data binding between the view and controller layers. These tags come with JavaScript support, so you can work with them like you would the standard HTML tags (input, select, and so on).

NetUI

The NetUI name is a little misleading. Think of this tag library as NetUI-html. That makes it clearer, doesn't it? This tag library contains the tags similar to the struts-html tag library. Table 1, which comes straight from the Javadocs, shows the tags in this library. As you'll see, this library contains the standard tags that you might use with vanilla HTML development.

Note: The reason I've simply cut and paste the information from the Javadocs is because, at the time of writing this material, Apache Beehive is still in the beta stage. Therefore, some of these methods might change. Visit the Beehive documentation page for the latest Javadocs at http://incubator.apache.org/beehive/reference/taglib/index.html.

Table 1. NetUI Tag Library

Tag Description
<netui:anchor> Generates an anchor that can link to another document or invoke an action method in the controller file
<netui:attribute> Adds an attribute to the parent tag rendered in the browser
<netui:base> Provides the base for every URL on the page
<netui:bindingUpdateErrors> Renders the set of error messages found during the process of resolving data binding expressions ({pageFlow.firstname}, {request.firstname}, and so on)
<netui:body> Renders an HTML <body> tag with the attributes specified
<netui:button> Renders an HTML button with the specified attributes
<netui:checkBox> Generates a single HTML checkbox
<netui:checkBoxGroup> Handles data binding for a collection of checkboxes
<netui:checkBoxOption> Renders a single HTML checkbox within a group of checkboxes
<netui:content> Displays text or the result of an expression
<netui:error> Renders an error message with a given error key value if that key can be found in the ActionErrors registered in the PageContext at org.apache.struts.action.Action.ERROR_KEY
<netui:errors> Renders the set of error messages found in the ActionErrors registered in the PageContext at org.apache.struts.action.Action.ERROR_KEY
<netui:exceptions> Renders exception messages and stack traces inline on the JSP
<netui:fileUpload> Renders an HTML input tag with which users can browse, select, and upload files from their local machines
<netui:form> Renders an HTML form that can be submitted to a Java method in the controller file for processing
<netui:formatDate> Renders a formatter used to format dates
<netui:formatNumber> Renders a formatter used to format numbers
<netui:formatString> Renders a formatter used to format strings
<netui:hidden> Generates an HTML hidden tag with a given value
<netui:html> Renders an <html> tag
<netui:image> Renders an HTML <image> tag with the specified attributes
<netui:imageAnchor> Generates a hyperlink with a clickable image
<netui:imageButton> Renders an <input type="image"> tag with the specified attributes
<netui:label> Associates text with an input element in a form
<netui:parameter> Writes a name-value pair to the URL or the parent tag
<netui:parameterMap> Writes a group of name-value pairs to the URL or the parent tag
<netui:radioButtonGroup> Renders a collection of radio button options and handles the data binding of their values
<netui:radioButtonOption> Generates a single radio button option in a group of options
<netui:rewriteName> Allows a name, typically either an id or name attribute, to participate in URL rewriting
<netui:rewriteURL> Allows a tag name, typically either an id or name attribute, to participate in URL rewriting
<netui:scriptContainer> Acts as a container that will bundle JavaScript created by other <netui...> tags and outputs it within a single <script> tag
<netui:scriptHeader> Writes the <script> that JavaScript will include in the HTML <head> tag
<netui:select> Renders an HTML <select> tag containing a set of selectable options
<netui:selectOption> Renders a single <option>tag
<netui:span> Generates styled text based on a String literal or data binding expression
<netui:textArea> Renders an HTML <input> tag of type "text"
<netui:textBox> Renders an HTML <input type="text"> tag
<netui:tree>
<netui:treeContent>
<netui:treeHtmlAttribute>
<netui:treeItem>
<netui:treeLabel>
<netui:treePropertyOverride>
Renders a navigable tree of TreeElement tags




Page 2 of 3



Comment and Contribute

 


(Maximum characters: 1200). You have characters left.

 

 


Sitemap | Contact Us

Rocket Fuel