当前位置: 代码迷 >> Web前端 >> web开发学习札记
  详细解决方案

web开发学习札记

热度:138   发布时间:2012-11-25 11:44:31.0
web开发学习笔记

1、mysql分页.MySQL中一般的分页作法大多利用Limit限制回传的资料笔数来达成分页效果
例如下面的代码
Select * From news limit 0, 100第一页
Select * From news limit 100,100第二页
Select * From news limit 200,100第三页

2、jsp分页显示。

???

< body> < table border="1" cellspacing="0" cellpadding="0">
 < tr> < th>姓名< /th> < /tr> 
< % if(intPageCount>0) 
 {  //将记录指针定位到待显示页的第一条记录上  sqlRst.absolute((intPage-1) * intPageSize + 1);  //显示数据  i = 0; 
 while(i< intPageSize && !sqlRst.isAfterLast()){ %> < tr> < td> < %=sqlRst.getString(1)%> 
< /td> < /tr> < % sqlRst.next();  i++;  }  }  %> < /table> 第< %=intPage%>页 共< %=intPageCount%>页  
< %if(intPage< intPageCount){%>< a href="mysqlpage.jsp?page=< %=intPage+1%>">下一页< /a>< %}%> < %if(intPage>1){%>< a href="mysqlpage.jsp?page=< %=intPage-1%>">上一页< /a>< %}%> < /body> 

?3.雅虎的几位工程师”Efficient Pagination Using MySQL“的报?告:http://www.percona.com/ppc2009/PPC2009_mysql_pagination.pdf

?

4.tomcat路径中的空格害死人:导致部署时struts2(v2.1.6)报错:

... initialized Struts-Spring integration successfully
 Exception starting filter struts2
java.lang.NullPointerException
	at com.opensymphony.xwork2.util.FileManager$FileRevision.needsReloading(FileManager.java:209)
	at com.opensymphony.xwork2.util.FileManager.fileNeedsReloading(FileManager.java:60)
	at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.needsReload(XmlConfigurationProvider.java:325)
	at org.apache.struts2.config.StrutsXmlConfigurationProvider.needsReload(StrutsXmlConfigurationProvider.java:168)
	at com.opensymphony.xwork2.config.ConfigurationManager.conditionalReload(ConfigurationManager.java:220)
	at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:61)
	at org.apache.struts2.dispatcher.Dispatcher.getContainer(Dispatcher.java:774)
	at org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:191)
	at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:221)
	at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:302)
	at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:78)
	at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3666)
	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4258)
	at org.apache.catalina.manager.ManagerServlet.start(ManagerServlet.java:1173)
	at org.apache.catalina.manager.HTMLManagerServlet.start(HTMLManagerServlet.java:549)
	at org.apache.catalina.manager.HTMLManagerServlet.doGet(HTMLManagerServlet.java:105)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:627)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:563)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:879)
	at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
	at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
	at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
	at java.lang.Thread.run(Thread.java:619)
  相关解决方案