Frameworks| Hibernate| Struts| JSF| JavaFX| Ajax| Spring| DOJO| JDO| iBatis| Questions?
  JDO Tutorials
  EAI Articles
  Struts Tutorials
  Java Tutorials
  Java Certification
  Java Applet
Questions
Comments

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.

                         

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 

Current Comments

3 comments so far (
post your own) View All Comments Latest 10 Comments:

This is really excellent for novice programmer like me..

Posted by Senthil on Wednesday, 01.16.08 @ 03:32am | #45305

very good

Posted by pullarao on Friday, 12.7.07 @ 02:46am | #41481

Your notes are very eraborate, thanks

Posted by Aselmo Mathebula on Saturday, 08.25.07 @ 20:04pm | #24118

Join and Excel yourself with our Online instructor led training sessions
Training Courses
Tell A Friend
Your Friend Name

 

 
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Indian Software Development Company | iPhone Development Company in India | Flex Development Company in India | Java Training Delhi | Java Training at Noida |

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.