错误信息:
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: Exception in JSP: /form/hello.jsp:1411: 
12:     <h2><bean:message key="hello.jsp.page.heading"/></h2><p>
13: 
14:    <html:errors/><p> 
15: 
16:     <logic:present name="personbean" scope="request">
17:        <h2>以下是hello.jsp代码
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %><html:html locale="true">
  <head>
    <title><bean:message key="hello.jsp.title"/></title>
    <html:base/>
  </head>
  <body bgcolor="white"><p>    <h2><bean:message key="hello.jsp.page.heading"/></h2><p>   <html:errors/><p>     <logic:present name="personbean" scope="request">
       <h2>
         <bean:message key="hello.jsp.page.hello"/>
         <bean:write name="personbean" property="userName" />!<br>
       </h2>
    </logic:present>    <html:form action="/hello.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><br>    <html:img page="/struts-power.gif" alt="Powered by Struts"/>  </body>
</html:html>
以下是配置文件信息:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd"><struts-config>
  <data-sources />
  <form-beans >
    <form-bean name="helloForm" type="com.kook.struts.form.HelloForm" />  </form-beans>  <global-exceptions />
  <global-forwards />
  <action-mappings >
    <action
      attribute="helloForm"
      input="/form/hello.jsp"
      name="helloForm"
      path="/hello"
      scope="request"
      validate="true"
      type="com.kook.struts.action.HelloAction">
      <forward name="SayHello" path="/form/hello.jsp"/>
    </action>  </action-mappings>  <message-resources parameter="com.kook.struts.ApplicationResources" />
</struts-config>以下是helloForm的验证方法:
public ActionErrors validate(ActionMapping mapping,
                                 HttpServletRequest request) {        ActionErrors errors = new ActionErrors();        if ((userName == null) || (userName.length() < 1))
        {
            errors.add("username", new ActionMessage("hello.no.username.error"));
        }
        return errors;
    }请高手帮忙,已经郁闷一个下午了~小弟在此拜谢了~

解决方案 »

  1.   

    第四行不是那行
    看看work目录下的文件
      

  2.   

    flyingdancing2005(游戏人生) 兄弟,不明白你说的意思啊,能具体点么? 我在线
      

  3.   

    将   errors.add("username", new ActionMessage("hello.no.username.error"));
    改为    errors.add("username", new ActionError("hello.no.username.error"));
    试试
      

  4.   

    谢谢楼上的弟兄们,用teddys() 的方法问题解决了.
    不过新的问题又来了
    errors.add("username", new ActionMessage("hello.no.username.error"));
    与errors.add("username", new ActionError("hello.no.username.error"));
    有什么分别??