link to servlet

Hi, i have 2 links that load a servlet, i want to difference them in the servlet, i mean i want the servlet know which was the link that called him......i was trying to use the id attribute in the link...but i cant figure out how to use it in the servlet....is there any other way to do it?

<a href="/myservlet" target="marcoder" id="reg">

Do something

</a>

<a href="/myservlet" target="marcoder" id="reg">

Do something

</a>

protectedvoid processRequest(HttpServletRequest request, HttpServletResponse response)

throws ServletException, IOException{

?

}

[947 byte] By [pompeighuIIa] at [2007-11-27 5:48:10]
# 1
use <a href="myservlet" target="marcoder" id="reg">
RahulSharnaa at 2007-7-12 15:33:21 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

I am sure there must be a way for using the id attribute but I will tell you a better way of doing that

write ur code as following :

<a href="/myservlet?ID=A" target="marcoder" id="reg">

Clicked On A

</a>

<a href="/myservlet?ID=B" target="marcoder" id="reg">

Clicked On B

</a>

now in servlet :

String strFlag = request.getParameter("ID");

if(strFlag.equalsIgnoreCase("A"))

{

//Coming from Link A

}

else

{

//Coming from Link B

}

Hope this helps...

thanks

anurag_dasha at 2007-7-12 15:33:21 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...