england_005fforeshow_005finfo_jsp.java
来自「手机在线系统 采用Java 中的J2ME, JSP 跟MySql 运行环」· Java 代码 · 共 166 行
JAVA
166 行
package org.apache.jsp.football;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import java.sql.*;
import com.j2me.common.*;
import com.j2me.data.*;
public final class england_005fforeshow_005finfo_jsp extends org.apache.jasper.runtime.HttpJspBase
implements org.apache.jasper.runtime.JspSourceDependent {
private static java.util.Vector _jspx_dependants;
public java.util.List getDependants() {
return _jspx_dependants;
}
public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
JspFactory _jspxFactory = null;
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page = this;
JspWriter _jspx_out = null;
PageContext _jspx_page_context = null;
try {
_jspxFactory = JspFactory.getDefaultFactory();
response.setContentType("text/html; charset=gb2312");
pageContext = _jspxFactory.getPageContext(this, request, response,
null, true, 8192, true);
_jspx_page_context = pageContext;
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
_jspx_out = out;
out.write("\r\n");
out.write("<HTML>\r\n");
out.write("\r\n");
out.write("<HEAD>\r\n");
out.write("\r\n");
out.write("<TITLE> New Document </TITLE>\r\n");
out.write("\r\n");
out.write("</HEAD>\r\n");
out.write("\r\n");
out.write("<BODY>\r\n");
/**
* @(#)england_foreshow_info.jsp.jsp 1.11 01/08/23
* Copyright (c) 2004-2005 wuhua of workroom Inc. All Rights Reserved.
* @version 1.0, 10/05/2004
* @author 饶荣庆
* @author 余煜辉
*/
/*此文件用于获得客户端 输入的球队名,并从数据库中读取球队赛程信息返回客户端*/
FootBall foot = null; //数据库类
String name1 = request.getParameter("name"); //获得参数
String degree1 = request.getParameter("degree"); //获得参数
//获得球队名的参数,并查询它
String sql ="select *from england_foreshow where name like '%" + name1 + "%' and degree = '" + degree1+ "'" ;
try
{
foot = new FootBall();
foot.connect(); //连接数据库
}
catch(ClassNotFoundException e)
{
out.println(e.getMessage());
}
try
{
String name ;
String degree ;
String time;
String place;
String hookup;
String price;
String court;
String teamName_info = null;
ResultSet rs = foot.view(sql); //显示数据
/*---------------------------------------------------------------------------------
*获取数据库信息
*/
while(rs.next())
{
name = rs.getString(1); // 获得比赛名
degree = rs.getString(2); //获得第几轮
time = rs.getString(3); //获得比赛时间
place = rs.getString(4); //获得比赛地点详细信息
hookup = rs.getString(5); //转播
price = rs.getString(6); //价钱
court = rs.getString(7); //球场
teamName_info = "name: " + name +"\n"
+ "degree: " + degree +"\n"
+ "time: " + time +"\n"
+ "place: " + place +"\n"
+ "hookup: " + hookup +"\n"
+ "price: " + price +"\n"
+ "court: " + court;
byte[] tmpbyte = teamName_info.getBytes("8859_1");
teamName_info = new String(tmpbyte);
//把中文字符转换为Unicode吗
teamName_info = Unicode.stringToUnicode(teamName_info);
}
/*-------------------------------------------------------------------------------------*/
if (teamName_info == null)
{
out.println("false");
}
else
{
out.println(teamName_info);
}
}
catch(SQLException sqlexception)
{
out.println(sqlexception.getMessage()); //输出连接错误
}
foot.disconnect(); //注销数据库
out.write("\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("</BODY>\r\n");
out.write("</HTML>\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("\t");
} catch (Throwable t) {
if (!(t instanceof SkipPageException)){
out = _jspx_out;
if (out != null && out.getBufferSize() != 0)
out.clearBuffer();
if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
}
} finally {
if (_jspxFactory != null) _jspxFactory.releasePageContext(_jspx_page_context);
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?