Struts Tutorial

struts tutorials

Struts 1.x is the most famous, classic and proven Model-View-Contraller (MVC) framework. Often times, you will listen something like, meaningless to learn Struts 1.x, it’s a dead framework. However, with the huge success of Struts 1.x in early day, there are still hundreds of thousand companies are implemented Struts 1.x, and never consider upgrade, so the Struts 1.x is still causing many maintainability.

Struts 1.x is a complete web framework, provides complete web form components, validator, internalization, error handling, tiles layout, low learning curve and easy to implement it. In this tutorials, it provides many step by step examples and explanations on using Struts 1.x MVC framework.

Happy learning Struts. :)

Struts Quick Start

Let’s go through a quick start to understand about the Struts 1.x framework.

Struts Configuration

All stuffs about Struts configuration.

Struts Action & ActionForm

Action and ActionForm implementation class.

Struts Web Form Components

Struts has complete support for all standard web form components.

Struts Logic Tags

Struts comes with a lot logic tags to ease the bean component iteration or conditional processing.

Struts Error and Logging

Exception handling and error logging.

Struts localization

Struts has good support in internationalizing or localization.

Struts Validator Framework

In Struts validator framework, it provides many generic methods (required, maxlength, minlength..) to validate the form components, it makes your validation code more standardize and easier to maintain.

  • Struts validator example
    A simple user registration form , and validate the username, password and email field with Struts validator.

Struts Tiles Framework

Struts tiles framework is a powerful layout framework, which is used to maintain a standard look of header, footer or menu details across all of your web pages.

  • Struts Tiles framework example
    A simple web application to demonstrate the use the Sturts tiles framework to change the header and footer page easily.

Struts Integrate with Other Frameworks

Anything about the Struts integration with others framework.

Struts Misc

Others Struts examples.

Struts Common Errors

Some Struts common error messages.

Struts Reference

Tags :

About the Author

mkyong
Founder of Mkyong.com and HostingCompass.com, love Java and open source stuff. Follow him on Twitter, or befriend him on Facebook or Google Plus. If you like my tutorials, consider make a donation to these charities.

Comments

  • roja

    i am beginner of the spring,Hibernate MySQL project
    How to create Schema in MySQL,i am installing My SQL essential And My SQL Tool how can i create schema in tool

  • tran

    i am beginning java, i want create maven project, but i need struct2+spring+sitemesh. so, how do i config it? could you help me!

  • Gourab

    Hi i am getting the problem that ${} tag is nor working on server. Our server has tomcat 5. I tried many way but it not working. Can you help me?

    ${x1}

  • Anish

    hi
    i want to fill radio button in struts application according to database gender value.
    i try so much but cant get proper output can some buddy help me……..

    • Sai

      its because there is not sufficient salt in your food. Eat more salt then your problem shall disappear.

  • sai

    Hi Frnds,
    I am looking for email functionality in java using JMS.
    1)In which i need to send as html email template(image).
    2)How/where to capture the mail that is send successfully or failed.

    Waiting for your valuable reply ASAP. Thanks in advance.

  • sumitra

    very nice.

    • sumitra

      tyut

      • just-in

        thank you for saying very nice..

  • sharad srivastava

    sir i am not able to upload an image in struts1.2. and to reteive it from database..
    sir please help me out.
    thanking you
    regards
    sharad srivastava

  • anh lê

    Thank you very much.

  • http://[email protected] haribabu

    this blog is very help ful sir , i am saying thanks to you for maintaining this website and you are doing the servicing for the people who are struggle for resolving the technical problems……………….

    thank you very much, for doing the service………………………..

  • ashish

    Very nice website

  • pen

    Hi
    I need client side form validation using javascript on struts(username and password should be start with same character)

  • Fearless Coder

    I love your blog, extremely helpful for me (beginner), and easy to understand. THANK YOU SIR!!!!!!!!!!!!!!!!!!!!!!!!!!!!

  • Victoria

    Hi Mkyong,
    How to achieve singleThreadModel in struts .. please share your ideas

    • taj

      nice question victoria but single thread model was deprecated in struts ans as wellas servlets,,,,,,,

      • Victoria

        in struct 1.1 .. how will do.. any idea.. thanks in advance..

  • Saurabh Sinha

    Sir,
    How to Implement security or web container security for struts1.x based web Application.
    please give a demo.
    Thanks

  • sachin

    Hi,
    Thanks for all your efforts
    I need a solutions for my problem. In my application there is a combination of last name and email id. When new users are trying to register. If user id and last name exist alredy. this shows a error message on top “You are already register, Please click on ID Reminder Link”. So i want a hyper link on this message to the reminder ID link.

    How can i paste a link to other page in Struts error message

  • sumit

    Hi Sir,
    whenever i tried to import the zip.file or even making my own struts1 based project using the same pom.xml i am getting this exception
    It did not happen while i make my project without maven means by simple impoerting all jar file manually.
    Please help me…
    Waiting for your Solved reply soon….

    SEVERE: Servlet /StrutsExample threw load() exception
    java.lang.ClassNotFoundException: org.apache.commons.digester.RuleSet
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1387)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
    at java.lang.Class.getConstructor0(Class.java:2699)
    at java.lang.Class.newInstance0(Class.java:326)
    at java.lang.Class.newInstance(Class.java:308)
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1116)
    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:993)
    at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4149)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4458)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
    at org.apache.catalina.core.StandardService.start(StandardService.java:516)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:583)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
    6 Apr, 2012 7:54:47 PM org.apache.coyote.http11.Http11Protocol start
    INFO: Starting Coyote HTTP/1.1 on http-8086
    6 Apr, 2012 7:54:48 PM org.apache.jk.common.ChannelSocket init
    INFO: JK: ajp13 listening on /0.0.0.0:8009
    6 Apr, 2012 7:54:48 PM org.apache.jk.server.JkMain start
    INFO: Jk running ID=0 time=0/319 config=null
    6 Apr, 2012 7:54:48 PM org.apache.catalina.startup.Catalina start
    INFO: Server startup in 4256 ms
    6 Apr, 2012 7:55:01 PM org.apache.catalina.core.StandardWrapperValve invoke
    INFO: Servlet action is currently unavailable

  • Kamal

    i didnot find any blog of EJB 3.0. Could you please provide tthis Blog for us.

    • rinku

      great maven !

  • Basanta Kumar nahak

    what is maven?
    what is the use of maven?
    how can we use it?

    • toshik

      maven is just like eclipse it is a IDE

      • http://facebook.com/wun93 quân chùa

        Oh NO no no you’re wrong
        Maven is a tool to manage the project .It is intergrated into eclipse or other IDE.

  • anil

    thanks a lot to mkyong

    • http://www.Previousrecordsnotfound rajesh

      a”> Java codes here
      XML –

       XML here

      HTML – <pre lang="html4strict"

  • Alexander Pavluchenko

    Helps slove to my work, great blog!

  • anh nguyen

    thank U so much !
    Your blog’s very usefully ! ^_^

  • Sagar Yadav

    Thanks.

  • dhananjay patil

    this error is coming when i am running the struts applciation please help .

    org.apache.jasper.JasperException: java.lang.ClassCastException: org.apache.catalina.util.DefaultAnnotationProcessor cannot be cast to org.apache.AnnotationProcessor.

    thank you,
    dhananjay