aspose file tools*
The moose likes Servlets and the fly likes How to forward a response to JSP after recieving some data from an applet via URL connection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "How to forward a response to JSP after recieving some data from an applet via URL connection" Watch "How to forward a response to JSP after recieving some data from an applet via URL connection" New topic
Author

How to forward a response to JSP after recieving some data from an applet via URL connection

Pira Tomatsu
Greenhorn

Joined: Sep 01, 2009
Posts: 14
The JFileChooserApplet sends selected files name to this Servlet via URL connection. And I want this Servlet to write selected files(pictures) name in <param> tags for another applet to display. Any advices for me?

I'm so new to servlet & JSP. Please clearly explain the solutions. Thanks a lot.

This code got this error: java.lang.IllegalStateException: Cannot forward. Response already committed.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41574
    
  54
It doesn't make sense for the servlet to do a forward to some other JSP - the output would be accessible to the applet through the URLConnection, but it wouldn't be displayed anywhere. Instead, the servlet should store all pertinent data as session (or application) attributes, and then return to the applet an URL that can be used to access the display.jsp page, most likely including one or more URL parameters that tell the JSP what to do. The applet would then use the AppletContext's showDocument method to replace the page containing the applet with display.jsp. (It could also open a new window using the two-parameter showDocument method if you still want the applet to be visible.)


Ping & DNS - my free Android networking tools app
Pira Tomatsu
Greenhorn

Joined: Sep 01, 2009
Posts: 14
Please provide me some examples. I'm not clearly understand. Thank you very much
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: How to forward a response to JSP after recieving some data from an applet via URL connection