jsp代码如下:
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib uri="struts-bean" prefix="bean" %>
<%@taglib uri="struts-html" prefix="html" %>
<%@taglib uri="struts-logic" prefix="logic" %><html:html locale="true">  <head>
    <title><bean:message key="hello.jsp.title"/></title>
    <htmlbase/>
  </head>  <body bgcolor="white">
    <h2>
     <bean:message key="hello.jsp.page.heading"/>
   </h2>
  <html:errors/>
    <logic:present name="personbean" scope="request">
    <h2>
     <bean:message key="hello.jsp.page.hello"/>
     <bean:write name="personbean" property="userName"/>!
    </h2>
</logic:present>
   <html:form action="/HelloWorld.do" focus="userName">
      <bean:message key="hello.jsp.prompt.person"/>
      <html:text property="userName" size="16" maxlength="16"/><br>
      <html:submit property="submit" value="submit"/>
   <html:reset/>
  </html:form>

  </body>
</html:html>
----------------------
在tomcat下运行。
运行服务,在打开此页时报:
Unable to find setter method for attribute: locale
错误。
在线等。分少的话可以再加

解决方案 »

  1.   

    你看一下在formbean里是否有set,get方法
    或者你将set,get先删掉,重新写一次
      

  2.   

    檢查一下你的personbean,是屬性設置getter和setter的問題
      

  3.   

    Endless_sin() ( )  
     
       你看一下在formbean里是否有set,get方法
    或者你将set,get先删掉,重新写一次
    -------------------formbean 有get set方法
    我的get set 方法是由Eclipse生成的.要不要把此formbean贴出来?试过了还是这样
      

  4.   

    galant2008(無賴) 你是说检查personbean类么?
      

  5.   

    beand的set get方法 参数写成String 看看
      

  6.   

    locale="true"
    去掉试试,那个是struts1.1的东西了
      

  7.   

    找不到setter
    可能是config-struts.xml設置有錯誤
      

  8.   

    希望大家共同学习.....
    欢迎高手加入!!!!!!!!!!!!!QQ群:
       唯爱J2EE(java开发):14402276(人员已满)
       唯爱J2EE(二群):15472518(人员已满)
       唯爱J2EE(WEB):33308970(招人)
      
    ********************不要重复加入,谢谢**************************
    此群只加J2EE方面的人才与高手...或搞JAVA 一年以上的.....其他人不加........加群时,,注明:J2EE方面的技术体系,,,如:Struts,Spring,Hibenate,EJB,JSF,Ajax,Oracle,Weblogic等有关技术,方能通过....
      

  9.   

    locale="true"
    应该是加载本地语言的问题
    解决办法我不知道,期待高手
      

  10.   

    重新对config-struts.xml設置看看。一个form里多少参数定义好,这个form对应的action对应关系也设置好
      

  11.   

    多谢: buyaowen(外包需要掌握三点)
    locale="true"
    去掉试试,那个是struts1.1的东西了 提供解决办法.去掉之后已经可以正常使用了.