Practical 8 Output
Practical 8 Output
Roll No:
PROGRAM CODE:
1)Input.jsp
2) Result.jsp
3)SumAction.java
package net.codejava.struts;
import com.opensymphony.xwork2.ActionSupport;
/**
* The action method
* @return name of view
*/
public String calculate() {
sum = x + y;
return SUCCESS;
}
4) struts.xml
<struts>
<package name="Struts2Beginner" extends="struts-default">
<action name="calculateSumAction" class="net.codejava.struts.SumAction"
method="calculate">
<result name="success">/Result.jsp</result>
<result name="input">/Input.jsp</result>
</action>
</package>
</struts>
5)web.xml
<filter>
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>
OUTPUT: