• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 247
  • Last Modified:

getting value in servlet

Frds,
   I have
       <td><%=Name%></td>(name is like java,C)
<td>select name="rating">
 <option value="<%=ratId%><%=ratname%></option>
</select>
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...
Karan
0
Manish
Asked:
Manish
  • 3
  • 2
2 Solutions
 
TimYatesCommented:
Errrr....

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?

By:

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

Tim
0
 
ManishLeadAuthor Commented:
Ok,
   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 ,




 
0
 
TimYatesCommented:
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>
                  </select>
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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.

 
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..
karan
0
 
siliconeagleCommented:
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.
0
 
ManishLeadAuthor Commented:
I stored with ratId , so I also get nameId along with
selected ratId...
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now