javaÁ¬½ÓÊý¾Ý¿âÎÊÌ⣬¼±¼± - Java / Java SE
ΪʲôÁ¬½Ó²»³É¹¦ÄØ£¿ÄĸöÄܽâ´ðÏÂ
ÎÒÁ¬½ÓÊý¾Ý¿âsql server 2005
ÏÂÁËjdbcÇý¶¯ÅäÖÃÁ˺ܶà´Î¶¼²»³É¹¦
ÓÐÄĸöÅóÓÑÖªµÀÔõÑùÅäÖÃÂð£¿
Õâ¸öÏÂÃæ´úÂëÁ¬½Ó³öÏÖµÄÎÊÌâ
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at test.main(test.java:12)
Java code:
import java.sql.*;
public class test
{
public static void main(String[] args)
{
Connection con=null;
Statement stmt=null;
ResultSet rs=null;
try
{
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
con=DriverManager.getConnection("jdbc:sqlserver://localhost:1433;integratedSecurity=true;DatabaseName=JSPTest","sa","java");
stmt = con.createStatement();
rs = stmt.executeQuery("select userName,passWord,email from regist");
while(rs.next())
{
String strUserName = rs.getString(1);
String strPassWord = rs.getString(2);
System.out.println(strUserName+'\t'+strPassWord+'\t');
}
if(rs!=null)
rs.close();
if(stmt!=null)
Ïà¹ØÎÊ´ð£º
JSPÒ³ÃæÖÐÓжà¸öradio°´Å¥
JSPÒ³Ã潫²ÎÊýPOST¸øservlet
ÒªÇóÈçÏÂ;
1.Ñ¡ÔñÒ»¸öradio£¬µ÷ÓÃservlet servletÖиù¾Ý²ÎÊýµ÷ÓÃÆäËû½Ó¿Ú£¬³ý·ÇÑ¡ÖиÃradio²¢µã»÷JSPÖеÄʵР......
±¾ÈËÕýÔÚÓÃJava×öÒ»¸öC/S¼Ü¹¹µÄÏîÄ¿£¬
¿ÉÊÇÓÉÓÚÏîÄ¿±È½Ï´ó£¬Ç°ÆڶԼܹ¹µÄÉè¼ÆÓÈÆäÖØÒª£¬ÒòΪºóÆÚ¿ÉÄÜËæʱ»á¼Ó¸ö¹¦ÄÜ»òÕßÈ¥µôijЩ¹¦ÄÜ¡£
ËùÒÔÌصØÑ°ÇóÈçºÎÉè¼ÆC/SµÄ¼Ü¹¹Ê¹³ÌÐò¸ü¼ÓÃæÏò¶ÔÏó¸ü¼ÓÒ×ÓÚά ......
ÎÒдÁ˸öjspÒ³Ã棬Ȼºó¸Ä¶¯ÁËһϣ¬¸Ä¶¯µÄÄÚÈݾÍÊÇÔÚjspÒ³ÃæµÄjsº¯ÊýÀï¼ÓÁ˸öalert()Óï¾ä£¬µ«ÊÇÎÒ·ÃÎÊÕâ¸öÒ³Ãæʱ£¬ËÀ»î¶¼ÊÇÔÀ´Ò³ÃæµÄÄÚÈÝ£¬ÎÒ¼ÓÁ˺ܶàalertº¯Êý»¹ÊÇû¸Ä¶¯Ç°µÄÒ³ÃæÄÚÈÝ£»tomcatÖØÆôÁË£¬Ò²ÖØв¿ÊðÕâ ......
¾ÍÊǼòµ¥µÄ´«ÖµºÍÈ¡Öµ
ÇëÎÊÂ¥Ö÷ÏëÎÊʲô£¿
jspÒ³Ãæ²ÉÓÃ±íµ¥»òÕßjavabean´«Öµ¶¼¿ÉÒÔ£¬Ê¹ÓÃrequest.getParameter()»ñµÃʹÓÃ±íµ¥´«¹ýÀ´µÄÖµ¡£
ÎÊÎÊÌ⣬ÏÈ°ÑÎÊÌâ˵Çå³þµã£¡£¡ ÎÊÌâÌ«Ä£ºý£¡£¡
ÎÊÎÊÌ⣬ÏÈ°ÑÎ ......