欧美一级特黄大片做受成人-亚洲成人一区二区电影-激情熟女一区二区三区-日韩专区欧美专区国产专区

如何測試JSP容器

這篇文章給大家分享的是有關(guān)如何測試JSP容器的內(nèi)容。小編覺得挺實用的,因此分享給大家做個參考,一起跟隨小編過來看看吧。

創(chuàng)新互聯(lián)堅持“要么做到,要么別承諾”的工作理念,服務(wù)領(lǐng)域包括:成都網(wǎng)站建設(shè)、成都網(wǎng)站設(shè)計、企業(yè)官網(wǎng)、英文網(wǎng)站、手機端網(wǎng)站、網(wǎng)站推廣等服務(wù),滿足客戶于互聯(lián)網(wǎng)時代的阜城網(wǎng)站設(shè)計、移動媒體設(shè)計的需求,幫助企業(yè)找到有效的互聯(lián)網(wǎng)解決方案。努力成為您成熟可靠的網(wǎng)絡(luò)建設(shè)合作伙伴!

由于上面給出例 復(fù)雜 。一般人很難理解。我也是 ^_^但仔細看我還是自己寫出一個比較簡單的,望大家一起討論。被測試JSP容器

<%@ taglib prefix="html" uri="/WEB-INF/struts-html.tld" %> <%@ taglib prefix="c" uri="/WEB-INF/c-1_0-rt.tld" %> <html:html> <c:if test="${name != pass}"> ${name}  <br> ${pass} <br> <!-- <html:text property="in" ></html:text> --> </c:if> </html:html>

ant直接把他放在 eclipes 工程的根目錄下 build.xml但有有3個參數(shù)要設(shè)置 tomcat.home Tomcat 的地址webapp.path 工程中的根目錄,下面有WEB-INFsrc 原代碼 (到時候JSP會翻譯成.java到這個目錄的 org.apache.JSP.JSP 下)

<project name="Webapp Precompilation" default="all" basedir="."> <!-- tomcat dir --> <property name="tomcat.home" value="D:\Tomcat 5.0"/> <!-- this=..//WEB-INF (in eclipes)  -->   <property name="webapp.path" value=".\WebRoot"/> <!-- src (in eclipes) --> <property name="src" value="./src"/> <target name="jspc"> <taskdef classname="org.apache.jasper.JspC" name="jasper2" > <classpath id="jspc.classpath"> <pathelement location="${java.home}/../lib/tools.jar"/> <fileset dir="${tomcat.home}/bin"> <include name="*.jar"/> </fileset> <fileset dir="${tomcat.home}/server/lib"> <include name="*.jar"/> </fileset> <fileset dir="${tomcat.home}/common/lib"> <include name="*.jar"/> </fileset> </classpath> </taskdef> <jasper2 validateXml="false" uriroot="${webapp.path}" webXmlFragment="${webapp.path}/WEB-INF/generated_web.xml" outputDir="${src}" /> </target> <target name="compile"> <mkdir dir="${webapp.path}/WEB-INF/classes"/> <mkdir dir="${webapp.path}/WEB-INF/lib"/> <javac destdir="${webapp.path}/WEB-INF/classes" optimize="off" debug="on" failonerror="false" srcdir="${src}" excludes="**/*.smap"> <classpath> <pathelement location="${webapp.path}/WEB-INF/classes"/> <fileset dir="${webapp.path}/WEB-INF/lib"> <include name="*.jar"/> </fileset> <pathelement location="${tomcat.home}/common/classes"/> <fileset dir="${tomcat.home}/common/lib"> <include name="*.jar"/> </fileset> <pathelement location="${tomcat.home}/shared/classes"/> <fileset dir="${tomcat.home}/shared/lib"> <include name="*.jar"/> </fileset> <fileset dir="${tomcat.home}/bin"> <include name="*.jar"/> </fileset> </classpath> <include name="**" /> <exclude name="tags/**" /> </javac> </target> <target name="all" depends="jspc,compile"> </target> <target name="cleanup"> <delete> <fileset dir="${webapp.path}/WEB-INF/src"/> <fileset dir="${webapp.path}/WEB-INF/classes/org/apache/jsp"/> </delete> </target> </project>

