Passing dynamic string in hyperlink as parameter in jsp
Posted
by
user3660263
on Stack Overflow
See other posts from Stack Overflow
or by user3660263
Published on 2014-05-28T09:18:40Z
Indexed on
2014/05/28
9:25 UTC
Read the original article
Hit count: 236
I am trying to pass a dynamic string builder variable in jsp I am generating a string through code. String Builder variable has some value but i am not able to pass it in at run time.It doesn't get the value. CODE FOR VARIABLE
<% StringBuilder sb=new StringBuilder("");
if(request.getAttribute("Brand")!=null)
{ String Brand[]=(String[])request.getAttribute("Brand");
for(String brand:Brand)
{ sb.append("Brand=");
sb.append(brand);
sb.append("&&");
}
}
if(request.getAttribute("Flavour")!=null)
{
String Flavour[]=(String[])request.getAttribute("Flavour");
for(String flavour:Flavour)
{
sb.append(flavour);
sb.append("&&");
}
sb.trimToSize();
pageContext.setAttribute("sb", sb);
}
out.print("this is string"+sb);
%>
CODE FOR HYPERLINK
<a href="Filter_Products?${sb}page=${currentPage + 1}" style="color: white;text-decoration: none;">Next</a></td>
© Stack Overflow or respective owner