Form '***' not found for locale 'zh _CN'

Form '***' not found for locale 'zh _CN' 

1、formName写的不对。其中form-beans里面的name,action-mapping里面,validation.xml里面的form的name都要保持一直。

2、忘记在validation.xml里面定义了验证内容,这样会出现,找不到要用的验证规则,提示错误。

 

都是新手容易出的问题。

 

错误之前的配置:

input.jsp

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" contentType="text/html; charset=utf-8" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>

<html:html xhtml="true" lang="true">
 <head>
   <title>input.jsp</title>
  
 </head>

<body>

<h1>  欢迎光临wd的提问版</h1><br />

<html:form action="/guestbook.do?method=save"  onsubmit="return validateguestbookForm(this)">
  <html:hidden  property="method" value="save" />
  <table width="572" border="0" bgcolor="#8080c0" align="left" height="144">
<tbody>
<tr>
<td bgcolor="#c0c0c0"> 问题标题:</td>
<td><html:text property="title" ></html:text></td>
</tr>
<tr>
<td borderColor="#ff0080" bgcolor="#008080">        
		你的名字:
		</td>
<td><html:text property="name" ></html:text><html:errors property="name" /></td>
</tr>
<tr>
<td>你的主页:</td>
<td><html:text property="url" ></html:text></td>
</tr>
<tr>
<td>你的邮件:</td>
<td><html:text property="email" ></html:text></td>
</tr>
<tr>
<td borderColor="#1f54e0" bgcolor="#c0c0c0">问题的内容:</td>
<td> <html:textarea property="content" ></html:textarea></td>

</tr>
<tr>
  <td valign="top">      		<html:submit value="提交">
           </html:submit> </td><td valign="top">  </td></tr>

</tbody>
</table>
<br />
	

      <html:javascript formName="guestbookForm" />  
</html:form>
</body>
</html:html>
 
validation.xml
<?xml version="1.0" encoding="utf-8" ?>

<!DOCTYPE form-validation PUBLIC
          "-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.1.3//EN"
          "http://jakarta.apache.org/commons/dtds/validator_1_1_3.dtd">

<form-validation>
    <global>
    	 <validator name="equalsCheck"
           	 	classname="struts.EqualsChecks"
               	method="equalsChecks"
        		 methodParams="java.lang.Object,
                       org.apache.commons.validator.ValidatorAction,
                       org.apache.commons.validator.Field,
                       org.apache.struts.action.ActionMessages,
                       org.apache.commons.validator.Validator,
                       javax.servlet.http.HttpServletRequest"
                  msg="errors.equalsCheck"/>  
    </global>
    <formset>
    
        <form name="inputForm">
			<field property="name" depends="required">
			    <arg1 name="minlength" key="login.username" resource="false" /> 
				
			</field>
 
   <!-- 			<field property="name" depends="required">
				<msg name="required" key="login.username"/>
			</field> -->
 
        </form>
    </formset>
</form-validation>
 
struts-config.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.3//EN" "http://struts.apache.org/dtds/struts-config_1_3.dtd">

<struts-config>

  <form-beans >
  
    <form-bean name="guestbookForm" type="org.apache.struts.validator.DynaValidatorForm">
      <form-property name="title" type="java.lang.String" />
      <form-property name="content" type="java.lang.String" />
      <form-property name="url" type="java.lang.String" />
      <form-property name="email" type="java.lang.String" />
      <form-property name="name" type="java.lang.String" />
    </form-bean>
    
  </form-beans>

  <global-exceptions />
  
  <global-forwards />
  
  <action-mappings > <!-- name="guestbookForm"       <form-bean name="guestbookForm"   -->
    <action
      attribute="guestbookForm"
      input="/input.jsp"
      name="guestbookForm"     
      parameter="method"
      path="/guestbook"
      scope="request"
      type="org.springframework.web.struts.DelegatingActionProxy"
      validate="false">
 



!!!!!!!!!! !!!! !!!!!!!!!! !!!! !!!!!!!!! !!!!!!!!!! !!!!!!!!!! !!!!!!!!! 





 <forward name="success" path="/MyJsp.jsp" />
      <forward name="fail" path="/jsp/inputfail.jsp" />
    </action>
  </action-mappings>

  <message-resources parameter="com.wd.web.ApplicationResources" />
  
  
  <!-- 注册validator 框架 -->
    <plug-in className="org.apache.struts.validator.ValidatorPlugIn">
      <set-property property="pathnames"
      			    value="/WEB-INF/validator-rules.xml,
      			           /WEB-INF/validation.xml"/>
      <set-property property="stopOnFirstError" value="false"/>
    </plug-in>
     
   <!--    <plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">-->
     <!--  <set-property property="contextConfigLocation" -->
      			  <!--   value="/WEB-INF/action-servlet.xml"/>   -->
    <!--   </plug-in>  -->

    
</struts-config>

 

validate-rules.xml  省略。。。

问题正在解决中 ~解决好了 在发正确的配置。。

你可能感兴趣的:(apache,html,jsp,xml,struts)