jsp ²É¼¯ С͵³ÌÐò
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ page import="java.io.*,java.net.URL"%>
<%
URL url = new URL("http://www.itpub.net");//½¨Á¢URL¶ÔÏ󣬲¢ÊµÀý»¯Îªurl£¬»ñµÃҪץȡµÄÍøÒ³µØÖ·
BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream(),"GB2312"));//½¨Á¢BufferedReader¶ÔÏ󣬲¢ÊµÀý»¯Îªreader£¬ÕâÀïµÄGB2312ÊÇҪץȡµÄÍøÒ³±àÂë¸ñʽ
while(reader.ready())
{
out.println(reader.readLine());
}
reader.close();
%>
public static String matcherStr(String str, String cp, String s){
if(str==null || str.equals("")){
return "";
}
String txt = new String();
txt = str;
if(str!=null && !str.equals("")){
txt = str;
Pattern p = Pattern.compile(cp,2); //²ÎÊý2±íʾ´óСд²»Çø·Ö
Matcher m = p.matcher(txt);
StringBuffer sb = new StringBuffer();
int i=0;
boolean result = m.find();
//ʹÓÃÑ»·½«¾ä×ÓÀïËùÓÐÆ¥ÅäµÄÄÚÈÝÕÒ³ö²¢Ìæ»»ÔÙ½«ÄÚÈݼӵ½sbÀï
while(result) {
i++;
sb.append(m.group());
sb.append(s);
//¼ÌÐø²éÕÒÏÂÒ»¸öÆ¥Åä¶ÔÏó
result = m.find();
}
txt = String.valueOf(sb);
}else{
txt = "";
}
return txt;
}
Ïà¹ØÎĵµ£º
ÉÏ¿ÎÀÏʦ½²½âÁËjsp·ÖÒ³ £¬¹ØÓÚ¼ÆËã×ÜÒ³Êý
ËûµÄËã·¨ÊÇ totalPage=(totalRecords+pageSize-1)/pageSize; Ëû˵Èç¹û²»ºÃÀí½â£¬¾ÍÓà i f else Åжϡ£
Ï¿ο´Êé
żȻÏëÆðÁËÒÔÇ°£¬µÄÒ»¸öËã·¨
totalPage=(totalRecords%pageSize==0)? (totalRecords/page ......
JSP ÈçºÎʵÏÖÍøÒ³¶¨Ê±Ìøת:
<script language="javascript">
<!--
setTimeout("document.location.href='http://www.163.com'",3000);
//-->
</script>
ˢУº
<meta http-equiv="Refresh" content ......
JSP ʵÔÚservlet Ö®ºó·¢Õ¹ÆðÀ´µÄ¼¼Êõ¡£
ÔËÐлúÖÆ£º
1£ºjspÎļþÌá½»·þÎñÆ÷£¬·þÎñÆ÷ £¨Tomcat£©£¬³õʼ»¯ ÇëÇóºÍÏìÓ¦¶ÔÏó £¬È»ºóÅжÏjspÎļþÊÇ·ñ´æÔÚ £¬Èç¹û²»´æÔÚ 404 ´íÎ󣬴æÔÚ £¬±àÒë³ÉΪ ¡£java Îļþ ----¡·¡£class Îļþ ¡£¾ÍÊÇÒ»¸öjavaµÄÀà £¬Õâ¸öÀà £¬¼Ì³Ð×Ô httpjspbase £¬Õâ¸öhttpjsppageÀà ÓÖ ÊµÏÖÁË» ......
ÎÒÃǶ¼ÖªµÀÔÚjspÖÐincludeÓÐÁ½ÖÖÐÎʽ,·Ö±ðÊÇ
< %@ include file=” ”%>
< jsp:include page=” ” flush=”true”/>
¡¡¡¡Ç°ÕßÊÇÖ¸ÁîÔªËØ¡¢ºóÕßÊÇÐÐΪԪËØ¡£¾ßÌåËüÃǽ«Ôںδ¦Óã¿ÈçºÎÓü°ËüÃÇÓÐʲôÇø±ð£¿ÕâÓ¦¸ÃÊǺܶàÈË¿´µ½Ëü¶¼»áÏëµ½µÄÎÊÌâ¡£ÏÂÃæÒ»ÆðÀ´¿´¿´°É¡£
¡ ......
±¾µØÓõÄÊÇtomcat6£¬ÔËÐÐÒ»Çж¼Õý³£¡£°Ñϵͳ²¿µ½Ô¶³ÌÉÏʱºò±¨Õâ¸ö´íÎó£º Syntax error on token "<", invalid AssignmentOperator
Syntax error on token "<", invalid AssignmentOperator
ÔÚÍøÉÏÕÒµ½ÔÒò£º
Õâ¸ö´íÎó¿ÉÄÜÊÇÒòΪÄãÔÚjspÖÐÓõ½ÁË·ºÐÍ¡£
°Ñ·ºÐÍÈ¥µôÊÔÊÔ¾Í ......