欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

JSP如何實(shí)現(xiàn)頁面?zhèn)髦?/h1>

這篇文章將為大家詳細(xì)講解有關(guān)JSP如何實(shí)現(xiàn)頁面?zhèn)髦担【幱X得挺實(shí)用的,因此分享給大家做個(gè)參考,希望大家閱讀完這篇文章后可以有所收獲。

創(chuàng)新互聯(lián)公司是一家專業(yè)提供肅寧企業(yè)網(wǎng)站建設(shè),專注與網(wǎng)站設(shè)計(jì)、成都網(wǎng)站設(shè)計(jì)H5技術(shù)、小程序制作等業(yè)務(wù)。10年已為肅寧眾多企業(yè)、政府機(jī)構(gòu)等服務(wù)。創(chuàng)新互聯(lián)專業(yè)網(wǎng)絡(luò)公司優(yōu)惠進(jìn)行中。

這周在調(diào)支付寶的接口。期間需要把我方程序處理后的參數(shù)(交易金額)按照規(guī)定的格式傳遞給支付寶的接口。因?yàn)橹型疽O(shè)計(jì)到我方程序?qū)σ恍?shù)據(jù)的處理,所以并不方便直接傳值過去。思來想去,決定先把我方的數(shù)據(jù)提交給webwork的Action進(jìn)行處理,也就是對數(shù)據(jù)庫進(jìn)行操作;然后把交易金額以及支付寶接口需要的其他參數(shù)一并傳遞給一個(gè)JSP頁面,并讓這個(gè)JSP頁面在把a(bǔ)ction直接指向支付寶的網(wǎng)關(guān)接口,注意:中間過程中這個(gè)JSP頁面時(shí)不顯示出來的。為此,做了如下測試:建立兩個(gè)JSP頁面?zhèn)髦?tes1.jsp和test2.jsp。代碼如下:

  1. <%@pagelanguage="java"import="java.util.*"pageEncoding="GBK"%> 

  2. <%  

  3. Stringpath=request.getContextPath();  

  4. StringbasePath=request.getScheme()+"://"+request.getServerName()
    +":"+request.getServerPort()+path+"/";  

  5. %> 

  6. > 

  7. <html> 

  8. <head> 

  9. <basehrefbasehref="<%=basepath%>"> 

  10.  

  11. <title>MyJSP'test1.jsp'startingpagetitle> 

  12. <metahttp-equivmetahttp-equiv="pragma"content="no-cache"> 

  13. <metahttp-equivmetahttp-equiv="cache-control"content="no-cache"> 

  14. <metahttp-equivmetahttp-equiv="expires"content="0"> 

  15. <metahttp-equivmetahttp-equiv="keywords"content="keyword1,keyword2,keyword3"> 

  16. <metahttp-equivmetahttp-equiv="description"content="Thisismypage"> 

  17. <metahttp_equivmetahttp_equiv="refresh"content="5"> 

  18.  

  19. <scriptlanguagescriptlanguage="javascript"type="text/javascript"> 

  20. functionexecute(){  

  21. varobj=document.getElementById("name");  

  22. document.form1.action="alipay/test2.jsp?param="+obj.value;  

  23. document.form1.submit();  

  24. }  

  25. script> 

  26. head> 

  27. <bodyonloadbodyonload="execute();"> 

  28. <formnameformname="form1"method="post"> 

  29. <table> 

  30. <tr> 

  31. <td> 

  32. 測試JSP頁面?zhèn)髦?strong><inputtypeinputtype="text"id="username"value="luodada"> 

  33. td> 

  34. tr> 

  35. table> 

  36. form> 

  37. body> 

  38. html> 

tset2.jsp的代碼如下:

<%@pagelanguage="java"import="java.util.*"pageEncoding="GBK"%> <%  Stringpath=request.getContextPath();  StringbasePath=request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";  %> > <html> <head> <basehrefbasehref=""> <title>MyJSP'test2.jsp'startingpagetitle> <metahttp-equivmetahttp-equiv="pragma"content="no-cache"> <metahttp-equivmetahttp-equiv="cache-control"content="no-cache"> <metahttp-equivmetahttp-equiv="expires"content="0"> <metahttp-equivmetahttp-equiv="keywords"content="keyword1,keyword2,keyword3"> <metahttp-equivmetahttp-equiv="description"content="Thisismypage">  head> <body> <%  Stringvalue=request.getParameter("param");  out.print("從test1.jsp傳遞過來的值是"+value);  %> body> html>

具體思路如下:

在JSP頁面?zhèn)髦祎est1.jsp中,通過JavaScript把文本框中的值獲取出來,,使test1.jsp在加載進(jìn)來的時(shí)候馬上執(zhí)行頁面跳轉(zhuǎn);

在JSP頁面?zhèn)髦祎est2.jsp中通過request.getParameter("參數(shù)名稱");來獲取test1.jsp傳遞過來的值即可。

關(guān)于“JSP如何實(shí)現(xiàn)頁面?zhèn)髦怠边@篇文章就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,使各位可以學(xué)到更多知識,如果覺得文章不錯(cuò),請把它分享出去讓更多的人看到。

本文名稱:JSP如何實(shí)現(xiàn)頁面?zhèn)髦?/a>
當(dāng)前URL:
http://www.chinadenli.net/article2/gccdic.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站排名全網(wǎng)營銷推廣網(wǎng)站設(shè)計(jì)公司網(wǎng)站制作移動網(wǎng)站建設(shè)域名注冊

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

商城網(wǎng)站建設(shè)