wood burning stoves 2.0*
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 Murach's Java Servlets and JSP this week in the Servlets 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: 41034
    
  43
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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to forward a response to JSP after recieving some data from an applet via URL connection
 
Similar Threads
applet - servlet communication
HELP! Applet's trouble with Servlet's response
not able to send data
Applet to Servlet Communication (only two ways?)
Signed applet talking to server other than its own