I'm using Java EE for an enterprise application on Glassfish.
I have some xhtml files in WEB-INF to prevent direct URL access. Those files are displayed by a servlet like this:
request.getRequestDispatcher("/WEB-INF/HiddenFile.xhtml").forward(request, response);
The only problem I'm experiencing is that the expression language in those files that references some managed beans is not getting evaluated.
Any help on getting the Expression Language evaluation for those files is greatly appreciated.
Thanks in advance
EDIT
I didn't consider the information useful but since it has been requested here it is.
The page to be displayed, WEB-INF/HiddenFiles/FileA.xhtml
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html">
<h:head>
<title>PAGE A</title>
</h:head>
<h:body>
A - #{testBean.testString}
</h:body>
</html>
The extract from the servlet responsible of producing a response:
public class RedirectorServlet extends HttpServlet {
/**
* Processes requests for both HTTP <code>GET</code> and <code>POST</code>
* methods.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
if (logic()) {
request.getRequestDispatcher("/WEB-INF/HiddenFiles/fileA.xhtml").forward(request, response);
} else {
request.getRequestDispatcher("/WEB-INF/HiddenFiles/fileB.xhtml").forward(request, response);
}
*other methods including logic()*
}
The web.xml in WEB-INF:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd">
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>RedirectorServlet</servlet-name>
<servlet-class>servlet.RedirectorServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>RedirectorServlet</servlet-name>
<url-pattern>/RedirectorServlet</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>faces/index.xhtml</welcome-file>
</welcome-file-list>
</web-app>