Reputation: 61
My URL is : /something/page.jsp?viewall=1&CategoryID=1
I want to get CategoryID
parameter value as follow.
<%
//String cat = "All";
String cat = request.getParameter("CategoryID").toString();
//String catID = catI.toString();
if(cat == "1")
{
cat = "Books";
}
else
{
cat = "something";
}
%>
I want to print value of cat
as follow
<%= cat %>
But it is still printing something
and according to code it must print Books
I don't know if there is any Data type problem or what . Please help me.
Upvotes: 0
Views: 9528
Reputation: 18952
This is a String value, so you need to use:
if (("1").equals(cat))
Upvotes: 1