File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Testing and the fly likes [HTTPUNIT] Read a *.jsp file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » Testing
Bookmark "[HTTPUNIT] Read a *.jsp file" Watch "[HTTPUNIT] Read a *.jsp file" New topic
Author

[HTTPUNIT] Read a *.jsp file

jean chretiendetroie
Greenhorn

Joined: Jun 22, 2005
Posts: 4
Hi ,

I'am trying to fill a form which is on a jsp page. Yet it doesn't work.



Yet, i have an error :
java.net.UnknownHostException: jss
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)


IS it possible to fill a form on a jsp page with junit?
If the answer is yes , why is my code wrong.

thanks
Tim West
Ranch Hand

Joined: Mar 15, 2004
Posts: 539
Looks like your URL is wrong in the constructor to GetMethodWebRequest.

The String passed should be the URL that has the form you wish to fill in, i.e., something like:



The HTTPUnit cookbook should help.


-Tim
jean chretiendetroie
Greenhorn

Joined: Jun 22, 2005
Posts: 4
but , if i use a URL that does not end with .jsp . For instance, .com , it works ?
What i dont know is if it is possible to read a jsp page with the methode
WebRequest req1 = new GetMethodWebRequest( URL to a jsp page);
Tim West
Ranch Hand

Joined: Mar 15, 2004
Posts: 539
The URL you give will just be sent out with a HTTP GET command - like in a browser. That is, you can obtain with HTTPUnit any page you can with your browser.

There's no reason why you couldn't get a page with a '.jsp' extension - give it a go! Of course, you'll get the JSP output, not the text of the JSP itself. But this is probably what you want anyway.

As an aside, it sounds like you would benefit from doing some background reading on HTTPUnit.


-Tim
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: [HTTPUNIT] Read a *.jsp file
 
Similar Threads
Http Exception
HttpUnit- Installation
HttpUnit
THe code ,
HttpUnit help urgent........