jspÂÒÂë½â¾ö´óÈ«(ת×ÔcsdnÒ»¸ßÊÖ)
Ò»¡¢JSPÒ³ÃæÏÔʾÂÒÂë
¶þ¡¢±íµ¥Ìá½»ÖÐÎÄʱ³öÏÖÂÒÂë
Èý¡¢Êý¾Ý¿âÁ¬½Ó
´ó¼ÒÔÚJSPµÄ¿ª·¢¹ý³ÌÖУ¬¾³£³öÏÖÖÐÎÄÂÒÂëµÄÎÊÌ⣬¿ÉÄÜÒ»ÖÁÀ§ÈÅ×ÅÄú£¬ÎÒÏÖÔÚ°ÑÎÒÔÚJSP¿ª·¢ÖÐÓöµ½
µÄÖÐÎÄÂÒÂëµÄÎÊÌâ¼°½â¾ö°ì·¨Ð´³öÀ´¹©´ó¼Ò²Î¿¼¡£
Ò»¡¢JSPÒ³ÃæÏÔʾÂÒÂë
ÏÂÃæµÄÏÔÊ¾Ò³Ãæ(display.jsp)¾Í³öÏÖÂÒÂ룺
<html>
<head>
<title>JSPµÄÖÐÎÄ´¦Àí</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
<%
out.print("JSPµÄÖÐÎÄ´¦Àí");
%>
</body>
</html>
¶Ô²»Í¬µÄWEB·þÎñÆ÷ºÍ²»Í¬µÄJDK°æ±¾£¬´¦Àí½á¹û¾Í²»Ò»Ñù¡£ÔÒò£º·þÎñÆ÷ʹÓõıàÂ뷽ʽ²»Í¬ºÍä¯ÀÀÆ÷
¶Ô²»Í¬µÄ×Ö·ûÏÔʾ½á¹û²»Í¬¶øµ¼Öµġ£½â¾ö°ì·¨£ºÔÚJSPÒ³ÃæÖÐÖ¸¶¨±àÂ뷽ʽ(gb2312),¼´ÔÚÒ³ÃæµÄµÚÒ»
ÐмÓÉÏ£º<%@ page contentType="text/html; charset=gb2312"%>£¬¾Í¿ÉÒÔÏû³ýÂÒÂëÁË¡£ÍêÕûÒ³ÃæÈçÏÂ
£º
<%@ page contentType="text/html; charset=gb2312"%>
<html>
<head>
<title>JSPµÄÖÐÎÄ´¦Àí</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
<%
out.print("JSPµÄÖÐÎÄ´¦Àí");
%>
</body>
</html>
¶þ¡¢±íµ¥Ìá½»ÖÐÎÄʱ³öÏÖÂÒÂë
ÏÂÃæÊÇÒ»¸öÌá½»Ò³Ãæ(submit.jsp)£¬´úÂëÈçÏ£º
<html>
<head>
<title>JSPµÄÖÐÎÄ´¦Àí</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
<form name="form1" method="post" action="process.jsp">
<div align="center">
<input type="text" name="name">
<input type="submit" name="Submit" value="Submit">
</div>
</form>
</body>
</html>
ÏÂÃæÊÇ´¦ÀíÒ³Ãæ(process.jsp)´úÂ룺
<%@ page contentType="text/html; charset=gb2312"%>
<html>
<head>
<title>JSPµÄÖÐÎÄ´¦Àí</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
<%=request.getParameter("name")%>
</body>
</html>
Èç¹ûsubmit.jspÌá½»Ó¢ÎÄ×Ö·ûÄÜÕýÈ·ÏÔʾ£¬Èç¹ûÌá½»ÖÐÎÄʱ¾Í»á³öÏÖÂÒÂ
Ïà¹ØÎĵµ£º
//×ܼǼÊý
int count = personDao.getCount();
//ÿҳÏÔʾ5Ìõ
int pageSi ......
ÓõÄÊý¾Ý¿âÊÇmysql
¡¾µÚÒ»ÖÖ·½Ê½£¬ÓÃJSPʵÏÖ¡¿
<%@ page contentType="text/html; charset=gb2312" language="java"
import="java.sql.*"%>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<%
//**************************************
& ......
Õâ¸öÎÊÌâµÄÈ·ºÜ·³ÈË£¬Æäʵ¶¼ÊÇMyEclipseµÄ"×Ô×÷´ÏÃ÷"ºÍ·ÃÎÊÍøÂçÉϵÄAPI DocµÄ½á¹û£¨ËüĬÈÏÓÃVisual DesignerÀ´´ò¿ªµÄ£©£¬½øÐÐÏÂÁÐÉèÖü´¿ÉÓÐЧ»º½âÖ®¡£
1. ҪôÓÒ¼üµ¥»÷Îļþ£¬Ñ¡Ôñ Open With -¡· MyEclipse JSP Editor ´ò¿ª£¬ÕâÑù²»»á²ÉÓÿÉÊÓ»¯µÄ´ò¿ª£¬ºÄ×ÊÔ´ÉÙ£¬×Ô¶¯ÌáʾҲ·Ç³£¿ì¡£
2. Ҫô²ÉȡһÀÍÓÀÒݵķ½·¨ Window ......
import java.util.ArrayList;
import java.util.List;
public class FenYe
{
static double allpage=0; //×ÜÒ³Êý
static double currpage=0; //µ±Ç°Ò³
static double pagesize=10; //ÏÔʾÐÐ
static int sta ......
Ò»£ºµ½http://tuckey.org/urlrewrite/ ÏÂÔØurlrewrite¼Ü°ü£¨ÍƼö2.6.0£©
¡¡¡¡¶þ£º½âѹËùÏÂÔØµÄÎļþ,°Ñurlrewrite-2.6.0.jar¸´ÖƵ½ÏîÄ¿µÄWebRoot/WEB-INF/lib/Ŀ¼ÏÂ
¡¡¡¡Èý£º°Ñurlrewrite.xml¸´ÖƵ½ÏîÄ¿µÄWebRoot/WEB-INF/Ŀ¼ÏÂ
¡¡¡¡ËÄ£ºÔÚweb.xmlÎļþÖмÓÈëÒÔÏÂ
¡¡¡¡<filter>
¡¡¡¡<filter-name>Ur ......