...
@see META-INF/webworl.tld
Examples
// TODO: tmjee It's in the migration to snippets process. Added in snippets, when submited patches, the tables, code snapshot etc will be removed as it will be pulled from the source.
If, ElseIf, Else Tag
Wiki Markup |
---|
{snippet:id=description|javadoc=true|url=com.opensymphony.webwork.views.jsp.IfTag} |
Wiki Markup |
---|
{snippet:id=example|lang=xml|javadoc=true|url=com.opensymphony.webwork.views.jsp.IfTag} |
Wiki Markup |
---|
{snippet:id=exampleDescription|javadoc=true|url=com.opensymphony.webwork.views.jsp.IfTag} |
//
//
Preform basic condition flow. 'If' tag could be used by itself or with 'Else If' Tag and/or single/multiple 'Else' Tag.
...
// TODO: this tag will be implemented soon
Wiki Markup |
---|
{snippet:id=description|javadoc=true|url=com.opensymphony.webwork.views.jsp.AppendIteratorTag} |
Wiki Markup |
---|
{snippet:id=example|lang=xml|javadoc=true|url=com.opensymphony.webwork.views.jsp.AppendIteratorTag} |
Wiki Markup |
---|
{snippet:id=exampleDescription|javadoc=true|url=com.opensymphony.webwork.views.jsp.AppendIteratorTag} |
//
//
Generator Tag
// TODO: this tag will be implemented soon
Wiki Markup |
---|
{snippet:id=description|javadoc=true|url=com.opensymphony.webwork.views.jsp.IteratorGeneratorTag} |
Wiki Markup |
---|
{snippet:id=example|lang=xml|javadoc=true|url=com.opensymphony.webwork.views.jsp.IteratorGeneratorTag} |
Wiki Markup |
---|
{snippet:id=exampleDescription|javadoc=true|url=com.opensymphony.webwork.views.jsp.IteratorGeneratorTag} |
//
//
Generate an iterator based on the val attribute supplied.
Attribute | Required | Description |
---|---|---|
val | YES | the source (String) to be parsed into the generated iterator |
count | NO | the max number (Integer, Float, Double, Long, String) entries to be in the generated iterator |
separator | NO | the separator (String) to be used in separating the 'val' attribute into entries of the generator iterator |
id | NO | the id (String) to store the resultant iterator into page context, if such id is supplied |
converter | NO | the converter (must extends off IteratorGeneratorTag.Converter interface) to convert the String entry parsed from 'val'attribute into an object. |
NOTE: The generated iterator will ALWAYS be pushed into the top of the stack, and poped at the end of the tag.
Example One:
Code Block |
---|
<!-- Generate a simple iterator -->
<ww:generator val="%{'aaa,bbb,ccc,ddd,eee'}">
<ww:iterator>
<ww:property /><br/>
</ww:iterator>
</ww:generator>
|
This generates an iterator and print it out using the iterator tag.
Example Two:
Code Block |
---|
<!-- Generate an iterator with count attribute -->
<ww:generator val="%{'aaa,bbb,ccc,ddd,eee'}" count="3">
<ww:iterator>
<ww:property /><br/>
</ww:iterator>
</ww:generator>
|
This generates an iterator, but only 3 entries will be available in the iterator
generated, namely aaa, bbb and ccc respectively because count attribute is set to 3
Example Three
Code Block |
---|
<!-- Generate an iterator with id attribute -->
<ww:generator val="%{'aaa,bbb,ccc,ddd,eee'}" count="4" separator="," id="myAtt" />
<%
Iterator i = (Iterator) pageContext.getAttribute("myAtt");
while(i.hasNext()) {
String s = (String) i.next(); %>
<%=s%> <br/>
<% }
%>
|
This generates an iterator and put it in the PageContext under the key as specified
by the id attribute.
Example Four:
Code Block |
---|
<!-- Generate an iterator with comparator attribute -->
<ww:generator val="%{'aaa,bbb,ccc,ddd,eee'}" converter="%{myConverter}">
<ww:iterator>
<ww:property /><br/>
</ww:iterator>
</ww:generator>
public class GeneratorTagAction extends ActionSupport {
....
public Converter getMyConverter() {
return new Converter() {
public Object convert(String value) throws Exception {
return "converter-"+value;
}
};
}
...
}
|
This will generate an iterator with each entries decided by the converter supplied. With
this converter, it simply add "converter-" to each entries.
Merge Tag
// TODO: this tag will be implemented soon
Wiki Markup |
---|
{snippet:id=description|javadoc=true|url=com.opensymphony.webwork.views.jsp.MergeIteratorTag} |
Wiki Markup |
---|
{snippet:id=example|lang=xml|javadoc=true|url=com.opensymphony.webwork.views.jsp.MergeIteratorTag} |
Wiki Markup |
---|
{snippet:id=exampleDescription|javadoc=true|url=com.opensymphony.webwork.views.jsp.MergeIteratorTag} |
//
//
Sort Tag
Wiki Markup |
---|
{snippet:id=description|javadoc=true|url=com.opensymphony.webwork.views.jsp.SortIteratorTag} |
Wiki Markup |
---|
{snippet:id=example|lang=xml|javadoc=true|url=com.opensymphony.webwork.views.jsp.SortItearatorTag} |
Wiki Markup |
---|
{snippet:id=exampleDescription|javadoc=true|url=com.opensymphony.webwork.views.jsp.SortIteratorTag} |
//
//
//
Sort a List according to the comparator supplied.
...
The above makes uses of sort tag to sort a List defined in SortAction.java. METHOD A makes use of the sorted list that is pushed into the stack and uses the nested Iterator Tag to iterate over the sorted list and print its elements. In METHOD B the supplied id attribute allows the Sort Tag to store the sorted list into the page context and then retrieve the sorted list and display its content using scriptlet.
Subset Tag
// TODO: will be implemented soon
Wiki Markup |
---|
{snippet:id=description|javadoc=true|url=com.opensymphony.webwork.views.jsp.SubsetIteratorTag} |
Wiki Markup |
---|
{snippet:id=example|lang=xml|javadoc=true|url=com.opensymphony.webwork.views.jsp.SubsetIteratorTag} |
Wiki Markup |
---|
{snippet:id=exampleDescription|javadoc=true|url=com.opensymphony.webwork.views.jsp.SubsetIteratorTag} |
//
//
Iterator Tag
Wiki Markup |
---|
{snippet:id=description|javadoc=true|url=com.opensymphony.webwork.views.jsp.IteratorTag} |
Wiki Markup |
---|
{snippet:id=example|lang=xml|javadoc=true|url=com.opensymphony.webwork.views.jsp.IteratorTag} |
Wiki Markup |
---|
{snippet:id=exampleDescription|javadoc=true|url=com.opensymphony.webwork.views.jsp.IteratorTag} |
//
//
Iterator will iterate over a value. An iterable value can be either of: java.util.Collection, java.util.Iterator, java.util.Enumeration, java.util.Map, array.
...