Struts 通过 Include 传递静态类名
我试图通过为两个 JSP 之间的公共代码块创建包含来减少代码。然而,我在尝试弄清楚如何使用 struts 传递此包含参数时遇到了最困难的时间。
在父 JSP 中,我有以下内容:
<s:include value="../path_to_include.jsp">
<s:param name="someClass" value="com.package.ClassName" />
</s:include>
在 include 内:
<s:set name="staticClassMember" value="%{@someClass@STATIC_CLASS_MEMBER}" />
这会导致 struts 失败。所以我这里有几个问题:
- 如何传递这个类名并将其作为包含的 JSP 中的变量进行访问?
- 我尝试在 struts.xml 中将 struts.devMode 设置为 true,但这似乎没有给我错误,这包括 JSP 只是不显示。没有任何错误消息,我几乎不知道为什么会失败/如何修复它。 struts 是否需要其他设置才能产生错误?
- 我在哪里可以找到这方面的一些好的文档?
我不想将每个静态变量作为单独的参数包含到包含中。
I'm attempting to reduce code by creating a include for a common block of code I have bewtween two JSPs. However, I'm having the hardest time trying to figure out how to pass this include parameters with struts.
In the parent JSP, I have this:
<s:include value="../path_to_include.jsp">
<s:param name="someClass" value="com.package.ClassName" />
</s:include>
Within the include:
<s:set name="staticClassMember" value="%{@someClass@STATIC_CLASS_MEMBER}" />
Which causes struts to fail. So I have a few issues here:
- How can I pass this class name and access it as a variable in the included JSP?
- I tried setting struts.devMode to true in my struts.xml, but this doesn't seem to give me an error, this included JSP just doesn't show up. Without any error messages, I'm pretty much at a loss why this is failing/how to fix it. Is there another setting I need for struts in order to have this produce an error?
- Where can I find some good documentation for this?
I'd like to not have to include each static variable as a separate argument to the include.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论