Welcome Guest ( Log In | Register )

Outline · [ Standard ] · Linear+

 Adding cookies in servlet, Java

views
     
TSfelixwhoals
post Feb 22 2006, 01:15 AM, updated 20y ago

Casual
***
Junior Member
455 posts

Joined: Oct 2005
From: Birmingham, UK


Hey there,
Here is my code:

out.println("How do you want to display them: <select name=group1><option value=NormalDisplay>Normal display</option><BR>");
out.println("<option value=BookDisplay>Book Order</option><BR>");
out.println("<option value=AuthorDisplay>Author Order</option><BR>");
out.println("<option value=PubDisplay>Publisher Order</option></select><BR>");

Basically it's in a selection form. How am I going to add cookie on it?

I could add cookie for normal TEXT box:

String title = request.getParameter("Title");
if (title == null)
{ title = "";}
out.println("Title: <input type=text size=20 name=Title value="+title+">");
out.println("<br>");
Cookie titlename = new Cookie("title", title);
response.addCookie(titlename);

So can anyone help me how to add cookie for the selection option?

 

Change to:
| Lo-Fi Version
0.0121sec    1.10    5 queries    GZIP Disabled
Time is now: 24th December 2025 - 10:00 PM