• Post Reply Bookmark Topic Watch Topic
  • New Topic

external forward?

 
Mark Robert Ferguson
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a form that submits to a jsp which captures all the form data and populates a database. However I need to forward all this form data to a cgi script which then does some more processing of the data. (Previously the form submitted directly to the cgi-script - my jsp was simply supposed to interupt that process). It seems that normal forwards can only be done within the Java application's context, and normally a redirect is used to go external. Is there any known way to trick the application into 'forwarding' out side the app, i.e. within the web.xml etc. I also wondered about using a symbolic link from inside the app file sys to the cgi file somewhere else on the same server? The cgi script expects post so can't see using redirect/GET and the script can't be modified. Any thoughts would be appreciated.
I did have this process working in php but now need to rewrite in java/jsp.
thanks.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65533
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Mark Robert Ferguson:
I have a form that submits to a jsp which captures all the form data and populates a database.

Why not a servlet? JSP is not meant for such processing.

And you are correct, a forward must occur within the Java context. Perhaps you could investigate spawning a thread that triggers the CGI processing, and when that thread completes, perform the forward from your Java code.

I'm assuming that the CGI processing happens quickly enough that blocking the Java thread shouldn't be a performance issue.

Again, factor this out of JSP -- that way lies madness -- and into a servlet where Java code belongs.
[ April 03, 2008: Message edited by: Bear Bibeault ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!