jsp

我是在eclipse下写jsp的,在使用jstl1.1<fmt:message〉时遇到了以下问题:
<%@ page contentType="text/html;charset=GB2312" import="java.util.*,java.lang.*"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
<head>
<title>fmt.jsp</title>
</head>
<body></br><fmt:message key="Str1" bundle="MyResource.jsp" />
</body>
</html>
properties文件如下,并且和此jsp在相同的web站台下:
Str1=Hello
Str2=My name is Bunny
可是运行却出现了以下异常:
HTTP Status 500 - --------------------------------------------------------------------------------type Exception reportmessage description The server encountered an internal error () that prevented it from fulfilling this request.exception org.apache.jasper.JasperException: jsp.error.beans.property.conversion
org.apache.jasper.runtime.JspRuntimeLibrary.getValueFromPropertyEditorManager(JspRuntimeLibrary.java:931)
org.apache.jsp.fmt_jsp._jspx_meth_fmt_message_0(fmt_jsp.java:76)
org.apache.jsp.fmt_jsp._jspService(fmt_jsp.java:53)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
note The full stack trace of the root cause is available in the Tomcat logs.
--------------------------------------------------------------------------------Apache Tomcat/5.0.16
请问是怎么回事啊?

解决方案 »

  1.   

    在web.xml文件中配置
    <context-param>
        <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
        <!--假如message.properties放在classes目录的resources包中-->
        <param-value>resources.message</param-value>
      </context-param>在jsp中使用<fmt:message key="str1"/>即可
      

  2.   

    请问你用的struts是1.0还是1.1,1.0版还没有message标签,1.1以上才有。具体可以查看struts-config.xml中DTD文件。