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

About the Author

author image
mkyong
Founder of Mkyong.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

Leave a Reply

avatar
newest oldest most voted
anurag
Guest
anurag

this is very helpful for everyone who wants to learn struts framework.
thank you

surya prakash singh
Guest
surya prakash singh

how can we judge from working application that working application is build on strusts

Manoj kumar
Guest
Manoj kumar

Right click on web application and see in view source whether they imported struts related tags.This is the basic one to find out .One more ,If you give view source if they are using any action tag in jsp with passing *.do action ,We can make sure this application working with struts.

Jeevan Sunkersett
Guest
Jeevan Sunkersett

Hi,

I want to uplift the UI provided by JSP, to the more dynamic/ rich feel of Angular JS (1.x)
but want to keep the back-end same.
By back-end I am referring to Action-Controller and Model tier.

In this exercise keeping the Action-Controller undisturbed does not seem feasible – they are better re-written using Angular’s (UI-router)
Maybe the model tier can be re-used.

Any comments?

thanks

Markandayan P
Guest
Markandayan P

Help me out in web-fragment in struts 1.3 with an example

arpan kumar Kar
Guest
arpan kumar Kar

where is the dtd file for struts 1.3.10………………….please help me

Ivan
Guest
Ivan

hi… does JDK 7 support Struts 1x ?

Manoj kumar
Guest
Manoj kumar

yes it will support,Recenty i changed my jdk 6 to 7 ,But i am using struts 1.3 it’s working good with out any issues

garima
Guest
garima

I am performing edit operation in Struts 2. How is it possible to hide the ID to be seen in the URL?

Manoj kumar
Guest
Manoj kumar

you cant hide the id(As per my knowledge you cant do that) ,You can use encoding techniques to change url

rajkumar
Guest
rajkumar

how authentication will be given in spring ……..

Navya
Guest
Navya

i am new to struts 1.2 ,can you suggest how to manage form with dynamic text fields in struts

Navya
Guest
Navya

how can we manage dymanic form elements in struts 1.2

sjharaniya
Guest
sjharaniya

Help me out to display image/blob in to jsp using strts1x ?

roja
Guest
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
Guest
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
Guest
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
Guest
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
Guest
Sai

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

sai
Guest
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
Guest
sumitra

very nice.

sumitra
Guest
sumitra

tyut

just-in
Guest
just-in

thank you for saying very nice..

sharad srivastava
Guest
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ê
Guest
anh lê

Thank you very much.

haribabu
Guest
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
Guest
ashish

Very nice website

pen
Guest
pen

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

Fearless Coder
Guest
Fearless Coder

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

Victoria
Guest
Victoria

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

taj
Guest
taj

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

Victoria
Guest
Victoria

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

Saurabh Sinha
Guest
Saurabh Sinha

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

sachin
Guest
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
Guest
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… Read more »
Kamal
Guest
Kamal

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

rinku
Guest
rinku

great maven !

Basanta Kumar nahak
Guest
Basanta Kumar nahak

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

toshik
Guest
toshik

maven is just like eclipse it is a IDE

quân chùa
Guest
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
Guest
anil

thanks a lot to mkyong

rajesh
Guest
rajesh

a”> Java codes here
XML –

 XML here 

HTML – <pre lang="html4strict"