I am trying to check for a file exists and then include the JSP file if true
. But I am getting errors from below code.
Syntax error on tokens, delete these tokens
file.handler cannot be resolved to a type
Syntax error on token "=", . expected
This is my code:
String uri = request.getRequestURI();
String pageName = uri.substring(uri.lastIndexOf("/")+1);
String filename = pageName.replace(".jsp", "");
String path = request.getServletPath();
path = path.replace( pageName , "");
String handler=path+"handler/"+filename+"_handler.jsp";
if(null != application.getResource(handler)){
<%@include file="${handler}"%>
}
I am a PHP programmer but I am new to JSP. Please advice