Struts 2 Tutorial

RoseIndia Struts 2 Tutorial and Online free training helps you learn new elegant Struts 2 Framework with examples. Struts 2 is very elegant and flexible front controller framework based on many standard technologies like Java Filters, Java Beans, Resource

Struts 2 Tutorial

Struts 2 Tutorial

     

RoseIndia Struts 2 Tutorial and Online free training helps you learn new elegant Struts 2 Framework with examples. Struts 2 is very elegant and flexible front controller framework based on many standard technologies like Java Filters, Java Beans, ResourceBundles, XML etc.

Struts 2 Training! Get Trained Now!!!

  1. Struts 2 Features
    It is very extensible as each class of the framework is based on an Interface and all the base classes are given an extra application and even you can add your own. 
      
  2. Struts 2 History
    Apache Struts is an open-source framework that is used for developing Java web application. Originally developed by the programmer and author Craig R. McClanahan this was later taken over by the Apache Software Foundation in 2002.
      
  3. Struts 2 Architecture
    Struts and webwork has joined together to develop the Struts 2 Framework. Struts 2 Framework is very extensible and elegant for the development of enterprise web application of any size. In this section we are going to explain you the architecture of Struts 2 Framework.
      
  4. Why Struts 2
    The new version Struts 2.0 is a combination of the Sturts action framework and Webwork.

