jspÊý¾Ý¿âÁ¬½Ó
package MidTerm;
import java.sql.*;
import com.mysql.jdbc.Driver;
public class Connection
{
private static Connection con;
private Statement statement;
private ResultSet rs;
private static String userName="root";
private static String userPassword="123456";
private static String dbName="hoot";
//private static String encoding="characterEncoding=gb2312&useUnicode=true";
private static final String driveName = "com.mysql.jdbc.Driver";
private static String url="jdbc:mysql://localhost/"+dbName+"?user="+userName+
"&password" + "="+userPassword;
public static synchronized Connection getCon()throws Exception
{
try
{
Class.forName(driveName).newInstance();
con =(Connection) DriverManager.getConnection(url);
return con;
}
catch(SQLException e)
{
System.err.println(e.getMessage());
throw e;
}
}
public Statement getStmntRead()
{
try
{
con = getCon();
statement = ((java.sql.Connection) con).createStatement(
ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
return statement;
}
catch(Exception e)
{
Ïà¹ØÎÊ´ð£º
<%@ page contentType = "text/html;charset =gb2312"%>
<%!
public String codeToString(String str)
{
String s =str;
&nbs ......
°üÀ¨²ÎÊý
String path = request.getContextPath();
String basePath = request.getScheme() + "://"+ request.getServerName() + ":" + request.getServerPort()+ path + "/"; ......
ÓÉÓÚ Javascript ²»ÄÜ·ÃÎʱ¾µØÎļþ£¬ÏëÓÃJsp¶ÁÈ¡±¾µØÎļþ£¬È»ºó½«ÎļþÄÚÈÝ´«µ½·þÎñÆ÷ºǫ́½øÐд¦Àí£¬ÔõôʵÏÖѽ£¡
ÕâÑùԽȨÁË¡£»òÕß²ÉÓøßÊÚȨµÄAPPLETÀ´×ö£¬ÕâÑùÔÚʹÓÃʱÐèÒªÓû§ÏÂÔØÖ¤Êé²¢ÇÒÊÚȨ£¡
¹Ø× ......
HTML code:
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getSche ......
ÎÒÊÇÓÃSTRUTS £¬×öÁËÒ»¸öJSPÒ³Ãæ£¬Ìá½»ºóûÓдæÈëÊý¾Ý¿â¡£
JSP´úÂëÈçÏ£º
aa.jsp´úÂë
<%@ page contentType="text/html;charset=gb2312" language="java"%>
<%@ taglib uri=" ......