Struts2 Action Tag Example
Aim:
Action tag is used to call action directly from jsp in struts2 framework.
Note:
I have already explained how to create struts2 project and folders for storing jsp file and for stroing action class file. I also explained where we configure the project.
Procedure:
Step 1:
Create Project name as ActionTag
Step 2:
Create Action class HelloWorld
package example;
import com.opensymphony.xwork2.ActionSupport;
public class HelloWorld extends ActionSupport
{
String greetings = null;
public String execute() throws Exception
{
setGreetings("Hello World");
return SUCCESS;
}
public String getGreetings()
{
return greetings;
}
public void setGreetings(String greetings)
{
this.greetings = greetings;
}
}
Step 3:
Create index.jsp file
No comments:
Post a Comment