Sun Java Struts Tutorial

Sun Java Struts Tutorial thumbnail
Struts Web Application Development

Sun's Java programming language is one of the most popular programming languages. It has a wide adoption for server-side development for web applications. Apache Struts is an open-source Java framework that helps creation of web based applications. It provides a Model-View-Controller architecture that streamlines the development of web based applications by demarcating code into Model--representing business data, View--representing page design and Controller--representing page navigation logic. It also provides a library of tag library that offers functionality frequently needed in a web application.

Things You'll Need

  • Apache struts library java archive (jar) file
  • Web container like Apache Tomcat
  • Java Integrated Development Environment (IDE) like NetBeans
  • Any dependent library jar files
Show More

Instructions

  1. Setting up the development environment

    • 1

      Download Struts jar file from http://struts.apache.org/download.cgi

    • 2

      Add the struts jar file to your project's library path. This will make the Struts classes available for your application development.

    • 3

      Download and install the web container (example Apache Tomcat) to be used in deploying the Apache Struts application.

    Developing the application

    • 4

      Model your application as a series of Forms that are sent to an action which direct the user to result (success or error) pages.

    • 5

      Design your web application and assemble the static pages and forms like java server pages and HTML pages in the project. Example: createUser.jsp.

    • 6

      Develop the model and action classes that will be used in the application. Example: UserAction.java, User.java

    • 7

      Develop the view pages like the success and error pages that will get used in the application. Example: UserCreated.jsp, UserError.jsp

    Deploy the application

    • 8

      Configure the web.xml file and define the Servlets and Struts actions that were developed in Section 2. A sample action will consist of web form page (from Section 2, Step2) that gets submitted to an action (Section 2, Step 3) which in turn directs the user to a success or error page (Section 2, Step 4).

    • 9

      (optional) Bundle the application into a web archive (war) file. The files can also be deployed directly as an expanded application.

    • 10

      Deploy the application files or the war file created in Step 2 above onto the web container being used (example tomcat). Make sure all the application classes and library jar files are deployed correctly.

    • 11

      Access and test your Java Struts application.

Tips & Warnings

  • It is a good idea to go through the Struts tag library to re-use pre-built web application logic and form elements.

  • Make sure all the necessary the library jar files are copied to the development environment as well as the deployment environment.

Related Searches:

References

Resources

  • Photo Credit pagina web image by Bernardo Varela from Fotolia.com

Comments

You May Also Like

  • Java Struts Tutorial

    Java Struts is the application framework developed by Sun Microsystems in order to dynamically deliver web pages to the end user. The...

  • Struts Tutorial for Beginners

    Struts is a framework to develop applications from scratch, for use in the J2EE (Java 2 Enterprise Edition) environment. Struts is a...

  • Apache Struts Tutorial

    Apache Struts serves as a design pattern for JSP (Java server pages) on Apache servers. It operates on the model-view-controller principle, where...

  • Sun Java Tutorial

    Sun Java applications apply to a wide variety of contexts. Java programs built using the object oriented model are composed of distinct...

  • Struts Basics Tutorial

    There are many web applications offering a dynamic web experience as a result of client-server web-based programming languages. For example, the JavaServer...

  • Tutorial on Struts

    If the struts on your vehicle have gone bad, you have a choice of replacing the strut assembly completely or any broken...

  • Java Activation Framework Tutorial

    Java, like other object-oriented languages, runs on a framework of activating specific instances of programming objects. These objects serve as a kind...

  • Java Spring Vs. Struts

    Spring and Apache Struts are popular frameworks for implementing java applications. Compared with Apache Struts, Spring provides a wider range of facilities...

  • Struts vs. Faces

    JavaServer Faces and Apache Struts are Web development programs used for Java-based applications. When deciding between using Faces and Struts, the choice...

  • A Quick Tutorial on Struts

    Struts is a Web application framework that is written in the Java programming language. It is intended to facilitate the rapid development...

Related Ads

Featured