我在<html:form>里加了onsubmit=...后,jsp页面上的表单的内容就不显示了。详细如下。<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" %>
<%@page contentType="text/html"%>
<%@page pageEncoding="gb2312"%>
<html><head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>员工所属添加(新增)</title></script>
</head><body><hr>
<p align="center">员工所属添加(新增)</p>
<hr>
<p>请输入以下项目(*为必选项目)</p>
<html:errors/>
<html:javascript formName="SearchForm"  />
<html:form action="sinki_baocun.do"  onsubmit="return validateSearchForm(this)">//调试的时候,发现只执行到上面这一行。
    
<table border="0" width="100%" id="table1">
    <tr>
        <td width="138" bgcolor="#C0C0C0">姓名(汉字)*</td>
        <td><html:text property="name" size="20"/>(不超过10文字)</td>
    </tr>
    <tr>
        <td width="138" bgcolor="#C0C0C0">拼音*</td>
        <td><html:text property="pinyin" size="20" value=""/>(不超过20字)</td>
    </tr>
    <tr>
        <td width="138" bgcolor="#C0C0C0">所属*</td>
        <td>
        <html:select  property="ju" value="0" >
             <html:options  collection="ju_list" property="id" labelProperty="name"/>
        </html:select>局 
        <html:select  property="bu" value="0" >
             <html:options  collection="bu_list" property="id" labelProperty="name"/>
        </html:select>部 
        <html:select  property="ke" value="0" >
             <html:options  collection="bu_list" property="id" labelProperty="name"/>
        </html:select>科</td>
    </tr>
    <tr>
        <td width="138" bgcolor="#C0C0C0">性别</td>
         <td>
         <html:select property="sex" value="0">
         <html:option value="0">---</html:option>   
         <html:option value="1">male</html:option>
         <html:option value="2">female</html:option>
        </html:select></td>
    </tr>
    <tr>
        <td width="138" bgcolor="#C0C0C0">入职年月</td>
        <td><input type="text" name="ymd" size="20"> (YYYY/MM/DD)</td>
    </tr>
    <tr>
        <td colspan="2"> </td>
    </tr>
    <tr>
        <td height="28" colspan="2">
        <p align="center">
       <html:submit value="确定"/>
        <input type="submit" value="返回"  onclick="javascript:window.history.go(-1)"></td>
    </tr>
</table>
</html:form></body></html>
请帮忙,谢谢。

解决方案 »

  1.   

    补充一下,只执行到<html:form action="sinki_baocun.do"  onsubmit="return validateSearchForm(this)">后就到最后了,不报错。所以页面虽然显示出来了,但只有上面的标题。
      

  2.   

    你在</html:form>后面(也可能是前面,我记不太清了)加这么一句<html:javascript formName="validateSearchForm()/>试试
      

  3.   

    加上form bean是么?我在前面已经有了<html:javascript formName="SearchForm"  />
      

  4.   

    搞定!Struts-config.xml里面的action属性里面忘记加上name="SearchForm"了。