struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "jingxuan liu" <liujx...@gmail.com>
Subject About a simple test case on struts-showcase-2.0.12 and struts-blank-2.0.12
Date Mon, 01 Dec 2008 10:22:38 GMT
*Hi, Dear all:*
**
*I wrote a simple test case which want to visit **
http://localhost:8080/struts2-blank-2.0.12/example/Menu.jsp*<http://localhost:8080/struts2-blank-2.0.12/example/Menu.jsp>
* and **http://localhost:8080/struts2-showcase-2.0.12/tags/non-ui/debug.jsp*<http://localhost:8080/struts2-showcase-2.0.12/tags/non-ui/debug.jsp>
* by using Htmlunit.*
**
*I built my relative environment successfully, and I can visit both of
them from browser sucessfully.*
**
*The problem is my test case can visit all jsp files belong to
blank(struts-blank-2.0.12), but it can not visit any jsp file belong to
showcase(struts-showcase-2.0.12), and received same error information as
follows:*
**
*[ljx@MRObj-lnx32-06 test]$ javac test.java
[ljx@MRObj-lnx32-06 test]$ java test
test start!
Missing Feature
Dec 1, 2008 5:30:59 PM com.gargoylesoftware.htmlunit.html.HtmlPage
loadJavaScriptFromUrl
SEVERE: Error loading javascript from [
http://localhost:8080/struts2-showcase-2.0.12/struts/niftycorners/nifty.js]
status=[404 Not Found]
Dec 1, 2008 5:30:59 PM com.gargoylesoftware.htmlunit.html.HtmlPage
loadJavaScriptFromUrl
SEVERE: Error loading javascript from [
http://localhost:8080/struts2-showcase-2.0.12/struts/niftycorners/nifty.js]:
com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException: 404 Not Found
for **
http://localhost:8080/struts2-showcase-2.0.12/struts/niftycorners/nifty.js*<http://localhost:8080/struts2-showcase-2.0.12/struts/niftycorners/nifty.js>
*        at
com.gargoylesoftware.htmlunit.html.HtmlPage.loadJavaScriptFromUrl(HtmlPage.java:845)
        at
com.gargoylesoftware.htmlunit.html.HtmlPage.loadExternalJavaScriptFile(HtmlPage.java:775)
        at
com.gargoylesoftware.htmlunit.html.HtmlScript.executeScriptIfNeeded(HtmlScript.java:229)
        at
com.gargoylesoftware.htmlunit.html.HtmlPage.notifyNodeAdded(HtmlPage.java:1409)
        at
com.gargoylesoftware.htmlunit.html.DomNode.appendChild(DomNode.java:603)
        at
com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.startElement(HTMLParser.java:406)
        at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown
Source)
        at
org.cyberneko.html.filters.DefaultFilter.startElement(DefaultFilter.java:179)
        at
org.cyberneko.html.filters.NamespaceBinder.startElement(NamespaceBinder.java:286)
        at
org.cyberneko.html.HTMLTagBalancer.callStartElement(HTMLTagBalancer.java:1009)
        at
org.cyberneko.html.HTMLTagBalancer.startElement(HTMLTagBalancer.java:639)
        at
org.cyberneko.html.HTMLScanner$ContentScanner.scanStartElement(HTMLScanner.java:2407)
        at
org.cyberneko.html.HTMLScanner$ContentScanner.scan(HTMLScanner.java:1881)
        at org.cyberneko.html.HTMLScanner.scanDocument(HTMLScanner.java:809)
        at
org.cyberneko.html.HTMLConfiguration.parse(HTMLConfiguration.java:478)
        at
org.cyberneko.html.HTMLConfiguration.parse(HTMLConfiguration.java:431)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
        at
com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.parse(HTMLParser.java:346)
        at
com.gargoylesoftware.htmlunit.html.HTMLParser.parse(HTMLParser.java:229)
        at
com.gargoylesoftware.htmlunit.DefaultPageCreator.createHtmlPage(DefaultPageCreator.java:112)
        at
com.gargoylesoftware.htmlunit.DefaultPageCreator.createPage(DefaultPageCreator.java:85)
        at
com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient.java:441)
        at
com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:345)
        at
com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:399)
        at test.main(test.java:27)
test finish!
[ljx@MRObj-lnx32-06 test]$
*
*I guess that it need the file nifty.js. However, why I can visit the page
from browser normally. Do I missed something in my test case?*
*
* *My test case as follows:*
**
import java.io.*;
import java.net.URL;
import com.gargoylesoftware.htmlunit.Page;
import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
import com.gargoylesoftware.htmlunit.JavaScriptPage;
import com.gargoylesoftware.htmlunit.javascript.*;
import com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine;
import com.gargoylesoftware.htmlunit.*;

public class test{

        public static void main(String args[]){
                System.out.println("test start!");
                try{
                        final URL url = new URL("
http://localhost:8080/struts2-blank-2.0.12/example/Menu.jsp");
                        final WebClient webClient = new WebClient();
                        final HtmlPage page =
(HtmlPage)webClient.getPage(url);
                        System.out.println(page.getTitleText());
                }catch(Exception e){}
                try{
                        final URL url_2 = new URL("
http://localhost:8080/struts2-showcase-2.0.12/tags/non-ui/debug.jsp");
                        final WebClient webClient_2 = new WebClient();
                        final HtmlPage page_2 =
(HtmlPage)webClient_2.getPage(url_2);
                }catch(Exception e){}
                System.out.println("test finish!");
        }
}

*Please help me.*

*Thanks a lot,*
*Jingxuan*

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message