记一个bean:write的问题(struts1.3.10)

<logic:iterate id="departmentform" name="departList" >
<tr>
<td><bean:write name="departmentform" property="id" />
<%
//=departmentform.getId()
%></td>
<td><bean:write name="departmentform" property="name"/></td>
<td><bean:write name="departmentform" property="description"/></td>


这个<bean:write name="departmentform" property="id" />怎么都取不到,其它两个都能显示.换成表达式也可以显示,页面显示错误
Servlet.service() for servlet action threw exception
javax.servlet.jsp.JspException: Cannot find message resources under key org.apache.struts.action.MESSAGE
at org.apache.struts.taglib.TagUtils.retrieveMessageResources(TagUtils.java:1112)
at org.apache.struts.taglib.TagUtils.message(TagUtils.java:956)
at org.apache.struts.taglib.TagUtils.message(TagUtils.java:936)
at org.apache.struts.taglib.bean.WriteTag.retrieveFormatString(WriteTag.java:264)
at org.apache.struts.taglib.bean.WriteTag.formatValue(WriteTag.java:321)
at org.apache.struts.taglib.bean.WriteTag.doStartTag(WriteTag.java:241)
at org.apache.jsp.jsp.orgnization.listDepartment_jsp._jspx_meth_bean_005fwrite_005f0(listDepartment_jsp.java:199)
at org.apache.jsp.jsp.orgnization.listDepartment_jsp._jspService(listDepartment_jsp.java:114)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:328)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:315)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:691)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:469)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:403)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
at org.apache.struts.chain.commands.servlet.PerformForward.handleAsForward(PerformForward.java:113)
at org.apache.struts.chain.commands.servlet.PerformForward.perform(PerformForward.java:96)
at org.apache.struts.chain.commands.AbstractPerformForward.execute(AbstractPerformForward.java:54)
at org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)
at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:191)
at org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:305)
at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:191)
at org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)
at java.lang.Thread.run(Thread.java:619)
*******************************************************

问题刚刚解决,这是个非常难以理解的答案,一定要在应用中添加资源文件!
我的困惑在于:
为什么不加资源文件的时候<bean:write name="departmentform" property="name"/>都能正常显示,
就是<bean:write name="departmentform" property="id"/>不能?

另外换用JSTL<c:out.....>实现,则这种取属性的必须版本为JSTL1.1以上.

你可能感兴趣的:(java,apache,bean,servlet,struts)