jspºÍÊý¾Ý¿âÁ¬½Ó´óÈ«
ÏÂÃæµÄjspºÍÊý¾Ý¿âÁ¬½Ó´óÈ«£¬Çë²Î¿¼
Ò»¡¢jspÁ¬½ÓOracle8/8i/9iÊý¾Ý¿â£¨ÓÃthinģʽ£©
testoracle.jspÈçÏ£º
<%@ page contentType="text/html;charset=gb2312"%>
<%@ page import="java.sql.*"%>
<html>
<body>
<%Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
String url="jdbc:oracle:thin:@localhost:1521:orcl";
//orclΪÄãµÄÊý¾Ý¿âµÄSID
String user="scott";
String password="tiger";
Connection conn= DriverManager.getConnection(url,user,password);
Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
String sql="select * from test";
ResultSet rs=stmt.executeQuery(sql);
while(rs.next()) {%>
ÄúµÄµÚÒ»¸ö×Ö¶ÎÄÚÈÝΪ£º<%=rs.getString(1)%>
ÄúµÄµÚ¶þ¸ö×Ö¶ÎÄÚÈÝΪ£º<%=rs.getString(2)%>
<%}%>
<%out.print("Êý¾Ý¿â²Ù×÷³É¹¦£¬¹§Ï²Äã");%>
<%rs.close();
stmt.close();
conn.close();
%>
</body>
</html>
----------------------------------------------------------------------------------------------------------------
¶þ¡¢jspÁ¬½ÓSql Server7.0/2000Êý¾Ý¿â
testsqlserver.jspÈçÏ£º
<%@ page contentType="text/html;charset=gb2312"%>
<%@ page import="java.sql.*"%>
<html>
<body>
<%Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
String url="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=pubs";
//pubsΪÄãµÄÊý¾Ý¿âµÄ
String user="sa";
String password="";
Connection conn= DriverManager.getConnection(url,user,password);
Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
String sql="select * from test";
ResultSet rs=stmt.executeQuery(sql);
while(rs.next()) {%>
ÄúµÄµÚÒ»¸ö×Ö¶ÎÄÚÈÝΪ£º<%=rs.getString(1)%>
ÄúµÄµÚ¶þ¸ö×Ö¶ÎÄÚÈÝΪ£º<%=rs.getString(2)%>
<%}%>
<%out.print("Êý¾Ý¿â²Ù×÷³É¹¦£¬¹§Ï²Äã");%>
<%rs.close();
stmt.close();
conn.close();
%>
</body>
</html>
×¢Òâ: Òªmsutil.jar,mssqlserver.jar,msbase.jar
Ïà¹ØÎĵµ£º
JSPÖÐfilter¹ýÂËÆ÷ÑéÖ¤Óû§µÇ¼
ÏÖÔÚJSPʹÓÃÔ½À´Ô½¹ã·ºÁË£¬ÓÈÆäÊǺܶàÕþ¸®µÄÍøÕ¾¶¼²ÉÓÃÁËJSP¼¼Êõ£¬Æ书ÄÜÇ¿´óÇÒ°²È«¡£
³õѧÕߺܶàÓÐÕâô¸öÎÊÌ⣬¾ÍÊÇ£¬ÍøÕ¾µÄÒ»¸öȨÏÞÉèÖ㬱ÈÈçµÇ¼Óû§¿ÉÒԲ鿴ÄÄЩҳÃ棬¶øÓοÍÓÖÓÐȨÏÞ¿ÉÒÔ¿´ÄÄЩÄÚÈÝÄØ£¿
JSPÊÇÇ¿´óµÄ£¬µ«Æä´úÂ뻹ÊÇÏà¶Ô·±ËöµÄ£¬ÆäʵÓÃÒ»¸ö¹ýÂËÆ÷(filter)¾Í¿ÉÒÔʵÏÖÕ ......
JSPÖи÷ÖÖÄÚÖöÔÏó
web½»»¥µÄ×î»ù±¾µ¥Î»ÊÇhttpÇëÇó¡£Ã¿¸öÓû§´Ó½øÈëÍøÕ¾µ½À뿪ÍøÕ¾Õâ¶Î¹ý³Ì³ÆΪһ¸öHTTP»á»°£¬Ò»¸ö·þÎñÆ÷µÄÔËÐйý³ÌÖлáÓжà¸öÓû§·ÃÎÊ£¬¾ÍÊǶà¸öHTTP»á»°¡£×÷ÓÃÓò½âÊÍÈçÏ£º
1.application£º·þÎñÆ÷Æô¶¯µ½Í£Ö¹µÄÕâ¶Îʱ¼ä
2.session£ºHTTP»á·¢¿ªÊ¼µ½½áÊøµÄÕâ¶Îʱ¼ä
3.request£ºHTTPÇëÇó¿ªÊ¼µ½½áÊ ......
ÕâÁ½ÌìÔÚΪÏîĿǶÈëÕâ¸ö²å¼þ£¬¸ãµÃ½¹Í·Àö³É¹¦²åÈëÁ˵ģ¬¿ÉÊDz»ÖªµÀʲôÎÊÌ⣬¾ÍÊÇÉÏ´«²»ÁËͼƬ£¬¾¹È»³öÏÖÁËÕâÑùµÄ¾¯¸æ£ºWARN net.fckeditor.handlers.RequestCycleHandler - No property found for UserPathBuilder implementation! The 'DefaultUserFilesPath' will be used in the ConnectorServlet!
ÔÚÍøÉÏÕÒÁË°ë ......
jsºÃÏñ±¾Éí²»ÄÜ»ñÈ¡·þÎñÆ÷µÄIP,µ«JSP¿ÉÒÔ£¬ËùÒÔÓøöÒþ²ØÓò£¬js¾Í¿ÉÒԽ輦ϵ°ÁË¡£
jsp´úÂëÈçÏ£º
<input type="hidden" id="serviceIp" name="serviceIp" value="<%=InetAddress.getLocalHost().getHostAddress()%>">
js´úÂëÈçÏ£º
function getServiceIP(){
var ser ......
Ò»¡¢ÏÂÔØ
J2SDK£ºjdk-1_5_0_04-windows-i586-p.exe
ECLIPSE£ºeclipse-SDK-3.2-win32.zip
ECLIPSE ²å¼þ£º
(1)ÖÐÎÄ°ü NLpack1-eclipse-SDK-3.2-win32.zip
(2)Tomcat²å¼þ tomcatPluginV31.zip
(3)LOMBAT£ºlomboz-wtp-emf-gef-jem-3.1.2.zip
TOMCAT£ºapache-tomcat-5.5.17.exe
mysql£ºMysql-5.0.15.rar
¶þ¡¢°²×°
1.°² ......