我的财产没有在struts 2.0中的jsp上渲染
我在 Action 类中设置了一个属性,如下所示
public class HelloWorld{
public String execute() { ANNOTATION #1
setCustomGreeting( GREETING + getName() );
return "SUCCESS";
}
private String customGreeting;
public String getCustomGreeting()
{
return customGreeting;
}
public void setCustomGreeting( String customGreeting ){
this.customGreeting = customGreeting;
}
}
,我尝试在 jsp 上呈现它,如下所示,
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<html>
<head>
<title>HelloWorld</title>
</head>
<body>
<h3>Custom Greeting Page</h3>
<h4><s:property value="customGreeting"/></h4>
</body>
</html>
但它在 jsp 上没有打印任何内容,请帮助我?
I have set a property in Action class as follows
public class HelloWorld{
public String execute() { ANNOTATION #1
setCustomGreeting( GREETING + getName() );
return "SUCCESS";
}
private String customGreeting;
public String getCustomGreeting()
{
return customGreeting;
}
public void setCustomGreeting( String customGreeting ){
this.customGreeting = customGreeting;
}
}
And i m trying to render it on jsp as follows
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<html>
<head>
<title>HelloWorld</title>
</head>
<body>
<h3>Custom Greeting Page</h3>
<h4><s:property value="customGreeting"/></h4>
</body>
</html>
But it's printing nothing on the jsp, please help me?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
调试建议:
Debugging suggestions:
你的代码看起来不错吗?
直接调用JSP吗?
您的 Action 是否映射到 struts.xml 中?
Your Code looks fine?
Do you call the JSP directly?
Is your Action mapped in the struts.xml?