Forums Register Login

dynamic parameters

+Pie Number of slices to send: Send
I am working on a project involving 2servlets, I can't figure out how to pass parameters from one servlet to another. I am trying pass parameter value in url.
Follwoing is the code segment

for (int i=0; i<titl.size(); i++) {

out.println("<p>" + "<a href=\"http://localhost:8080/test/servlet/DetlReq?Post_titl=param1\">" +(String)titl.get(i) + "</a>\n");

//titl is ArrayList

}
The code above gets all the values from arraylist amd makes them all into separate links.

In the above code the value of Post_titl(in this case 'param1') is dynamic, it could be any one the values from ArrayList titl.
Is there any API in java to capture value of the link user clicks on so i can pass it as value of Post_titl in the above URL?
If someone can help i will apprecaite it very much.
More info
Its like master/detail kind of process. Just like this forum user posts lot of data and title becomes link and rest goes to database. Once users clicks on link, the value of the link is passed to other servlet to get rest of the info from databse.
Is there any API in java to capture value of the link user clicks on?
[ July 08, 2003: Message edited by: srini kami ]
+Pie Number of slices to send: Send

You get the value from the response with
String title = resp.getParameter("Post_titl");
[ July 08, 2003: Message edited by: William Brogden ]
+Pie Number of slices to send: Send
Hi William
Thank you for the response but i think i wasn't clear enough. What i meant was how do i assign value to "Post_titl". So i can get it using String title = resp.getParameter("Post_titl"); just as you said.
The value to be assigned is the link value.
+Pie Number of slices to send: Send
I'm not clear on your problem. Whats wrong with assigning the value in the statement that writes the href= link?
Bill
Straws are for suckers. Now suck on this tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 928 times.
Similar Threads
Passing parameters
Passing parameter to servlet from another servlet
linking struts2 action to pre-existing pure Java servlet
Redirecting or Forwarding to another Portlet with Params
Parameter in Bean variable
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 02:50:37.