This application demonstrates AWTaglib basic features.
To build a grid, the following guidelines are recommended:
- Have a separate jsp to paint the grid (you can have the grid in the same jsp as the rest of your information, altough it is not recommended because you can have layout problems).
- Prepare your data in a Struts Action and put it in the request (So you have MVC practice :) )
Usage (Grid JSP):
- gridLibrary tag
- action = Set the action to be used to load the resources
- gridIterator tag
- action = The name of the action to be invoked to generate reports
- dynamic = If true, it renders some icons to add or remove rows in the grid
- headerString = Set the identifier that will be used to identify the special header field.
- id = The name of the scripting variable that will be generated during the iteration
- multipleSelection = If true, the grid will allow multiple selection
- name = The name of the collection containing the values of the grid
- offset = Declare the offset
- report = If true, it renders three icons so you can export the grid to HTML, XLS and PDF
- property = Set the name of the property containing the collection.
- scope = The scope within which to search for the bean specified by the name attribute. If not specified, all scopes are searched.
- stateString = Set the identifier that will be used to identify the special dataStatus field.
- type = Sets the class type of each exposed element
- styleClass = The CSS class that the grid will use
- gridElement tag
- bundle = The servlet context attributes key for the MessageResources instance to use. If not specified, defaults to the application resources configured for our action servlet.
- locale = The session attribute key for the Locale used to select internationalized messages. If not specified, defaults to the Struts standard value.
- name = The name of the scripting variable containing the bean with the data
- property = The property of the bean to be rendered
- title = The resource bundle key to be rendered as the column header
- type = The type of editor it is going to use (readonly, editable or date)
- comboGridElement tag
- options = The name of the collection containing the values that will be rendered in the combobox
- labelProperty = The name of the property of the bean in the options collection that will be rendered as the label of the combobox
- labelValue = The name of the property of the bean in the options collection that will be rendered as the value of the combobox
- hiddenValues = If true, it will hide the true value of the field (just showing the label) until submit time
- listGridElement tag
- Collection = The collection containing the data for the subgrid
- valuecolumn = The column whose value will be picked
- CheckBoxGridElement tag
- trueValue = The value to be rendered when true
- falseValue = The value to be rendered when false
Usage (Master JSP):
- gridFrame tag
- action = Logical name of a Action that contains the actual content-relative URI of the destination of this transfer.
- forward = Logical name of a global ActionForward that contains the actual content-relative URI of the destination of this transfer.
- href = The URL to which this hyperlink will transfer control if activated.
- name = The name and id for the IFrame tag
- page = The module-relative path (beginning with a "/" character) to which this hyperlink will transfer control if activated.
- paramId = The name of the request parameter that will be dynamically added to the generated hyperlink.
- paramMap = The name of a JSP bean that contains a Map representing the query parameters
- paramMapProperty = The name of a property of the bean specified by the name attribute, whose return value must be a java.util.Map containing the query parameters to be added to the hyperlink.
- paramName = The name of a JSP bean that is a String containing the value for the request parameter named by paramId (if paramProperty is not specified), or a JSP bean whose property getter is called to return a String
- paramProperty = The name of a property of the bean specified by the paramName attribute, whose return value must be a String containing the value of the request parameter
- styleClass = The CSS class for the IFrame tag
To generate the grid used in this page we use the following tag:
- getFields = Get all data contained in the grid as <input> elements
- getArray = Get all data contained in the grid as an array
In the jsp containing the grid we use the following tags:
Don't forget to add the taglib directive at the top of your grid's jsp!
<%@taglib uri="http://awtaglib.sourceforge.net/tag" prefix="awtaglib"%>
Also remember to add the library tag at the header of your grid's jsp!
< awtaglib:gridLibrary />