用struts做jsp无法从.properties文件中获取文本是怎么回事啊?

maoweihua 2005-03-06 02:54:45
用struts做jsp无法从.properties文件中获取文本是怎么回事啊?
例如:<bean:message key="hello.jsp.title"/>
异常为:javax.servlet.ServletException: Missing message for key "hello.jsp.title"

<%@ page contentType="text/html;charset=gb2312" language="java"%>
<%@ taglib uri="/tags/struts-bean" prefix="bean"%>
<%@ taglib uri="/tags/struts-html" prefix="html"%>
<%@ taglib uri="/tags/struts-logic" prefix="logic"%>

<html:html locale="true">
<head>
<title><bean:message key="hello.jsp.title"/></title>
</head>

<body bgcolor="white">
<p>
<h2><bean:message key="hello.jsp.page.heading"/></h2><p>
<html:errors/><p>
<logic:present name="ch03.hello" scope="request">
<h2>Hello<bean:write name="ch03.helo" property="person"/>!<p></h2>
</logic:present>

<html:form action="/HelloWorld.do?action=gotName" focus="person">
<bean:message key="hello.jsp.prompt.person"/>
<html:text property="person" size="16" maxlength="16"/><br>
<html:submit property="submit" value="Submit"/>
<html:reset/>
</html:form><br>
<html:img page="/struts-power.gif" alt="Powerd by Struts"/>
</body>
</html:html>
...全文
174 7 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
zeq258 2005-03-07
  • 打赏
  • 举报
回复
需要在struts-confog.xml里设置:
<message-resources parameter="上层文件夹.ResourcesPath"/>
dogod 2005-03-07
  • 打赏
  • 举报
回复
需要在struts-confog.xml里设置:
<message-resources parameter="ResourcesPath"/>
losen 2005-03-07
  • 打赏
  • 举报
回复
是什么问题?没有在.xml里面制定.property?
elex 2005-03-06
  • 打赏
  • 举报
回复
hi
maoweihua 2005-03-06
  • 打赏
  • 举报
回复
问题自己解决了,来者给分啊
ouxingning 2005-03-06
  • 打赏
  • 举报
回复
请问哪里有电子商务网站的jsp源代码?或者介绍几个开源的网站也可以,谢谢!
maoweihua 2005-03-06
  • 打赏
  • 举报
回复
application.propertie为:
hello.jsp.title=Hello - A first Struts program
hello.jsp.page.heading=Hello Wrold! A first Struts application
hello.jsp.prompt.person=Please enter a name to say hello to :

ch3.hello.dont.talk.to.attilla=I told you not to talk to Atilla!
ch3.hello.no.person.error=Please entry a<!>PERSON</!> to sat hello to!

67,550

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