jsp ÑéÖ¤
³¤¶ÈÏÞÖÆJavaScript´úÂë
CODE:
<script> function test() { if(document.a.b.value.length>50) { alert("²»Äܳ¬¹ý50¸ö×Ö·û£¡"); document.a.b.focus(); return
false; } } </script> <form. name=a nsubmit="return test()"> <textarea name="b" cols="40" wrap="VIRTUAL" rows="6"></textarea> <input type="submit" name="Submit" value="check">
</form>2. Ö»ÄÜÊǺº×Ö
JavaScript´úÂë
CODE:
<input nkeyup="value="/oblog/value.replace(/[^\u4E00-\u9FA5]/g,'')">3." Ö»ÄÜÊÇÓ¢ÎÄ
JavaScript´úÂë
CODE:
<script. language=javascript> function onlyEng() { if(!(event.keyCode>=65&&event.keyCode<=90)) event.returnvalue=false; } </script>
<input nkeydown="onlyEng();">4. Ö»ÄÜÊÇÊý×Ö
JavaScript´úÂë
CODE:
<script. language=javascript> function onlyNum() { if(!((event.keyCode>=48&&event.keyCode<=57)||(event.keyCode>=96&&event.keyCode<=105))) //¿¼ÂÇС¼üÅÌÉϵÄÊý×Ö¼ü
event.returnvalue=false; } </script>
<input nkeydown="onlyNum();">5. Ö»ÄÜÊÇÓ¢ÎÄ×Ö·ûºÍÊý×Ö
6. ÑéÖ¤ÓÍÏä¸ñʽ
JavaScript´úÂë
CODE:
<SCRIPT. LANGUAGE=javascript. RUNAT=Server> function isEmail(strEmail) { if (strEmail.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1) return
true; else
alert("oh"); } </SCRIPT>
<input type=text nblur=isEmail(this.value)>7. ÆÁ±Î¹Ø¼ü×Ö(ÕâÀïÆÁ±Î***ºÍ****)
JavaScript´úÂë
CODE:
<script. language="javascript1.2"> function test() { if((a.b.value.indexOf ("***") == 0)||(a.b.value.indexOf ("****") == 0)){ alert(":)"); a.b.focus(); return
false;} } </script> <form. name=a nsubmit="return test()"> <input type=text name=b> <input type="submit" name="Submit" value="check"> </form> 8. Á½´ÎÊäÈëÃÜÂëÊÇ·ñÏàͬ
JavaScript´úÂë
CODE:
<FORM. METHOD=POST ACTION=""> <input type="password" id="input1"> <input type="password" id="input2"> <input type="button" value="test" ncli
Ïà¹ØÎĵµ£º
Ô´³ÌÐò
<%String sConn="ÄãµÄÁ¬½Ó"
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection conn=DriverManager.getConnection(sConn,"ÄãµÄÓû§Ãû","ÃÜÂë");
Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
Statement stmtcount=conn.createStat ......
JSPÖеÄÌøת£º
(1). forward()·½·¨
ʹÓõ½javax.servlet.RequestDispatcherÀà
RequestDispatcher rd = getServletContext().getRequestDispatcher("url");
rd.forward(requestVar,requestVar); //´«µÝservletµÄÈë¿Ú²ÎÊý
/*forwardº ......
Àý×Ó˵Ã÷£ºÕâÀý×ÓÊÇѧÉú»ù±¾ÐÅÏ¢µÄÊäÈëÒÔ¼°Êä³öÏÔʾ;ÓÐÁ½¸öÒ³Ã棺info.jspºÍshowInfo.jsp£¬Ç°ÕßÊǹ˿ÍÊäÈëµÄÐÅÏ¢Ò³Ã棬¶øºóÕßÊÇ´¦ÀíÐÅÏ¢µÄÒ³Ãæ¡£
info.jsp
<%@page contentType="text/html;charset=gb2312"%>
<HTML>
<HEAD>
<TITLE>ÊäÈëѧ ......
Ò»¡¢JSPµÄ¼¼ÊõÔÀí
¶þ¡¢JSPµÄ×¢ÊͺÍÉùÃ÷
JSP×¢ÊÍÓÃÓÚ±íÃ÷ÔÚ³ÌÐò¿ª·¢¹ý³ÌÖеĿª·¢Ìáʾ£¬²»»áÊä³öµ½¿Í»§¶Ë£»
<%--×¢ÊÍÄÚÈÝ--%> —— JSP×¢ÊÍ
<£¡--×¢ÊÍÄÚÈÝ--£¡> —&md ......
Ò»¡¢JSPÒ³ÃæÏÔʾÂÒÂë
¶þ¡¢±íµ¥Ìá½»ÖÐÎÄʱ³öÏÖÂÒÂë
Èý¡¢Êý¾Ý¿âÁ¬½Ó
´ó¼ÒÔÚJSPµÄ¿ª·¢¹ý³ÌÖУ¬¾³£³öÏÖÖÐÎÄÂÒÂëµÄÎÊÌ⣬¿ÉÄÜÒ»ÖÁÀ§ÈÅ×ÅÄú£¬ÎÒÏÖÔÚ°ÑÎÒÔÚJSP¿ª·¢ÖÐÓöµ½
µÄÖÐÎÄÂÒÂëµÄÎÊÌâ¼°½â¾ö°ì·¨Ð´³öÀ´¹©´ó¼Ò²Î¿¼¡£
Ò»¡¢JSPÒ³ÃæÏÔʾÂÒÂë
ÏÂÃæµÄÏÔʾҳÃæ(display.jsp)¾Í³öÏÖÂÒÂ룺
<html>
<head>
<tit ......