jsp·ÖÒ³
ÉÏ¿ÎÀÏʦ½²½âÁËjsp·ÖÒ³ £¬¹ØÓÚ¼ÆËã×ÜÒ³Êý
ËûµÄËã·¨ÊÇ totalPage=(totalRecords+pageSize-1)/pageSize; Ëû˵Èç¹û²»ºÃÀí½â£¬¾ÍÓà i f else Åжϡ£
Ï¿ο´Êé
żȻÏëÆðÁËÒÔÇ°£¬µÄÒ»¸öËã·¨
totalPage=(totalRecords%pageSize==0)? (totalRecords/pageSize): ((totalRecords/pageSize)+1);
¸Ð¾õ ÏÂÃæµÄÒ»¸öºÃÀí½âµã ............ºÇºÇ £¬Èç¹û×ܼǼÊý³ýÒÔ Ã¿Ò»Ò³µÄ¼Ç¼Êý¾ÍÈ¡ ×ÜÒ³ÊýtotalRecords/pageSize £¬·ñÔòÈ¡ ((totalRecords/pageSize)+1¡£
´úÂ룺
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>ÎÞ±êÌâÎĵµ</title>
</head>
<body>
<%
int currentPage=1;
int totalPage=1;
int pageSize=20;
int totalRecords=0;
String page1=request.getParameter("page");
if(page1==null||page1.equals(""))
{
currentPage=1;
}
else
{
currentPage =Integer.parseInt(page1);
}
// ÓôÃÆ £¡£¡£¡ ¿ªÊ¼µÄʱºò£¬Á¬½ÓÀÏÊdzö´í£¬°¦£¬ ÏÖÔÚ²»ÅäÖÃÊý¾ÝÔ´ÁË ËµÈ±ÉÙÇý¶¯¡££¬Ö±½ÓÕâÑù³É¹¦//ÁË¡£
String sql="select count(*) from stu";
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:driver={Microsoft Access Driver (*.mdb)};DBQ=c:\\test.mdb");
Statement stmt=con.createStatement();
ResultSet rs=stmt.executeQuery(sql);
rs.next();
totalRecords=rs.getInt(1);
//totalPage=(totalRecords+pageSize-1)/pageSize;
totalPage=(totalRecords%pageSize==0)? (totalRecords/pageSize): ((totalRecords/pageSize)+1);
&nb
Ïà¹ØÎĵµ£º
½â¾öjsp»òserverlet ²»ÄܽâÎömultipart/form-data ÀàÐÍµÄ±íµ¥ÓòµÄÎÊÌâ
10 6ÔÂ 2008
Situation:
Javax.servlet.HttpServletRequest.getParameter(String) returns null when the ContentType is multipart/form-data
Solutions:
Solution A:
1. download http://www.servlets.com/cos/index.html
2. invoke getPara ......
֮ǰ,д¹ýÒ»¸öDownload.jspÎļþ,Äܽâ¾öÏÂÔØÎļþÂÒÂëÎÊÌâ(ÖîÈç:DOC,XSLÎļþµÈµÈ).
ºóÀ´·¢ÏÖ,Óö¼ûÖÐÎÄÃûµÄÎļþµÄʱºò,ÎļþÏÂÔؽ«»á±¨´í~~~~
½ñÌì,ͨ¹ý¸ÄдÔDownload.jspÎļþÒÑÍêÈ«½â¾öÁËÕâ¸öÎÊÌâ~
Ä¿Ç°,°ÑÒ»ÕûÌ×µÄÎļþÉÏ´«ÏÂÔصķ½·¨¸øÌù³öÀ´~~~ÒÔ±ã´ó¼Ò½è¼ø!~!~!~!~!
×÷Õß:¹Å°£¼°·¨ÀÏ
------------------------ ......
¡¡ÏÖÔÚÓкöà³õѧjspµÄÍøÓѾ³£»áÎÊÊý¾Ý¿âÔõôÁ¬½Ó°¡£¬ÔõôÀϳö´í°¡£¿ËùÒÔÎÒ¼¯ÖеÄÔÚÕâдƪÎÄÕ¹©´ó¼Ò²Î¿¼£¬ÆäʵÕâÖÖ°ÑÊý¾Ý¿âÂ߼ȫ²¿·ÅÔÚjspÀïδ±ØÊǺõÄ×ö·¨£¬µ«ÊÇÓÐÀûÓÚ³õѧÕßѧϰ£¬ËùÒÔÎÒ¾ÍÕâÑù×öÁË£¬µ±´ó¼Òѧµ½Ò»¶¨³Ì¶ÈµÄʱºò£¬¿ÉÒÔ¿¼ÂÇÓÃMVCµÄģʽ¿ª·¢¡£ÔÚÁ·Ï°ÕâЩ´úÂëµÄʱºò£¬ÄãÒ»¶¨½«jdbcµÄÇý¶¯³ÌÐò·Åµ½·þÎñÆ÷µÄÀà ......
MyEclipse±à¼JspËÀ»úÎÊÌâ
Õâ¸öÎÊÌâµÄÈ·ºÜ·³ÈË£¬Æäʵ¶¼ÊÇMyEclipseµÄ“×Ô×÷´ÏÃ÷”ºÍ·ÃÎÊÍøÂçÉϵÄAPI DocµÄ½á¹û£¨ËüĬÈÏÓÃVisual DesignerÀ´´ò¿ªµÄ£©£¬½øÐÐÏÂÁÐÉèÖü´¿ÉÓÐЧ»º½âÖ®¡£
1. ҪôÓÒ¼üµ¥»÷Îļþ£¬Ñ¡Ôñ Open With -¡· MyEclipse JSP Editor ´ò¿ª£¬ÕâÑù²»»á²ÉÓÿÉÊÓ»¯µÄ´ò¿ª£¬ºÄ×ÊÔ´ÉÙ£¬×Ô¶¯ÌáʾҲ·Ç³£¿ì ......
Jsp ELÓï·¨
Àý£º
${sessionScope.user.sex}
ËùÓÐEL¶¼ÊÇÒÔ ${ ΪÆðʼ¡¢ÒÔ} Ϊ½áβµÄ¡£
ÉÏÊöEL·¶ÀýµÄÒâ˼ÊÇ£º´ÓSessionÈ¡µÃÓû§µÄÐÔ±ð¡£Èç¹ûʹÓÃ֮ǰJSP´úÂëµÄд·¨ÈçÏ£º
<%
User user = (User)session.getAttribute(”user”);
String sex = user.getSex( );
%>
Á½ÕßÏà±È½Ï֮ϣ¬¿ÉÒÔ·¢ÏÖELµÄÓï·¨± ......