Advertisement
  1. Struts 1.x Vs Struts 2.x
    In the following section, we are going to compare the various features between the two frameworks. Struts 2.x  is very simple in comparison to the struts 1.x,  few of its excelling features are:
     
  2. Downloading and Installing Struts 2
    In this section we will download and install the Struts 2.0 on the latest version of Tomcat container. We will first download tomcat and configure it as our development server.
       
    Struts 2 Hello World Application
  3. Creating the development directory Structure
    In this section we will create directory structure of our Struts 2 Hello World application based on Struts 2 framework. Our Struts 2 Hello World application is your first step towards developing applications based on Struts 2 framework.
      
  4. Writing Jsp, Java and Configuration files
    In this section we will write JSP, Java and required configuration files for our Struts 2 Hello World application. Now in struts 2 struts.xml is used to configure the applications. We will also deploy and test the application.
      
  5. Struts 2 xml configuration file
    In this section we will introduce you with the struts.xml file. This section explains you how best you can use the struts.xml file for you big projects.
      
    Struts 2 Actions
  6. Struts 2 Actions Example
    When a client request matches the action's name, the framework uses the mapping from struts.xml file to process the request.
     
  7. Struts 2 Actions Introduction
    When a client request matches the action's name, the framework uses the mapping from struts.xml file to process the request. The mapping to an action is usually generated by a Struts Tag.
     
  8. Struts 2 Redirect Action
    In this section, you will get familiar with struts 2 Redirect action and learn to use it in the struts 2 application.

      
    Struts 2 Login Application
  9. Developing Login Application in Struts 2
    In this section we are going to develop login application based on Struts 2 Framework. Our current login application does not validate the user against the database.
      
  10. Adding Validation to Struts 2 Login Application
    In this section we will write the code to validate the login application. After completing this section you will be able to write validations for your Struts 2 projects.
      
  11. Running and testing application
    In this section we will run the example on Tomcat 6.0 server and check how it works.

      
  12. Client Side Validation in Struts 2 Login Application
    In this section we will see how to write code that will generate Java Script code for client side validation. In the last section we developed Login-validator.xml configuration file for defining the server side validation.
      
  13. Validations using Struts 2 Annotations
    In this section we are going to validate our login application using Annotations in Action class. Our current login application does not validate the user against the database. 
      
    More Struts Validator Examples
    User input validations are an integral part of any web application. With the release of Struts 2, validation are now much easy and robust. Struts 2 support Ajax based and even server side validations.
      

  14. Login/Logout With Session
    In this section, we are going to develop a login/logout application with session. This application checks the user authentication. Whenever you run, it takes a user id and a password (Both the user id and password is "admin") it displays the welcome page, when both fields are correctly filled.
  15. Connecting to MySQL Database in Struts 2 (Struts 2 MySQL)
    In this section, You will learn to connect the MySQL database with the struts 2 application. 

  16. Rich Editor Example
    In this section, you will learn how to create pagination in struts 2. 

  17. Validate TextArea
    In this section, you will learn how to validate your text area in struts 2. A text area contains 1 to 250 characters. It cann't support "null" value.
     
    Struts 2 Tags  

  18. Struts Tags
    In this section we will introduce you with the tags provided along with Struts 2 framework. It is necessary to understand all the tags provided along with Struts 2 framework.
      
    Struts 2 Tags Examples
     
  19. Struts 2 Tags Examples (Generic Tags)
    Struts 2 tags tutorials and examples. 

  20. 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 as if, else and iterate.).

  21. 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.

  22. 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.

  23. Generator Tag (Control Tags) Using Count Attributes
    In this section, we are going to describe the generator tag using the
    count attributes.

  24. 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.

  25. 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 or  java.util.Iterator.

  26. 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 merge iterator causes each merge iterator to have a chance to expose its elements, subsequently next call allows the next iterator to expose its element.

  27. 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.

  28. 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 indicates the number of entries to be set in the resulting subset iterator.

  29. 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).

  30. 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.

  31. 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 confirms to the JavaBeans specification.

  32. 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.

  33. 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.

  34. 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.

  35. 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.

  36. 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.

  37. 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.

  38. Struts 2 Tags (UI Tags) Examples
     
    Form Tags Examples

  39. Auto Completer Example
    In this section, we are going to describe the autocompleter tag. The autocompleter tag always displays a dropdown list with the options that have at least a partial match with entered text in the textbox. If the user clicks on the dropdown button then all options shown in the dropdown list.

  40. Checkbox Tag (Form Tag) Example
    In this section, we are going to describe the checkbox tag. The checkbox tag is a UI tag that is used to render an HTML input element of type checkbox, populated by the specified property from the ValueStack.

  41. Checkboxlist Tag (Form Tag) Example
    In this section, we are going to describe the checkboxlist tag. The checkboxlist tag is a UI tag that creates a series of checkboxes from a list. Setup is like <s:select /> or <s:radio />, but creates checkbox tags.

  42. Combobox Tag (Form Tag) Example
    In this section, we are going to describe the combobox tag. The combo box is basically an HTML INPUT of type text and HTML SELECT grouped together to give you a combo box functionality.

  43. Datetimepicker Tag (Form Tag) Example
    In this section, we are going to describe the datetimepicker tag. The datetimepicker tag is a UI tag that is used to render a date/time picker in a dropdown container.
    0

  44. Doubleselect Tag (Form Tag) Example
    In this section, we are going to describe the doubleselect tag. The doubleselect tag is a UI tag that renders two HTML select elements with second one changing displayed values depending on selected entry of first one.

  45. File Tag (Form Tag) Example
    In this section, we are going to describe the file tag. The file tag is a UI tag that renders
    an HTML file input element achieved through browsing.

  46. Form Tag Example
    In this section, we are going to describe the form tag. The form tag is a UI tag that renders HTML an input form.
    1

  47. Label Tag (Form Tag) Example
    In this section, we are going to describe the label tag. The label tag is a UI tag that is used to render an HTML LABEL that allows to output label:name type of combinations that has the same format treatment as the rest of UI controls.

  48. Optiontransferselect Tag (Form Tag) Example
    In this section, we are going to describe the Optiontransferselect tag. The Optiontransferselect tag is a UI tag that creates an option transfer select component.

  49. Optgroup Tag (Form Tag) Example
    In this section, we are going to describe the optgroup tag. The optgroup tag is a UI tag that creates an optgroup component which needs to reside within a select tag <s:select>.
    2

  50. Password Tag (Form Tag) Example
    In this section, we are going to describe the password tag. The password tag is a UI tag that renders an HTML input tag of type password.

  51. Radio Tag (Form Tag) Example
    In this section, we are going to describe the radio tag. The radio tag is a UI tag that renders a radio button input field.

  52. Reset Tag (Form Tag) Example
    In this section, we are going to describe the reset tag. The reset tag is a UI tag that  is used with the form tag to provide form resetting.
    3

  53. Select Tag (Form Tag) Example
    In this section, we are going to describe the select tag. The select tag is a UI tag that is used to render an HTML input tag of type select.

  54. Submit Tag (Form Tag) Example
    In this section, we are going to describe the submit tag. The submit tag is a UI tag that is used to render a submit button. The submit tag is used with the form tag to provide asynchronous form submissions.

  55. Textarea Tag (Form Tag) Example
    In this section, we are going to describe the textarea tag. The textarea tag is a UI tag that is used to render an HTML textarea.
    4

  56. Textfield Tag (Form Tag) Example
    In this section, we are going to describe the textfield tag. The textfield tag is a UI tag that is used to render an HTML input field of type text.

  57. Updownselect Tag (Form Tag) Example
    In this section, we are going to describe the updownselect tag. The updownselect tag is a UI tag that creates a select component with buttons to move up and down the elements in the select component.

    Non-Form UI Tags

  58. Actionerror and Actionmessage Tags (Non-Form UI Tags) Example
    In this section, we are going to describe the actionerror and actionmessage tags. The actionerror tag is a UI tag that renders action errors (in the jsp pages.) if they exists while the actionmessage tag renders action messages if they exists.
    5

  59. Fielderror Tag (Non-Form UI Tags) Example
    In this section, we are going to describe the fielderror tags. The fielderror tag is a UI tag that renders field errors if they exists.

  60. TabbedPanel (Ajax Tag) Example
    In this section, you will learn about the tabbedPanel tag. This is an Ajax component, where each tab is either a local content or a remote content (refreshed each time when  user selects that tab).

  61. tree and treenode (Ajax Tag) tags Example
    In this section, you will learn about the tree and treenode tags. These both work with the Ajax support.   
      
  62. Div (Ajax Tag) tag Example
    In this section, you will learn about the div tag. The div tag is an Ajax component that is used with Ajax  that refreshes the contents of a particular section without refreshing the entire page.
      
     
    Struts 2 Examples  
  63. Struts 2 Date
    In this section we will discuss the date processing functionalities available in the Struts 2 Framework.
      
  64. Date Format Examples
    In this tutorials you will learn about Date Format function in Struts 2. We have provided fully tested example code to illustrate the concepts.
      
  65. Struts 2 datepicker Example
    In this section we will show you how to develop datetimepicker in struts 2. Struts 2 uses the dojo toolkit for creating date picker.

      
  66. Struts 2 Format Examples
    In this section you will learn how to format Date and numbers in Struts 2 Framework. Our Struts 2 Format Examples are very easy to grasp and you will learn these concepts in very small time.
      
  67. Struts 2 File Upload
    In this section you will learn how to write program in Struts 2 to upload the file on the server. In this example we are also providing the code to save the uploaded file in any directory on the server machine.
      
    Struts 2 Resources Examples
  68. Struts 2 Resources Examples
    The struts 2 resources examples
      
  69. Static Parameter
    In this section, we will develop a simple application to access the static parameters. We will use a JavaBean to set and get the static parameters. Each static parameter has a value.  
      
  70. Accessing Session Object
    In this section, we will develop a simple application to access the framework resources like the session object, session context and the last accessed session time.
    6

  71. Access Request and Response 
    In this section, you will learn to develop an application that accesses the request and response object in struts 2 application.

    Struts 2 Tools

  72. Struts 2 Eclipse Plugin
    This page contains the examples and the list of plugins that are available for Struts 2 Development using Eclipse IDE.
      
  73. Struts 2 IDE
    This page contains the list of IDEs available to ease the development of Struts 2 Framework based applications. The IDE for Struts 2 will actually make the development cycle much easier.
      
  74. Struts 2 Application
    Developing user registration application based on Struts 2 Framework. This Struts 2 Application is a simple user registration application that will help you to learn how to develop real world applications using Struts 2 Framework.
      
  75. Struts 2 Ajax
    In this section we explain you Ajax based development in Struts 2. Struts 2 provides built-in support for Ajax using Dojo toolkit.
      


Download Source Code of Struts 2 Tutorial

  Download Latest Struts 2

      7