jspµ÷Óô洢¹ý³Ì
ÔÚsql2000Öд´½¨´æ´¢¹ý³Ì£º
--ÇóÁ½ÊýÖ®ºÍ
create proc up_sum @a int ,@b int ,@result int output
as
select @result= @a+@b
µ÷Ó÷½·¨£º
...
CallableStatement cstmt=con.prepareCall("exec up_sum ?,?,?");
cstmt.registerOutParameter(3,java.sql.Types.INTEGER);
cstmt.setInt(1,10);
cstmt.setInt(2,20);
int result=cstmt.getInt(3);
...
´æ´¢¹ý³Ìup_sumÓÐ3¸ö²ÎÊý£¬µÚÒ»¸öºÍµÚ¶þ¸ö²ÎÊý¶¼ÊÇINÀàÐÍ£¬µÚÈý¸ö²ÎÊýÊÇOUTÀàÐÍ£¬¶øOUTÀàÐÍ
µÄ²ÎÊýÔÚÖ´Ðд洢¹ý³Ì֮ǰÐèÒªµ÷ÓÃregisterOutParameter()·½·¨×¢²á´æ´¢¹ý³ÌµÚÈý¸ö²ÎÊý£¬·½·¨µÚ
¶þ¸ö²ÎÊýÓÃÓÚÖ¸¶¨´æ´¢¹ý³Ì²ÎÊýÖÐJDBCÀàÐÍ£¬¸ÃÀàÐÍÔÚjava.sql.TypesÀàÖж¨Òå¡£×îºóÓÃgetXXX()·½
·¨È¡³öOUT²ÎÊýµÄÖµ¡£
Ïà¹ØÎĵµ£º
Ò») °²×°JDK(jdk-1_5_0-windows-i586.exe)£¬Ä¬ÈÏ°²×°£»
(¶þ) °²×°Tomcat(tomcat5.5-installer.exe)£¬Ä¬ÈÏ°²×°£»
* ˳Ðò²»¿ÉÒԵߵ¹ *
(Èý) ²âÊÔ°²×°½á¹û
1. ´ò¿ªä¯ÀÀÆ÷ÊäÈëhttp://localhost:8080£¬Èç¹û³É¹¦£¬Ôò»á¿´µ½»¶ÓÒ³Ãæ¡£´Ëʱ·ÃÎʵÄ·¾¶Îª$tomcat/webapps/root/
(ËÄ) ½¨Á¢ÎÒµÄÕ¾µ ......
ÕâÖ÷ÒªÊÇtomcatµÄÎÊÌ⣬Ëü»áÔÚ´«Ë͵Äʱºò°Ñ×Ö·û¼¯ÖØбàÒ룬µÈ´«¹ýÈ¥µÄjspÒ³Ãæ½ÓÊܵÄʱºò¾Í»á³öÏÖÂÒÂ룬
²»¹ÜÔÚÒ³ÃæÀïÈçºÎÉèÖÃ×Ö·û¼¯¶¼Ã»°ì·¨½â¾ö£¬Õâʱºò±ØÐë±ØÐëÔÚtomcat°²×°Ä¿Â¼Àï½øÐÐÉèÖã¬
C:\Program Files\apache-tomcat-6.0.14\confĿ¼Ï server.xmlÏ <Connector/>±êÇ©Ï ¼ÓÒ»¾ä URIEncoding="GBK" ¾ÍºÃÁ ......
ÔÚ·ÃÎÊJSPÎļþ»òÕßServletµÄʱºò£¬Èç¹ûÌáʾÏÂÔز¢±£´æ£¬ÈçÏÂͼËùʾ£º
ͬÑùµÄ³ÌÐòÓеÄä¯ÀÀÆ÷³ö´í£¬ÓеÄä¯ÀÀÆ÷²»³ö´í¡£´íÎóµÄÔÒòÊÇÉèÖÃMIMEÀàÐ͵ĴúÂëÓÐÎó¡£
Èç¹ûÊÇJSPÎļþ£¬²é¿´ÎļþÍ·£º
<%@ page contentType="text/html;charset=gb2312"%>
Èç¹ûÊÇServletÎļþ£¬²é¿´£º
response.setContentType("text/html;char ......
jspµÄpageEncoding="UTF-8",strutsµÄencoding="UTF-8"£¬eclipse µÄ¹¤×÷Çø¼äµÄ±àÂ뷽ʽÊÇGBK£¬µ«ÊÇÔÚstrutsµÄactionÖлñµÃµÄjsp´«À´µÄÖÐÎÄÖÐÓÐÂÒÂ룬ʹÓÃnew String(sysgkForm.getContent().getBytes("UTF-8"),"GBK")תÂëÒ²²»ÐУ¬×îºó·¢ÏÖÎÊÌâ³öÔÚÁËjspÀïÃæ¡£¼ÓÉÏcontentType="text/html; charset=GBK" ¾ÍºÃÁË¡£
pageEncodi ......