Passing dynamic string in hyperlink as parameter in jsp
- by user3660263
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>