• Post Reply Bookmark Topic Watch Topic
  • New Topic

problem with getting dynamic input  RSS feed

 
srini kami
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All
I am working on servlets project, where user inputs some data with title and submits which goes to database. Once user sumbits title and data, title becomes html link. user can click on the link to see all the information he/she submitted under that title. All i have to do is give him all the information related to that link.
i have sql statement.
select * from 'database' where tile is 'variable' from database;
But my problem is how to replace variable with value he clicked on. How do i catch link he clicked on. If user types in something i know i can use 'req.getparameter("abc", abc) but links or parametrs are dynamic(as they are created by user)
I will appreciate if someone can help me with this.
 
Torsten Schippel
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Srini,
where do you process the request. I think you should link any request to one servlet. So you can use a links like <A href="http://.../MyServlet?variable=Title1>Title1<A>.
Than you can process any request in the doGet method of the servlet using req.getParameter("variable").
HTH
Torsten
 
R K Singh
Ranch Hand
Posts: 5390
1
Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if you dont want to pass param from link then you can also use
request.getRequestURI()
check the API there some other methods also to know the requested URL/URI
get the URI and then parse it
but I will recommend Torsten suggestion for obvious reasons.
 
srini kami
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you guys. I am going to try that. I appreciate your help.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!