This week's book giveaway is in the Big Data forum.
We're giving away four copies of Elasticsearch in Action and have Radu Gheorghe & Matthew Lee Hinman on-line!
See this thread for details.
The moose likes Servlets and the fly likes How will i identify two hyperlink in one Servlet program. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "How will i identify two hyperlink in one Servlet program." Watch "How will i identify two hyperlink in one Servlet program." New topic
Author

How will i identify two hyperlink in one Servlet program.

Ritesh raushan
Ranch Hand

Joined: Aug 29, 2012
Posts: 100
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

Joined: Nov 17, 2012
Posts: 46
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

}
 
rocket mass heater kickstarter
 
subject: How will i identify two hyperlink in one Servlet program.