我用的常见的代码

时间:2021-08-09 05:31:20

1、html标签:<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>

2、 (1)关于提交:    function doSubmit(operate){
                                       document.forms[0].elements["operate"].value=operate;
                                       document.forms[0].submit();
                              }

      (2) 关于隐藏域:   <html:hidden property="operate" value=""/>

      (3) 关于按钮提交:<html:button property="" value="提交" onclick="doSubmit('doRegister')"></html:button>

3、跳转到修改页面:    <html:text property="student.id" value="${student.id}" readonly="true"></html:text>
                                 <html:text property="student.name" value="${student.name}"></html:text>    

4、弹框:  function doDelStudent(studentId){
                        if(confirm("删除吗?","消息!")){
                        window.location.href="studentAction.do?operate=doDelete&id="+studentId;
                  }
            }

   
 5、超链接: function doUpStudent(studentId){
               window.location.href="studentAction.do?operate=toEdit&id="+studentId;
           } 

      <a href="javascript:doDelStudent(${student.id })">删除</a>