Skip to main content

Posts

Showing posts with the label struts2 hello world example

Struts 2 Hello World Example

I had seen many new deveopers struggling against struts2 hello world example. So I decided to write a small example. Below are the required libraries to run this example which are easily availabel struts2-core-2.1.8.1 xwork-core-2.1.6 commons-logging-1.0.4 commons-logging-api-1.1 freemarker-2.3.8 ognl-2.7.3 commons-fileupload-1.2 The structure of the applictaion which I am following is (Eclipse IDE) Struts2Demo |---src | |----org | | |----vinod | | | |----action | | | | |----HelloWorld।java |---struts.xml |---WebContent | |---jsp | |---HelloWorld।jsp |---index.jsp |---WEB-INF | |---lib | |---web.xml Struts 2 in Action It is true that different IDE's use different structure, but at last when war is build they follow same structure. Lets start... HelloWorld.java import com.opensymphony.xwork2.ActionSupport; public class HelloWorld extends ActionSupport { String greetings = null; public String execute() throws Exception { setGreetings("Hel