TEST

package jetty.test.supper;  import javax.servlet.http.HttpServletRequest;  import javax.servlet.http.HttpServletResponse;  import org.apache.jsp.jsp.MyJsp_jsp;  import com.meterware.httpunit.GetMethodWebRequest;  import com.meterware.httpunit.WebRequest;  import com.meterware.httpunit.WebResponse;  import com.meterware.servletunit.InvocationContext;  import com.meterware.servletunit.ServletRunner;  import com.meterware.servletunit.ServletUnitClient;  import junit.framework.TestCase;  public class JSPCTest extends TestCase{  private InvocationContext ic = null ;  protected void setUp() throws Exception {  ServletRunner sr = new ServletRunner();  // 向環(huán)境中注冊 jsp           sr.registerServlet("HelloWorld", MyJsp_jsp.class.getName());  ServletUnitClient  sc = sr.newClient();  WebRequest request = new GetMethodWebRequest("http://localhost/HelloWorld");  ic = sc.newInvocation(request);  }  public void testJspC() throws Exception{  HttpServletRequest re =  ic .getRequest();  HttpServletResponse rq =  ic.getResponse();  re.setAttribute("name","liukaiyi");  re.setAttribute("pass","123456");  MyJsp_jsp is = (MyJsp_jsp) ic.getServlet();  is._jspService(re,rq);  WebResponse response = ic.getServletResponse();  // 輸出          System.out.println( response.getText() );  }  }

結(jié)果是

<html> liukaiyi  <br> 123456 <br> </html>

感謝各位的閱讀!關(guān)于“如何測試JSP容器”這篇文章就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,讓大家可以學(xué)到更多知識,如果覺得文章不錯,可以把它分享出去讓更多的人看到吧!

新聞名稱:如何測試JSP容器
瀏覽地址:http://aaarwkj.com/article26/igisjg.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供ChatGPT標(biāo)簽優(yōu)化、App設(shè)計網(wǎng)站營銷、靜態(tài)網(wǎng)站、企業(yè)網(wǎng)站制作

廣告

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

小程序開發(fā)
日韩免费精品一区二区| 伦理在线视频免费观看视频| 综合av在线一区天堂| 麻豆成人三级电影在线| 色婷婷区二区三区四区| 日本韩国一级黄色免费| 亚州精品乱码久久电影| 久久热在线观看免费高清| 欧美日韩另类综合一区| 国产精品av国产精华液| 日本道加勒比二三五区视频| 亚洲av一区二区三区网站| 精精国产xxxx视频在线不卡| 午夜亚洲欧美日韩在线| 成人精品欧美欧美一级乱黄| 亚洲一区二区三区熟女少妇| 综合久久—本道中文字幕| 欧美日本国产老熟女视频| 国产三级精品三级专区| 国内在线免费观看av| 色婷婷激情一区二区三区| 亚洲国产精品成人久久66| 91欧美精品综合在线| 日本美女激情在线观看| 国产精品自偷自偷自偷| 日本午夜一区二区在线观看| 99久久成人精品国产片| 97青青草免费在线视频| 亚洲综合中文字幕经典av在线| 国产精品—色哟哟视频| 一区二区精品福利视频| 亚洲欧美日韩成人在线观看| 午夜福利影片免费观看| 欧美日韩亚洲1区2区| 九九热这里只有免费视频| 我的农村中年激情熟妇| 懂色一区二区三区精品视频| 91精品国产高清久久福利| 国产亚洲av综合人人精品| 内地精品露脸自拍视频| 亚洲午夜激情视频在线|