Struts 2 Tags Introduction

    The Apache Struts 2 framework provide a lot of default  custom tags and its library that we can use in JSP pages to get the application data from ValueStack as well as from request, session or application scope attributes. You need not write any HTML code, the struts tags will automatically generate them for you based on the theme you select. By default the XHTML theme is used. The XHTML theme uses tables to position the form elements.

Struts tags can be divided into 5 categories

  1. Data tags
  2. Control tags
  3. Form tag
  4. UI tags
  5. Ajax tages


 

Check into the Struts2 Data tags and how we can use them in JSP pages. We need to import Struts 2 tag libraries in JSP pages to use them through taglib directive.


 

Generic Tags

Generic Tag Reference
Struts Generic Tags control the execution flow as pages render.
Control Tags
  • if
  • elseif
  • else
  • append
  • generator
  • iterator
  • merge
  • sort
  • subset
Data Tags
  • a
  • action
  • bean
  • date
  • debug
  • i18n
  • include
  • param
  • property
  • push
  • set
  • text
  • url

UI Tags

UI Tag Reference
Struts UI Tags display data in rich and reusable HTML.
Form Tags
  • checkbox
  • checkboxlist
  • combobox
  • datetextfield
  • doubleselect
  • head
  • file
  • form
  • hidden
  • inputtransferselect
  • label
  • optiontransferselect
  • optgroup
  • password
  • radio
  • reset
  • select
  • submit
  • textarea
  • textfield
  • token
  • updownselect
Non-Form UI Tags
  • actionerror
  • actionmessage
  • component
  • div
  • fielderror
Ajax Tags
  • a
  • autocompleter
  • bind
  • datetimepicker
  • div
  • head
  • submit
  • tabbedPanel
  • textarea
  • tree
  • treenode