Code Walkthrough

This is a code walkthrough to understand how code flow in Struts.

Below inline example used total five files for code walk through example:

  1. Form.jsp This file is responsible to generate request and send same to Server.
  2. struts.xml File to handle request and response.
  3. StudentAction.java Back end code to handle request.
  4. Success.jsp Get called in case of success.
  5. Error.jsp Get called in case of error.

Below is the simple and over all example of Struts2 overall code walkthrough flow:

Step 1 → Execution flow will start from Form.jsp where user will submit an action as student and name input field with some value filled.

Step 2 → As soon as request reach to struts.xml and look for student action mapping class com.student.StudentAction.

Step 3 → process execute() method in mapped class com.student.StudentAction and return true or false to struts.xml.

Step 4 → success and error will execute <result> tag in struts.xml and redirect to either Student.jsp or Error.jsp

Imran Khan

Specialist Master (Architect) with a passion for cutting-edge technologies like AEM (Adobe Experience Manager) and a proven track record of delivering high-quality software solutions.

  • Languages: Java, Python
  • Frameworks: J2EE, Spring, Struts 2.0, Hibernate
  • Web Technologies: React, HTML, CSS
  • Analytics: Adobe Analytics
  • Tools & Technologies: IntelliJ, JIRA

🌐 LinkedIn

📝 Blogs

📧 Imran Khan