This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I have had this issue once, to read a resource from a different technology from within a servlet filet (or a normal servlet too). in my case my servlet (filter) needed to call a facility in a proprietary product that was running on the same server, and was also calling JSP based service. But the concept is the same for your situation, to have a JSP page call the CGI on a different server. Assuming that you can build a URL with get parameters and you are able to interpret the results of the CGI in a meaningful way in your code, this approach may also work for you.
What I did was create an HTTP URL connection from inside my request to physically retreive the HTTP URL request of the other system, and then interpret the results into my handling.
here is a snippet of my code that would make a HTTP URL call out to the other server. I spent most of the time generating the URL to invoke the call and pass parameters from a servlet filter configuration. The resulting page was an XML file, so i stuffed it into an XML parser.
Disclaimer: this solution may be somewhat hackish, but was the best for my situation. This may have some performance and scaleablility issues with large amounts of users or heavy site loads, as every request that uses it would in turn create a HTTP request to another web server, which causes the original request to block until the nested htttp request is finished. You may also be able to use a HTTP client toolkit, such as jakarta commons http client instead of the java.net one like I used.
Error: Keyboard not attached. Press F1 to continue.