jQuery in Action, 2nd edition*
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 Android Security Essentials Live Lessons this week in the Android 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: 44
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

}
 
 
subject: How will i identify two hyperlink in one Servlet program.
 
Similar Threads
[pages tags & jsp] - How can I make TOP and BOTTOM paging work?
Knowning which link was clicked (take 2)
declaration of pageNumber in "pg:pager" that is pager taglib
probelm in pager tab.
How to make a paging