news.jsp
资源名称:wapjsp.rar [点击查看]
上传用户:xiao85513
上传日期:2010-01-11
资源大小:2160k
文件大小:1k
源码类别:
手机WAP编程
开发平台:
Java
- <%@ 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">
- <wml> <head> <meta forua="true" http-equiv="Cache-Control" content="max-age=0"/> </head> <card id="news" title="news" newcontext="true">
- <do type="prev" name="Prev" label="Back"><prev/></do>
- <%
- String str,newstring;
- Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
- String url="jdbc:microsoft:sqlserver://211.65.33.93:1433;DatabaseName=newscat1";
- String user="sa";
- String password="kurtCobain4551306";
- Connection conn=DriverManager.getConnection(url,user,password);
- Statement stmt=conn.createStatement();
- String BigClassName="order by NewsID DESC";
- String sql="select top 7 NewsID,Title,UpdateTime,BigClassName,SmallClassName,SpecialID,click from News "+BigClassName;
- ResultSet rs1=stmt.executeQuery(sql);
- while(rs1.next()) {%>
- <%
- str=rs1.getString("SmallClassName");
- newstring=new String(str.getBytes(),"gb2312");
- out.println(newstring);
- %>
- <%=rs1.getString("Title") %><br/>
- <%}rs1.close();%>
- <br/><a href="index.wml">返回主页</a><br/> </card> </wml>