*
The moose likes Servlets and the fly likes How do I get the results of a cgi script in my JSP page? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "How do I get the results of a cgi script in my JSP page?" Watch "How do I get the results of a cgi script in my JSP page?" New topic
Author

How do I get the results of a cgi script in my JSP page?

David Ogasawara
Greenhorn

Joined: Oct 11, 2001
Posts: 13
Hi,
I am having trouble calling a cgi script within my JSP page.
How is this done?
I have a form where the user enters a username and password. When they press the submit button, the parameters are passed to a cgi script on a different server (http://e3.uci.edu/cgi-bin/voter.cgi) which returns a result of 1 or 0.
How do I integrate this into a JSP page so I can manipulate the results?
I think I am supposed to use "dopost," but I can't seem to find much information on it.
Any help would be GREATLY appreciated!
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15957
    
  19

Open a URLConnection just like you would if you were doing it from a standalone Java app.
Of course the extra delays of going through a second server may increase your chances of the user's browser timing out, so you may have to plan accordingly.


Customer surveys are for companies who didn't pay proper attention to begin with.
David Ogasawara
Greenhorn

Joined: Oct 11, 2001
Posts: 13
I'll give it a shot.
Thank you for pointing me in the right direction.
-Dave
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How do I get the results of a cgi script in my JSP page?
 
Similar Threads
JSP session problem
How to call a cgi/perl script from jsp/java bean
How to call a CGI URL from JSP
use of <bean:write> and <bean:message> ???
Redirecting from JSP to CGI