Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

̸JSPÓëXMLµÄ½»»¥

̸JSPÓëXMLµÄ½»»¥
ʹÓÃJavaServer PagesÓÐÈýÖÖ²»Í¬µÄ·½·¨ÓÃÓÚ´¦ÀíXMLÎĵµ£¬Ã¿ÖÖ·½·¨¶¼ÓÐÀûÓÚÌá¸ß·ÖÀëÒ³Ãæ´úÂëÓëXMLÊý¾ÝµÄˮƽ£¬ÓÐÀûÓÚ¼ò»¯¿ª·¢ÍøÒ³µÄ¸´ÔӶȲ¢ÇÒ¸ÄÉÆÌá¸ß×é¼þÓëÒ³Ãæ´úÂëµÄ¿ÉÖØÓÃÐÔ¡£
¡¡¡¡JavaServer Pages ( JSP)ºÍXMLÊÇSunµÄJ2EEµÄÁ½¸öÖÁ¹Ø½ôÒªµÄ×é¼þ¡£ JSPÊÇÓÃÓÚ´´½¨Ó¦ÓóÌÐò·þÎñÆ÷¶Ë³ÌÐòµÄÓÐЧ¹¤¾ß£¬¶ø¿Í»§¿ÉÒÔÊÇÒ»¸öä¯ÀÀÆ÷£¬Ò»¸öÉ豸»òÆäËüµÄÓ¦ÓóÌÐò¡£ Äã¿ÉÒÔʹÓÃXMLÃèÊöÊý¾Ý²¢ÔÚÁªÏµ·þÎñÆ÷ÓëϵͳµÄÆäÓಿ·ÖÖ®¼ä´«µÝ¡£ Èç¹ûÄã×Ðϸ¿¼ÂÇWeb·þÎñµÄ³éÏó¸ÅÄîµÄ»°£¬JSP¿ÉÒÔ±»ÈÏΪÊÇʵÏÖ¼¼Êõ¶øXMLÔòÊÇÊý¾Ý·â×°ºÍÏûÏ¢´«Ëͼ¼Êõ¡£ JSPÒ³Ãæ¿ÉÒÔͨ¹ýÈýÖÖ·½Ê½Ê¹ÓÃXML£ºÖ±½ÓʹÓÃXMLÎļþ£¬Ê¹ÓÃJavaBeansÀ´Ö´ÐÐXML´¦Àí»òÕßͨ¹ý±ê¼Ç¿âʹÓÃXML¡£
¡¡¡¡Ò»¡¢Ö±½ÓʹÓÃXML
¡¡¡¡ÎÒÃÇ¿ÉÒÔÔÚJSPÒ³ÃæÖÐÖ±½ÓʹÓÃXML£¬ÕâÒª·ÖΪÈýÀࣺ
¡¡¡¡1. JSP¿ÉÒÔ¶ÁÈ¡XMLÎļþ²¢ÇÒ»ùÓÚÕâЩÊý¾ÝÖ´Ðж¯×÷¡£ÀýÈ磺һӦÓóÌÐò¿ÉÒÔ¶ÁÈ¡¾ßÓÐÄ³Ð©ÌØ¶¨½á¹¹µÄÊý¾ÝµÄXMLÎļþ¡£
¡¡¡¡2. JSP¿ÉÒÔ´´½¨XMLÎļþÒÔ·¢ËÍÊý¾Ýµ½¿Í»§³ÌÐò»òÆäËüµÄÓ¦ÓóÌÐò¡£ JSP¿ÉÒÔת»»XMLÎļþ,Õâ¸ö±ä»»¿ÉÒÔÊǽ»¸øXSLT´¦Àí£¬ÓÉJSP×÷Ϊ¿ØÖÆÆ÷£¬»òÕßͨ¹ý·ÇXSLT½â¾ö·½°¸À´Íê³É¡£ ÔÚÕâÁ½ÖÖÇé¿öÏ£¬JSPµÄ×÷Óö¼ÊǶÁÈ¡XMLÎļþ£¬×ª»»Ëü²¢Éú³ÉÒ»¸öÊä³ö¡£
¡¡¡¡ÒòΪJSP°üº¬ÄÚǶµÄJava³ÌÐò£¬ËùÒÔËü¿ÉÒÔÖ±½ÓµØµ÷ÓÃÒ»¸ö·ÖÎö³ÌÐòÀ´¶Á/дxmlÊý¾Ý¡£ ÕâÊǷdz£²»ºÏÀíµÄ·½·¨£¬ÒòΪÊý¾ÝºÍ´úÂëÂß¼­²¢²»Äܺܺõı»·ÖÀ뿪¡£ ÁíÍ⣬ÕâÑùµÄ³ÌÐòÒ²ºÜÄѶÁµÃ¶®¡£ ËùÒÔ£¬ÏÂÃæÎÒ½«½éÉܵڶþ·½·¨£ºÊ¹ÓÃJavaBeans¡£
¡¡¡¡¶þ¡¢Ê¹ÓÃJavaBeans
¡¡¡¡JSP¿ÉÒÔͨ¹ý<jsp:usebean>±ê¼ÇÓëJavaBeans½ôÃܵÄÕûºÏÆðÀ´¡£ ÏÂÃæµÄ³ÌÐòƬ¶Îʾ·¶ÁËÈçºÎʹÓÃÔÚJSPÒ³ÃæÖеÄÒ»¸öJavaBeanÀ´ÉèÖò¢»ñÈ¡ÊôÐÔ¡£
¡¡¡¡
<jsp:useBean id="cb" scope="session" class="xmlrep.Customer" />
<jsp:setProperty name="cb" property="id" value="45" />
<B> First Name is: </B>
<%=cb.getFname() %>
<p>
<B> Last Name is: .</B>
<%= cb.getLname() %>
JSPÓëJavaBeansÕûºÏµÄÌØÕ÷¾ÍÊÇ¿ÉÒÔ×Ô¶¯°Ñ³¬Îı¾±êÖ¾ÓïÑÔµÄ±íµ¥ÔªËØ·­Òë³ÉJavaBeanÊôÐÔ¡£ Èç¹ûÓÐÒ»¸öHTML±íµ¥²¢ÇÒÏëÈÃËüÏòJavaBeanÌá½»±íµ¥ÄÚÈÝ£¬Äã¿ÉÒÔдÏÂÃæµÄ´úÂ룺
<jsp:setProperty name="cb" property="*" />
¡¡¡¡nameÊôÐÔ°üº¬JSPÒ³ÃæÒѾ­ÒýÓÃBeanµÄÖµ¡£ Ç°Ãæ<jsp:useBean>±ê¼ÇÉèÖÃÃû³ÆÎª" cb "¡£ ÓëÉèÖõ¥¶ÀµÄBeanÊôÐÔ²»Í¬£¬Äã¿ÉÒÔÊ


