news0202.jsp
上传用户:xiao85513
上传日期:2010-01-11
资源大小:2160k
文件大小:1k
源码类别:

手机WAP编程

开发平台:

Java

  1. <%@ page contentType="text/vnd.wap.wml" import="java.sql.*" language="java"%> <?xml version="1.0" encoding="gb2312"?> <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"                      "http://www.wapforum.org/DTD/wml_1.1.xml">
  2. <wml> <head> <meta forua="true" http-equiv="Cache-Control" content="max-age=0"/> </head> <card id="news" title="news" newcontext="true">
  3. <do type="prev" name="Prev" label="Back"><prev/></do>
  4. <%Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
  5.   String url="jdbc:microsoft:sqlserver://172.0.0.1;DatabaseName=herald";
  6.   String user="sa";
  7.   String password="kurtCobain4551306";
  8.   Connection conn=DriverManager.getConnection(url,user,password);
  9.   Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
  10.   String sql="select top 7 
  11.   NewsID,Title,UpdateTime,BigClassName,SmallClassName,SpecialID,click from News where 
  12.   BigClassName='" & BigClassName &"'  order by NewsID DESC";
  13.   ResultSet rs1=stmt.executeQuery(sql);
  14.   while(rs1.next()){%>
  15. <%=rs1.getString("NewsID")%>
  16. <%=rs1.getString("BigClassName")%>
  17. <%=rs1.getString("SmallClassName")%>
  18. <%=rs1.getString("SpecialId")%>
  19. <%=rs1.getString("Title") %>
  20. <%}rs.close();%>
  21.            <br/><a href="index.wml">返回主页</a><br/> </card> </wml>