| Author |
Run the strtus 2.0 Program with control tag but no output
|
rachu agarwal
Greenhorn
Joined: Aug 24, 2011
Posts: 6
|
|
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)
|
 |
Mohana Rao Sv
Ranch Hand
Joined: Aug 01, 2007
Posts: 485
|
|
|
Try this
|
ocjp 6 — Feeding a person with food is a great thing in this world. Feeding the same person by transferring the knowledge is far more better thing. The reason is the amount of satisfaction which we get through food is of only one minute or two. But the satisfaction which we can get through the knowledge is of life long.
|
 |
rachu agarwal
Greenhorn
Joined: Aug 24, 2011
Posts: 6
|
|
Hi Rao,
I tried as you suggested but still i have same issue no error and even no output display.[img]C:\Users\Sunil Agarwal\Desktop\image[/img
let me know do I need to keep the struts-bean.tld and others tld's under WEB-INF\lib also.
|
 |
 |
|
|
subject: Run the strtus 2.0 Program with control tag but no output
|
|
|