Yes, you can get the value as below. But it is not good practice to hardcode the values in the URL.
~Santhosh
Madhuri Abhi
Greenhorn
Joined: Jun 29, 2011
Posts: 11
posted
0
Raj,
There is no error but nothing is shown in the page.
Santosh,
What i am actually doing is displaying the values in jsp page(in a table) from database. and when one of those fields is clicked, corresponding value should be shown.
To make it more clear, say suppose i have id(varchar), name(varchar) and content(blob) fileds in database. I get id and name in jsp page and display it in a table. when i click on the name, it redirects to a servlet thereby corresponding content should be displayed.
For this, i need to know which name he has clicked.
What i actually do in the below code is that i display the name field from database. and so when i click on any of the names in the jsp page, corresponding content should be shown.
Santhosh ayiappan wrote: But it is not good practice to hardcode the values in the URL.
~Santhosh
Then how to pass that id, please tell me if any methode is there thanks
Raj Kamal
Ranch Hand
Joined: Mar 02, 2005
Posts: 400
posted
0
You could use the parameter as a FORM field (hidden-field) if necessary. I do not see any issues with passing a parameter as part of the query string parameter. Parameters in GET requests go that way anyways.
Cheers,
Raj.
Prity Choudhary
Greenhorn
Joined: Apr 17, 2007
Posts: 1
posted
0
Hi Madhuri,
I am also working on exactly same requirement and stuck. Could you please let me know how did you resolved your issue.
Don't use java code inside jsp, its a very old practice. Look for JSTL,EL etc. You can pass any dynamic value in query string.
<c:set var="idval" value="10"/>
<a href=myservlet?id=<c:out value="${idval}"/>>