aspose file tools*
The moose likes Servlets and the fly likes Redirect from servlet to html (or php) web? 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 "Redirect from servlet to html (or php) web?" Watch "Redirect from servlet to html (or php) web?" New topic
Author

Redirect from servlet to html (or php) web?

Daniel Rodriguez Hernandez
Greenhorn

Joined: Nov 26, 2009
Posts: 13
Hi everybody..

It is my problem.. I have an applet that connects against Servlet for authentification stuff.. If authentificacion is good, I need servlet sends the ID of authentified user to the external Web.

I tried in servlet:
- RequestDispatcher.
- response.sendRedirect
even - PrintWriter out = response.getWriter(); and create an auto-submit form with javascript..

Nothing... When I runs the applet, I used it to authentify, but the servlet doesn't redirect to the new web..
Is possible that the problem was I runs an applet, so the servlet returns the form, or RequestDispatcher to that applet and not to the browser??

I could redirects from Applet, but It had security problems...

Any idea?

Thank you so much.


Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41572
    
  54
How is the applet connecting to the servlet - using (Http)URLConnection? If so, then nothing the servlet does will cause the web page to change. The applet needs to do that using Applet.showDocument. If the next web page needs parameters to work with, then those can be appended as GET parameters to the URL passed to the showDocument method.


Ping & DNS - my free Android networking tools app
Daniel Rodriguez Hernandez
Greenhorn

Joined: Nov 26, 2009
Posts: 13
Yes, the applet connects with servlet using HttpURLConnection.

Then, I must return the control to Applet, and redirects from it, ... is it? The Servlet can't redirects.

 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Redirect from servlet to html (or php) web?