Home Struts Struts2 Struts2controltags Struts 2 Tags Examples

Related Tutorials


 
 

Share on Google+Share on Google+

Struts 2 Tags Examples

Advertisement
In this section we are going to discuss the various control tags ( The Control Tags are used for flow control, such if, else and iterate.).

Struts 2 Tags Examples

     

In this section we are discussing the Struts 2 tags with examples. Struts 2 tags provides easy to use custom tags to help the developers to make GUI for their struts 2 based applications.

In Struts 2 there are many easy to use tags and the learning process for these tags are also easy. 

There are two types of tags in Struts 2, Control Tags and Data Tags.

We will show you all the tags with good working examples. Please browse the following links to learn Struts 2 tags in detail.

 

Struts 2 Tags:

  1. Control Tags
    1. Control Tags-If / Else If / Else
      In this section we are going to discuss the various control tags ( The Control Tags are used for flow control, such if, else and iterate.).
       
    2. Append Tag (Control Tags) Example
      In this section, we are going to describe the append tag . The append tag is a generic tag that is used to merge multiple iterators into one iterator.
       
    3. Generator Tag (Control Tags) Example
      In this section, we are going to describe the generator tag . The generator tag is a generic tag that is used to generate iterators based on different
      attributes passed .
       
    4. Generator Tag (Control Tags) Using Count Attributes
      In this section, we are going to describe the generator tag using the
      count attributes.
        
    5. Generator Tag (Control Tags) Using an Iterator with Id Attributes
      In this section, we are going to describe the generator tag using the id attributes.
        
    6. Iterator Tag (Control Tags) Example
      In this section, we are going to describe the Iterator tag. Iterator tag is used to iterate over a value. An iterable value can be either of: java.util.Collection, java.util.Iterator.
        
    7. Merge Tag (Control Tags) Example
      In this section, we are going to describe the merge tag . The merge tag is a generic tag that is used to  merge iterators. The successive call to the merged iterator causes each merge iterator to have a chance to expose its element, subsequently next call allows the next iterator to expose its element.
        
    8. Subset Tag (Control Tags) Example
      In this section, we are going to describe the subset tag . The subset tag is a generic tag that  takes an iterator and outputs a subset of it. It delegates to org.apache.struts2.util.SubsetIteratorFilter internally to perform the subset functionality.
       
    9. Subset Tag (Control Tags) Example Using Count
      In this section, we are going to describe the subset tag using the count  parameter. The count parameter indicate the number of entries to be set in the resulting subset iterator.
       
    10. Subset Tag (Control Tags) Example Using Start
      In this section, we are going to describe the subset tag using the start parameter. The start parameter is of integer type. It indicates the starting index (eg. first entry is 0) of entries in the source (needed to make available as the first entry in the resulting subset iterator).
        
  2. Data Tags

    1. Action Tag (Data Tag) Example
      In this section, we are going to describe the action tag . The action tag is a generic tag that is used to
      call actions directly from a JSP page by specifying the action name and an optional namespace.
       
    2. Bean Tag (Data Tag) Example
      In this section, we are going to describe the Bean Tag . The Bean tag is a generic tag that is used to instantiates a class that conforms to the JavaBeans specification.
       
    3. Date Tag (Data Tag) Example
      In this section, we are going to describe the Date tag .The date tag allows to format a Date in a quick and easy way. User can specify a custom format (eg. "dd/MM/yyyy hh:mm"), can generate easy readable notations (like "in 2 hours, 14 minutes"), or can just fall back on a predefined format with key 'struts.date.format' in the properties file.
       
    4. Include Tag (Data Tag) Example
      In this section, we are going to describe the include tag . The include tag is a generic tag that is used to include a servlet's output (result of servlet or a JSP page) to the current page.
        
    5. Param Tag (Data Tag) Example
      In this section, we are going to describe the param tag. The param tag is a generic tag that is used to parameterize other tags. For example the include tag and bean tag. The parameters can be added with or without a name as a key.
        
    6. Set Tag (Data Tag) Example
      In this section, we are going to describe the Set tag . The set tag is a generic tag that is used to assign a value to a variable in a specified scope.
       
    7. Text Tag (Data Tag) Example
      In this section, we are going to describe the text tag. The text tag is a generic tag that is used to render a I18n text message.
        
    8. Property Tag (Data Tag) Example
      In this section, we are going to describe the property tag . The property tag is a generic tag that is used to get the property of a value, which will default to the top of the stack if none is specified.

     

Advertisement

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: March 18, 2008

Related Tutorials

Discuss: Struts 2 Tags Examples   View All Comments

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:0
DMCA.com