hi experts,

<a href="http://www.example.com"> goods </a>

this is the hyperlink i have to used for example.

i want to get the term 'goods' in the above hyperlink through jsp if i will click 'goods'.

can i get the term in jsp like the below snippet??

<% String goods=request.getParameter("goods");
%>

or else what can i do to get the term 'goods' through jsp??

i am waiting for your reply....

if your parameter "goods" is fixed then you just rewrite url like <a href="http://www.example.com?value=goods"> goods </a> then get "goods" like this... <% String goods=request.getParameter("value");%> other ideas also available if the parameters are dynamic.

you should study how to get the parameters in jsp.

thanks musthafa..

i got the idea

This is the snippet for html file

<li><a href="#">Electronics</a>
<ul>
<li><a href="">Mobile Phones</a></li>
<li><a href="">Television</a></li>
<li><a href="">Air Conditioners</a></li>
<li><a href="">Photo & Optics</a></li>
<li><a href="">Audio Systems</a></li>
</ul>
</li>

And there is one jsp file called electronics.jsp.. If i click any one of the above, it should be go to electronics.jsp but only specific code should bo displayed corresponding to the link I have clicked not the entire page..

How can I achieve this?? please help..

Thanks in advance,

in your link tags, just do exactly what musthafa.aj has said.

<li><a href="#">Electronics</a>
<ul>
<li><a href="electronics.jsp?value=Mobile">Mobile Phones</a></li>
<li><a href="electronics.jsp?value=TV">Television</a></li>
<li><a href="electronics.jsp?value=AirCon">Air Conditioners</a></li>
<li><a href="electronics.jsp?value=Photo">Photo & Optics</a></li>
<li><a href="electronics.jsp?value=AudioSys">Audio Systems</a></li>
</ul>
</li>

In your electronics.jsp file, make sure that you have the following;

if( request.getParameter("value") != null){
    String electronicType = "";

    if(request.getParameter("value") == "Mobile"){electronicType = "Mobile Phone";}
    if(request.getParameter("value") == "TV"){electronicType = "...";}
    if(request.getParameter("value") == "AirCon"){electronicType = "...";}
    if(request.getParameter("value") == "Photo"){electronicType = "...";}
    if(request.getParameter("value") == "AudioSys"){electronicType = "...";}
}

Except that don't use == operator for comparing strings; use the equals/equalsIgnoreCase method instead.

how to retrive data when user clicked on one of element in <ul> <li> </li> </ul> list from mysql in jsp