Ïà¹ØÎĵµ£º

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);
    &nb ......

jsp Ö®Filter

(1) ÇëÇóÐÅÏ¢±àÂëת»¯µÄFilter
importjava.io.IOException;
importjava.util.Enumeration;
importjavax.servlet.Filter;
importjavax.servlet.FilterChain;
importjavax.servlet.FilterConfig;
importjavax.servlet.ServletException;
importjavax.servlet.ServletRequest;
importjavax.servlet.ServletResponse;
......

JSP±àÂ볣ʶ[ת]

GBK±àÂë
GBK±àÂëÊÇÖйúÖÆ¶©µÄ¡¢µÈͬÓÚUCSµÄеÄÖÐÎıàÂëÀ©Õ¹¹ú¼Ò±ê×¼¡£GBK¹¤×÷С×éÓÚ1995Äê10Ô£¬Í¬Äê12ÔÂÍê³ÉGBK¹æ·¶¡£¸Ã±àÂë±ê×¼¼æÈÝGB2312£¬¹²ÊÕ¼ºº×Ö21003¸ö¡¢·ûºÅ883¸ö£¬²¢Ìṩ1894¸öÔì×ÖÂë룬¼ò¡¢·±Ìå×ÖÈÚÓÚÒ»¿â¡£
UTF-8±àÂë
UTF-8±àÂë¿ÉÒÔͨ¹ýÆÁ±ÎλºÍÒÆÎ»²Ù×÷¿ìËÙ¶Áд¡£×Ö·û´®±È½Ïʱstrcmp()ºÍwcscmp()µÄ·µ»Ø½ ......

JSPÄÚÖöÔÏóÊôÐÔ¼°·½·¨´óÈ«

1.request¶ÔÏó
    ¿Í»§¶ËµÄÇëÇóÐÅÏ¢±»·â×°ÔÚrequest¶ÔÏóÖУ¬Í¨¹ýËü²ÅÄÜÁ˽⵽¿Í»§µÄÐèÇó£¬È»ºó×ö³öÏìÓ¦¡£ËüÊÇHttpServletRequestÀàµÄʵÀý¡£
ÐòºÅ                    ·½ ·¨      & ......

javascript µ÷Óà jspµÄ±äÁ¿

ÕÒÏÂÃæÐ´·¨¡£
×¢Ò⣬¼Óµ¥ÒýºÅ£¬µÚ2¸ö°Ù·ÖºÅ֮ǰûÓпոñ£¬¶øÔÚjspÖе÷ÓõĻ°Òª¿Õ¸ñ¡£
You may be get some help from the code below.
<%
String str="str";
%>

<script>
function accessVar(){
var varStr='<%=str%>';
alert(varStr);// here will diplay ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