Hey!

>So it is the applet which gets the HTML document and not the
browser...

It's very hard to parse HTML.  That's a browser's job and it's a
dirty one.

As Nic suggests you need to change your design.

I use JApplets but I authenticate first using HTML form.
Then I make the JApplet available in the HTML that
can be sent back from the login servlet.  Now my
JApplet can go to another servlet to get required data
for complex presentation/manipulation in the JApplet
or HTML (i.e.,showDocument()) for simple presentation.

Applets, HTML and servlets work nicely together, but
effort must be expended to understand it.

BTW, this step is not necessary.

>I sure could have saved the o/p of the servlet in a temp file and
>used the showDocument method of the applet to load this temp file

Just stream the output from the servlet.  Check the archive on how
to do this.

Sans adieu,
Danny Rubis

Nitin Kulkarni wrote:

> Dear Friends
>
> Thanks for your replies and I am sorry that I did not ask the questoin
> correctly or may be completely. Sorry for a slightly long mail but I am
> trying to make the problem clearer.
>
> I sure know the getAppletContext.showDocument() method. But here I think
> everybody has missed the point that the initial applet is an authentication
> applet which is supposed to send the userid and password to the servlet and
> then the servlet generates the next page if the user is authentic user and
> writes to the outputstream which happens to be the input stream of the
> applet. So it is the applet which gets the HTML document and not the
> browser. I sure could have saved the o/p of the servlet in a temp file and
> used the showDocument method of the applet to load this temp file. But then
> what happens in a multiuser scenario (how many temp files can I create) and
> more importantly if I use this method what prevents the user from
> bookmarking this page and bypassing the authnetication process the next time
> he/she visits the site. Even if choose not to create the temp file and call
> the servlet directly as suggested in the mail below,how do I make sure that
> the correct page is sent back, because the servlet may develop two
> pages(error page or the next page) and again bookmarking problem is still
> there. Right?
>
> I hope I have made the problem clearer now. I am looking for a solution in
> the context of the above problem.
>
> Regards
>
> Nitin
> nitin
>
> >From: David Harkness <[EMAIL PROTECTED]>
> >Reply-To: [EMAIL PROTECTED]
> >To: [EMAIL PROTECTED]
> >Subject: TECH: Servlets : How to do this
> >Date: Thu, 08 Jun 2000 16:01:30 -0700
> >
> >Hi,
> >
> >It's been a while since I've worked with applets, but if I understand you
> >correctly, the solution is simple.
> >
> >You have an HTML page with an embedded applet.  You want the applet to tell
> >the browser to display a new HTML page which happens to be the result of
> >calling a servlet.  Correct?
> >
> >If so, simply use the Applet API to get a reference to its context and tell
> >the browser to call the servlet, providing the appropriate URL.  The
> >browser
> >will do everything from there:  open a connection, execute the servlet,
> >retrieve the output, and finally display the result.
> >
> >Peace,
> >Dj
> >
> >David Harkness
> >Tech Lead, Web Group
> >T o p i c a , i n c .
> >[EMAIL PROTECTED]
> >
> >-----Original Message-----
> >From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> >Sent: Wednesday, June 07, 2000 9:47 PM
> >To: [EMAIL PROTECTED]
> >Subject: TECH: Servlets : How to do this
> >
> >
> >
> >Dear friends
> >
> >I have an applet which is talking to a servlet. The applet has following
> >
> >piece of code
> >
> >servletConnection.setDoInput(true);
> >servletConnection.setDoOutput(true);
> >
> >Then there is a method called
> >readServletResponse(servletConnection);          which reads the response from
> >the
> >servlet.
> >
> >If I comment out the the call to this methos the communication does not
> >take
> >place So I have to cal this method. Why is this?
> >
> >However my original problem is that after I send the data to the servlet
> >.
> >the servlet authenticates the user and dynamically generates a new HTML
> >page
> >and writes it to the o/p stream.  I was expecting the HTML page to be
> >displayed. In normal circumstances the data is sent to the browser which
> >
> >knows how to parse this data.
> >
> >But in my case this o/p stream is connected to the applet therefore the
> >applet receives this data and does not know what to do with it.
> >
> >In short in applet-servlet scenario how do I load a new HTML page on the
> >
> >users browser?
> >
> >Any help?
> >
> >Nitin
> >
> >Amit Karmakar
> >List Administrator
> >To post a message: [EMAIL PROTECTED]
> >You can unsubscribe from this list at any time by sending a blank message
> >to [EMAIL PROTECTED] or
> >Visit http://www.topica.com/lists/Pune-Java
> >___________________________________________________________
> >T O P I C A  The Email You Want. http://www.topica.com/t/16
> >Newsletters, Tips and Discussions on Your Favorite Topics
> >
>
> ________________________________________________________________________
> Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com
>
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to