> > 1. How do I expire a servlet after the view has
> > changed?
> Let's assume I click on a button that changes the page
> that is being displayed. As of now, when I click to go
> to the previous page, I am able to see the servlet
> like it was before. What should I do to make the
> browser display a "Page has expired" error?

See the archives.. You will find it answered many times over.


> >> 2. Can I make a servlet url that does not contain
> >> the string "Servlet" in it (ie) something like
> >> "http://localhost:8080/myProg/first" instead of
> >> "http://localhost:8080/myProg/servlet/first"?
> How do I make myProg as the context?

It depends upon what servlet container are you using.. You will have to
specify the doc base and the corresponding context. Then you will have to
follow the directory structure defined in section 9.4 of the servlet specs
ver 2.2.
If you specify the servlet container then you may get something more
specific.



> > 3. How do I append html code to a servlet that was
> > displayed in the previous view?
> As I asked in q1, if I click to see the previous page
> in the browser I am able to see the page. Now what
> should I do if I wanted to add some extra HTML code to
> that page?

What you want to do is to change the response based on the fact if  the
client has visited a page or not. Lets call these the page first and page
second. Now when ever a request for page first is received, the servlet
checks if the Value of the Http header "REFERER" is page second. Based on
this information it can generate the appropriate response. this is good if
you have a back button on the html. The clicking of the browser back button
may not work with this philosophy.
Another alternative that comes to mind is that you set a flag in the session
reflecting if the person has visited the page two. You always check this
flag when ever generating the response for the first page.


>
> > Look at the method HttpServletRequest.getSession().
> Let's assume a server that is serving 3 or more
> clients and that at a particular time 2 clients are
> invoking the same page. Now a session object is going
> to be created for each user. My servlet creates a
> cookie that contains the sessionID of each session.
> The cookies are set to be returned to the server
> whenever the client issues a request to the server.
> Now assume that the 2 clients are going to move to
> different pages. When I call getSession() for client2,
> will I get the session object of the client2 or are
> there any chances that I will get the session object
> of client1 instead? If the latter is likely, what
> should I do to get the session object of the client2?

You will get the session id of client 2 only. You do not need to handle the
cookie for session management. The servlet container should do that for you
on the server side and the browser on the client side.


Regds,
Gokul


>
> I hope I was clear enough.
>
> Bye,
> Arun.

___________________________________________________________________________
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