mercredi 23 décembre 2015

How to compare string in JSP

I'm trying to detect the name of the page index.jsp and compare it with the one I need.

<% 
String uri = request.getRequestURI();
String pageName = uri.substring(uri.lastIndexOf("/")+1);
if (pageName=="index.jsp"){out.println(pageName); }
out.println(pageName);
%>

It outputs - index.jsp, but does not do it twice, neither without out.println() functuion.

Aucun commentaire:

Enregistrer un commentaire