struts2 spring file structure

Struts2 Spring Hello World in Eclipse

Following example shows the integration of Struts2 ans Spring using ant in Eclipse
Using struts v-2.3.4.1 and spring v-3.2.0

File Structure
struts2 spring file structure

—index.jsp—

—Welcome.jsp—

—applicationContext.xml—

—User.java—

—struts.xml—

—web.xml—

OUTPUT:

output1
output2

Get the complete code with all the jars included. Enjoy

Struts2 Validation using validation.xml Netbeans Example

Struts2 provides different validation methods. In this post basic validation method is described that uses the validation.xml file.
 
File Structure

validation_struts2_file_structure_netbeans

 
—index.jsp—

 
—Register.java—

 
—struts.xml—

 
—Register.validation.xml— (Place this file in the folder where your Register.java is)

 

There are other pages also. Download the complete program.
Validation_Struts2_Mvn_Netbeans.rar

 
OUTPUT

validation_output_eclipse

source: http://struts.apache.org/release/2.0.x/docs/validation.html

xml Validation Struts2 Example

Struts2 provides different validation methods. In this post basic validation method is described that uses the validation.xml file.

File Structure

validation_struts2_file_structure_eclipse
—index.jsp—

Struts 2 Validation Example

 
—Register.java—

—struts.xml—

—Register.validation.xml— (Place this file in the folder where your Register.java is)

 

There are other pages also. Download the complete program.
Validation_Struts2_Mvn_Eclipse.rar

OUTPUT

validation_output_eclipse

source: http://struts.apache.org/release/2.0.x/docs/validation.html

Struts2 Hello World in Eclipse

Struts2 Hello World Example in Eclipse

Below Example use struts2.3.X version

Project Structure

Strut2 Hello File Structure

—index.jsp—

 

—HelloWorld.jsp—

 

—web.xml—

 

—struts.xml—

 

—HelloWorldAction.java—

 

—MessageStorage.java—

 

—pom.xml—

 

—OUTPUT—

 Struts2 Hello World

 

Download Struts2 Hello Program

 

Source: http://struts.apache.org/release/2.3.x/docs/create-struts-2-web-application-using-maven-to-manage-artifacts-and-to-build-the-application.html

How to Send Email in Java, Struts 2.x

Hello Friends,

This is a struts 2.x based Java “Email Sending” Web application. I have developed this project using Netbeans IDE 7.2 and Glassfish 3.1 as the integrated Server. 

We are very much in need of this sorts of program with the help of which can achieve various tasks so easily. Either it is validating a registration form i.e. users information by sending a unique code  through email at the time of submission of form which can help us to validate a valid existing email id and make us sure that the submitted form is ready to be saved into database table or in case we want to provide the forgot password option with our login pages in struts 2.x (JSP or Servlet or Spring based applications). This example is vary precious so make sure you go with easy and every step carefully to avoid common programming mistakes.

Download plugins or jar files for mail by clicking here (java – mail plugins ) Extract the .rar files and put them in a directory. Please do not extract .jar files.

Follow each step by going through the images carefully: 
1. Click on File -> New Project


 
2. Select Java Web -> Web Application and Click on Next

 

3. Type the name of Project and Its location upon your taste and click Next.


 
4. If the server is glassfish then just click Next or you can add the server by clicking add button.


 
5. In case you have clicked on add button the following window will appear. Select your type of server installed on your computer, locate its directory as per installation and click Next.


 
6. Now Select Struts 2 from the options in the appeared window and dis-select the create example option and finally click on Finish.


 
7. When everything is done and you have clicked finish. The new project will be generated by the IDE for you.


 
8. This might be the first look of the project(I have expanded every option).


 
9. Now right click on libraries as directed and click on add jar files and folders. Locate the plugins you have downloaded one by one or all by using ctrl key.

CODE:

1. index.jsp

2. message.jsp

3. web.xml

4. struts.xml

5. SendMail.java

6. Back.java

 
Run: If you have successfully and carefully created everything mentioned above now you can have directory structure as :

 
Now right click on the projects root directory and click Run. Here is what the welcome or index page will look like.

Best of Luck! 

Download complete program from
here