Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How will i identify two hyperlink in one Servlet program.

 
Ritesh raushan
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i created a two hyperlink one is <a href="pageurl">next</a> and
other is<a href="pageurl">previous</a>.
my question is How will i identify two hyperlink(written above) in one Servlet program.
means if request comes from "next" hyperlink then do something and
and if comes from "previous" hyperlink then do something.
 
Ayan mallick
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
one way is to add a queryparam along with url like
<a href="pageurl?link = next">next</a>
<a href="pageurl?link = previous">previous</a>

now inside servlet you can get it from request
if(request.getParameter("link").equals("next")){
// do next stuff

}

else if(request.getParameter("link").equals("previous")){
// do previous stuff

}
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic