I'm trying to create a dynamic web page showing different messages according to query string parameter, such as
http://localhost:8080/example?param=10
In my jsp page, to get the parameter i use
<%= request.getParameter("param") %>
and that correctly evaluates to the correct value. Then i try to combine this with some IFs clauses to switch to different content:
<% if (request.getParameter("param") == "10") { %>
<!-- show something -->
<%
}
%>
but this doesn't seem to work.
If i try
<%= if (request.getParameter("param") == "10") { %>
<!-- show something -->
<%
}
%>
i get an internal server error.
Which is the correct approach to show dynamic content evaluating the query string parameter?
Thanks