hi I took one
struts program from smw website nd tried to run...i am not getting any error and no output also so let me what am I missed anything?
PF the code below.
1. if.jsp
<%@ taglib prefix="s" uri="/struts-tags" %>
<html>
<head>
</head>
<body>
<h1>Struts 2 If, Else, ElseIf tag example</h1>
<h1><s:property value="message"/></h1>
<s:set name="webFramework" value="framework"/>
<s:if test="%{#webFramework=='Struts 2'}">
This is Struts 2
</s:if>
<s:elseif test="%{#webFramework=='Struts 1'}">
This is Struts 1
</s:elseif>
<s:else>
Other framework
</s:else>
</body>
</html>
2. IfTagAction.java
import com.opensymphony.xwork2.ActionSupport;
public class IfTagAction extends ActionSupport{
private
String framework = "Struts 2";
public String getFramework() {
return framework;
}
public void setFramework(String framework) {
this.framework = framework;
}
public String execute() {
return SUCCESS;
}
}
3. struts.xml
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<constant name="struts.devMode" value="true" />
<package name="default" namespace="/" extends="struts-default">
<action name="ifTagAction"
class="IfTagAction" >
<result name="success">if.jsp</result>
</action>
</package>
</struts>
I ran the
jsp file and and
tomcat URL is
http://localhost:8585/TestJSP/if.jsp
and blank screen nothing else.
so please let em know where i did mistake and FYI i have dwlded all jars (xwork-2.0.5,struts2-core-2.0.11.2,commons-logging-1.0.4)