Forums Register Login

How to read cookie through JSP?

+Pie Number of slices to send: Send
Hi Everybody,
I was working on some application which needs to put some information in cookies. I have created the following scenario.
1. Asked some info from user through a JSP file
2. Called a Server on submitting above and made one cookie through it and redirect it to another JSP
3. This next JSP will read the cookie from the machine and will do the required processing.
But to my dipointment I am not able to pick a cookie which is crewated by servlet. Could do same if I make a cookie through JSP only. My questions are:-
1. Can't A Servlet cookie can be picked by JSP and vice-versa.
2. If not is it because both are stored on the different location(directories) of same server. Perhaps different containers are making differance.
3. Can there be some work around for it?
4. I heard about some concept about Web Applications(I don't know even ioita of it) can it be used here? if yes can you pl provide me some reference sites.
regards,
arun
+Pie Number of slices to send: Send
1. There is no difference between JSP and Servle cookies since JSP turn into servlets anyway.
2. Bingo! The likely cause is that the "web applications" are different.
3. You could write a page with a form and hidden variables and a "click here to continue" button.
4. See the servlet API, download from java.sun.com.
Bill
+Pie Number of slices to send: Send
Thanks William for your reply. Perhaps I am missing at basics and have a bit nore questions:-
1. What do you mean by web application?
2. I am running JRUN. and storing JSp in somewhere in default-app folder while servlets are in defual-app/web-inf/classes folder. Does it make different containers for both?
3. How can I put both servlets and JSP in same container or web application?
I would be highly obliged if you could provide me some reference links for same.
regards,
arun
+Pie Number of slices to send: Send
The best way to understand the implications of "web application" is to download the Servlet and JSP APIs from java.sun.com.
As I recall, the JRun documentation has some discussion of the topic also, assuming you have JRun 3.0 or later.
I think you would have better luck attaching the info to a session and forwarding to the JSP rather than redirecting. I don't remember is a browser will ignore cookie data when it gets a redirect.
Bill
CAUTION! Do not touch the blades on your neck propeller while they are active. Tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1573 times.
Similar Threads
response.sendRedirect(URL) Vs. RequestDispatcher
Generating lockCookie
doubt in request,response headers and flow
Cookies not persistent ... how can it be?
inconistent session time-out,cookie name change is not a option
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 08:51:44.