不明白楼主说什么,是要标签的方式实现呢,还是要JavaScript方式实现?p.s.:程序员的表达能力为什么都这么差?

解决方案 »

  1.   

    我是个struts的初学者,我想问一下,如果用纯html写的Jsp代码可以用struts的框架的标记实现javascript的自动验证吗?还是必须自己写javascript来实现啊
      

  2.   

    还是不太明白你的意思,下面不知道是不是你想要的,可以在action中进行数据校验,然后将校验或者异常结果写入到Errors中ActionErrors errors = new ActionErrors();
    errors.add("system_error", new ActionMessage("error.sys_error"));
    request.setAttribute(Globals.ERROR_KEY, errors); //其中error.sys_error是通过properties文件读取的jsp通过
    <html:errors bundle="err" property="system_error"/>就可以显示上面的异常信息啦
      

  3.   

    我想把那个错误信息显示在javascript的提示框里,并且实现了框架的客户端自动验证
    如果我用struts的标记库写这个login.jsp
    <%@ page language="java" pageEncoding="GBK"%><%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
    <%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
    <%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
    <%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html:html lang="true">
      <head>
        <html:base />
        
        <title>login.jsp</title> <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">    
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <!--
    <link rel="stylesheet" type="text/css" href="styles.css">
    -->  </head>
      
      <body>
        <html:form action="login.do" method="post" focus="name" onsubmit="return validateLoginForm(this)">
          <table border="0">
            <tr>
              <td>name:</td>
              <td><html:text property="name" /> <html:errors property="name"/></td>
            </tr>
            <tr>
              <td>Password:</td>
              <td><html:password property="password" /></td>
            </tr>
            <tr>
              <td colspan="2" align="center"><html:submit /></td>
            </tr>
          </table>
        </html:form>
        <html:javascript formName="loginForm"/>
      </body>
    </html:html>
    就可以实现,可是如果我把这文件紧用纯html,比如<html:form>我写为html<form>此功能就不实现
      

  4.   

    我现在想问的是在传统的html标记中,可以运用struts框架的客户端自动验证吗?
    也就是说在传统的传统的html页面中可以运用struts框架自动生成javascript吗?