Hi Deniz,


I think other people will have a better solution for your email,  I just
did the following testing :-)

0
   a    in the sample code of a book -- "Mastering EJB and ..."
         of Ed Roman -- [ISBN 0-471-33229-1], I find the following
         line:
         response.sendRedirect(response.encodeUrl("<sevlet name>"));
   b    I write two Servlet class -- servlet_ht and servlet_ht2
   c    I write a Java Application which communicates to
         servlet_ht.  ( I guess perhaps "Applet Servlet
         Communication" is similar with "Application Servlet
         Communication"  )
   d
         *  I use J2SE1.3 + Jsdk2.1 as Servlet engine
         *  I use J2SE1.3  to run my Java Application

1
   [a]      first I did a testing -- my Application [send + read]  --
        *   in my Application, first I send a String to servlet_ht, so now
            "doPost" of servlet_ht has been "invoked".
        *   then in "doPost" of servlet_ht, first I "read" this String, then
             INSTEAD OF send back something to my Application
             directly,  I use the following:
            response.sendRedirect(response.encodeUrl("/servlet/servlet_ht2"));
        *   now  the "doGet" of servlet_ht2 has been "invoked", and I send back

            another String to my Application in "doGet" of servlet_ht2.
        *   then my Application read this String.

   [b]     I also did another kind of testing -- my Application [only read] --
        *   in my Application, first I try to read a String from servlet_ht, so
now
            "doGet" of servlet_ht has been "invoked".
        *   then in "doGet" of servlet_ht, INSTEAD OF send back something to
            my Application directly,  I also use the following:
            response.sendRedirect(response.encodeUrl("/servlet/servlet_ht2"));
        *   now  the "doGet" of servlet_ht2 has been "invoked", and I send back

            another String to my Application in "doGet" of servlet_ht2.
        *   then my Application read this String.

    [c]     So from my testing [a] and [b], BOTH in "doGet" or "doPost"
             of servlet_ht,  I all can "sendRedirect" to servlet_ht2.  This
             is different from what you described in your email, please
             try :-)

2
BTW,  now I find a mistake in one of my emails about one month ago :-)
NOW I think in "Applet/Application Servlet Communication", we can
"invoke" both "doGet" and "doPost" with "URLConnection/HttpURLConnection",
but it depends on what we do in our Applet/Application --
     [a]    if we don't explicitly set  "GET/POST" with
             HttpURLConnection.setRequestMethod("GET/POST");
             then:
             *  if we first "read",   then "doGet" will be "invoked" ;
             *  if we first "send",  then "doPost" will be "invoked" ;
     [b]    We also explicitly set  "GET/POST" with
             HttpURLConnection.setRequestMethod("GET/POST");


3
and I have a question:
How can I "invoke" the "doPost" of servlet_ht2  FROM  servlet_ht
with the following ?
response.sendRedirect(response.encodeUrl("/servlet/servlet_ht2"));

Because now I find I only can invoke "doGet" of servlet_ht2 :-)


Thanks in advance!


Bo
Oct.08, 2000







Deniz Demir wrote:

> Hi,
>
> I have written a servlet and applet for login process. they communicate
> with each other by URLConnection. I want to get a new page after
> conversation. I have read so many archived mails of this mail list. I
> orginaly wanted to use sendRedirect() after communication, since the
> URLConnection is made in doPost method, I tried to sendRedirect in
> doPost method. But it didn't work. And then I gave up and I tried to use
> applet's showDocument() method. But in this case the following page (a
> jsp) had a different session ID, so I could not get the objects which I
> put into session in servlet.
>
> I could not find any solution, what can I do?
>
> Deniz...
>
> ___________________________________________________________________________
> 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