getting value in servlet

   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...
LVL 11
Who is Participating?
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>

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 ;-)

ManishLeadAuthor Commented:
   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
I m diplaying name in td ,

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

ManishLeadAuthor Commented:
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..
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.
ManishLeadAuthor Commented:
I stored with ratId , so I also get nameId along with
selected ratId...
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.