• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Run the strtus 2.0 Program with control tag but no output

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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)
 
Ranch Hand
Posts: 485
Eclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try this
 
rachu agarwal
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic