Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


getting value in servlet

Posted on 2004-10-21
Medium Priority
Last Modified: 2010-04-01
   I have
       <td><%=Name%></td>(name is like java,C)
<td>select name="rating">
 <option value="<%=ratId%><%=ratname%></option>
This is also dynamic,
I want both value in servlet
  nameId  and ratId,
basically , how to send nameId because it is lable..
Thanks in advance...
Question by:Manish
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
LVL 35

Expert Comment

ID: 12371113

Can you explain a bit more?

> I want both value in servlet
>  nameId  and ratId,

what is nameId?  Do you mean "Name"?  

Is this in a form?  Does the form post to a servlet?


>   <option value="<%=ratId%><%=ratname%></option>

did you mean:

 <option value="<%=ratId%>"><%=ratname%></option>


That example JSP contains quite a few errors for such a small bit of code ;-)

LVL 11

Author Comment

ID: 12379152
   I m getting values from database ..
nameId, Name
ratId and ratingName..
I m displaying these value like this
<td><%=Name%></td> and rating in combbox
<td>Rating <select name=rating>
                 <option value="<%=ratId%>"<%=ratingName%></option>
This is in form..
   My problem is how can I get nameId in serlvet
and corrouponing selected rating ..as
I m diplaying name in td ,

LVL 35

Accepted Solution

TimYates earned 150 total points
ID: 12379186
again, that isn't valid HTML...

Do you mean like this:

<td><%=Name%></td> and rating in combbox
  <input type="hidden" name="nameId" value="<%= nameId %>">
<td>Rating <select name=rating>
                 <option value="<%=ratId%>"><%=ratingName%></option>
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

LVL 11

Author Comment

ID: 12379236
I want to ask where to store nameId so that I cant get it in servlet...with corrousponding selected ratId
as these are dynamic ,means it is one or more..

Assisted Solution

siliconeagle earned 150 total points
ID: 12401977
the best place is to store it is in the session :-
<% request.getSession().setAttribute("nameId",nameId ) %>

then when you need it in the next servlet/jsp you use :-
<%=(String) request.getSession().setAttribute("nameId",nameId ) %>

this way the data is stored on the server but only available to requests from the same browser. So you dont have to store the value in the page you store it in the session and its always available for that user.
LVL 11

Author Comment

ID: 12432658
I stored with ratId , so I also get nameId along with
selected ratId...

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

One of the most important things in an application is the query performance. This article intends to give you good tips to improve the performance of your queries.
With so many activities to perform, Exchange administrators are always busy in organizations. If everything, including Exchange Servers, Outlook clients, and Office 365 accounts work without any issues, they can sit and relax. But unfortunately, it…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question