Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Run the strtus 2.0 Program with control tag but no output

 
rachu agarwal
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 485
Eclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this
 
rachu agarwal
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic