JSP基本知识

来源:互联网 发布:c语言病毒代码最短 编辑:程序博客网 时间:2024/06/05 00:40

1.div模拟的hr

div.hr {
 margin-top:0px;
 margin-bottom:0px;
 border-top-width:1px;
 border-top-style:solid;
 border-top-color:#C7C7C7;
 background-color:#C7C7C7;
}

<hr>标签本身有缺陷

2.注意 <%@ page isELIgnored="true" %> 表示是否禁用EL语言,TRUE表示禁止.FALSE表示不禁止.JSP2.0中默认的启用EL语言。

EL表达式最常用在给JS方法传值。EL表达式不属于任何框架,属于SUN指定的一套标准。具体用法参照下面2个例子:

(1).<input type="button" onclick="methodName('${formName.propertyName}')" />

(2).<script language="text/script">

                  alert("${formName.propertyName}");

      </script>

3.div { word-wrap: break-word; word-break: break-all; }

word-wrap控制是否换行,换行使用word-wrap: break-word;

word-break控制换行方式:break-all是英文断词。

综上:仅存在汉字的情况下,使用word-wrap: break-word;word-break:normal;

          存在超出长度的英文单词的情况下,使用word-wrap: break-word;word-break:break:-all;

word-wrap: break-word;word-break:normal;这种情况下,超出长度的英文依然会顶开容器边界

4.struts常用标签

例子:

①<logic:notEmpty name = "HDS_FC_B1_02SearchForm"  property="message">

②<logic:iterate id="detailBean"  name = "HDS_FC_B1_02SearchForm" property="downloadList" indexId="index">

其中indexId中的index可以拿去使用(在JAVA语言中)

③<logic:equal value="eng" name="user" property="languageCode">  

5.String path = request.getContextPath();
   String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";(此时到达了webContent目录)

6.防止双重提交

var isClicked = false;
 var hmfw_isLoaded = false;

   function hmfw_checkScreenLoading(){
    if(hmfw_isLoaded){
      return true;
    }else{
      alert(document.getElementById("screenLoadMsg").value);
      return false;
    }
   }

 

function checkDoubleClick(obj) {
    if(downFlag){
     isClicked = false;
     return true;
    }
    if (isClicked) {
     alert(document.getElementById("doubleClickMsg").value);
     return false;
    } else {  
     isClicked = true;
     return true;
    }
   }

   function hmfw_onSubmit(obj){
    if(!hmfw_checkScreenLoading()){return false;}
    if(!checkDoubleClick()){return false;} 
    return true;
   }

onsubmit="return hmfw_onSubmit(this);"

form的onsubmit="return checkDoubleClick(this.id);"

7.禁止画面上右击按钮

document.oncontextmenu = new Function("return false;");

8.nowrap 属性规定表格单元格中的内容不换行。

<td width="6%" align= "center" nowrap="nowrap">

9.JS方法调用小规则(就近原则)

function method1(){}

function method1(){}

<input type="button" onclick="method1();">

此时点击该按钮,将会调用位置上离它较近的method1()