Pessoal!!
Estou com erro na chamada de uma página que traz um menu dinâmico à partir de uma jsp.
INDEX.jsp
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<html>
<head>
<title>Welcome to PizzaRia!!!</title>
<link rel="stylesheet" type="text/css"
href="<%= request.getContextPath() + "/Styles.css" %>">
</head>
<form id="myForm">
<table border="0" cellspacing="4" cellpadding="0"
<tr>
<td colspan="2">
<%-- The header --%>
<%@ include file="header.jsp"%>
</td>
</tr>
<tr>
<td valign="top">
<jsp:include page="/lojavirtual/menu.jsp" />
</td>
<td valign="top">
<!--------------- the beginning of the Welcome page ------------->
<br>
<div class="NormalLarge">Sistema de Vendas On-Line!!!</div>
<br>
<%--<div class="NormalSmall">Try our tasty pizzas today!</div>--%>
<!--------------------- the end of the Welcome page ------------->
</td>
</tr>
<tr>
<td colspan="2">
<%-- The footer --%>
<%@ include file="footer.jsp"%>
</td>
</tr>
</table>
</form>
</html>
Menu.jsp
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<!-- the main table containing two other tables:
Search table and Browse table -->
<table border="0" cellpadding="0" cellspacing="0"
<%--width="<h:outputText value="initParam.menuWidth"/>">--%>
<tr>
<td>
<!-- the Search table -->
<table cellspacing="0" cellpadding="1" width="100%"border="0" class="OuterTable">
<tr>
<td>
<table cellspacing="0" cellpadding="5"
width="100%" border="0" class="InnerTable">
<tr>
<td class="MenuHeader">Busca</td>
</tr>
<tr valign="middle">
<td rowspan="2">
<h:outputText value="Busca:"/>
<h:inputText id="varBusca" value="#{Busca.varBusca}" title="busca" />
<h:commandButton action="busca" value="Busca">
<f:actionListener type="AppActionListener"/>
</h:commandButton>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<!-- space between the Search table and Browse table --> <tr>
<td height="7"></td>
</tr>
<tr>
<td>
<!-- the Browse table -->
<table cellspacing="0" cellpadding="1"
width="100%" border="0"
class="OuterTable">
<tr>
<td>
<table cellspacing="0" cellpadding="5" width="100%"
border="0" class="InnerTable">
<tr>
<td class="MenuHeader">Categorias</td>
</tr>
<tr valign="top">
<td>
<h:outputText value="#{CategoriaMenu.menu}"/>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
ManagedBean CategoriaMenu.java
package loja;
import beans.Categoria;
import java.util.ArrayList;
import java.util.Iterator;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import org.hibernate.Session;
import util.HibernateUtil;
public class CategoriaMenu {
private beans.CategoriaFacade categoriafacade;
String menu;
long ultimoRefresh;
String browsePage = "/lojavirtual/ProdutosCategorias";
int updateInterval = 1; // in minutes
public CategoriaMenu() {
updateMenu();
}
public String getBrowsePage() {
return browsePage;
}
public void setBrowsePage(String page) {
browsePage = page;
}
public int getUpdateInterval() {
return updateInterval;
}
public void setUpdateInterval(int interval) {
updateInterval = interval;
}
public String getMenu() {
long now = System.currentTimeMillis();
if (now > ultimoRefresh + ultimoRefresh * 60 * 1000)
updateMenu();
return menu;
}
private void updateMenu() {
// get DatabaseUtil instance
HibernateUtil.beginTransaction();
Session session = HibernateUtil.currentSession();
ExternalContext ec = FacesContext.getCurrentInstance().getExternalContext();
HttpServletRequest request = (HttpServletRequest)ec.getRequest();
StringBuffer buffer = new StringBuffer(512);
buffer.append("<table>\n");
ArrayList categorias = (ArrayList) categoriafacade.getCategorias();
Iterator iterator = categorias.iterator();
while (iterator.hasNext()) {
Categoria categoria = (Categoria) iterator.next();
buffer.append("<tr><td>");
buffer.append("<a href=\"" + browsePage + "?cod_cat=" +
categoria.getCod_cat() + "\">" + categoria.getDescricao() +
"</a>");
buffer.append("</td></tr>\n");
}
buffer.append("</table>\n");
menu = buffer.toString();
ultimoRefresh = System.currentTimeMillis();
HibernateUtil.commitTransaction();
}
}
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Exception in JSP: /index.jsp:19
16: </tr>
17: <tr>
18: <td valign="top">
19: <jsp:include page="/lojavirtual/menu.jsp" />
20: </td>
21: <td valign="top">
22:
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:504)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
util.Filtro.doFilter(Filtro.java:30)
root cause
org.apache.jasper.JasperException: Exception in JSP: /lojavirtual/menu.jsp:21
18: </tr>
19: <tr valign="middle">
20: <td rowspan="2">
21: <h:outputText value="Busca:"/>
22: <h:inputText id="varBusca" value="#{Busca.varBusca}" title="busca" />
23: <h:commandButton action="busca" value="Busca">
24: <f:actionListener type="AppActionListener"/>
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:504)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:966)
org.apache.jsp.index_jsp._jspService(index_jsp.java:84)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
util.Filtro.doFilter(Filtro.java:30)
root cause
javax.servlet.ServletException: Cannot find FacesContext
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:858)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:791)
org.apache.jsp.lojavirtual.menu_jsp._jspService(menu_jsp.java:138)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:966)
org.apache.jsp.index_jsp._jspService(index_jsp.java:84)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
util.Filtro.doFilter(Filtro.java:30)
root cause
javax.servlet.jsp.JspException: Cannot find FacesContext
javax.faces.webapp.UIComponentTag.doStartTag(UIComponentTag.java:405)
com.sun.faces.taglib.html_basic.OutputTextTag.doStartTag(OutputTextTag.java:155)
org.apache.jsp.lojavirtual.menu_jsp._jspx_meth_h_outputText_0(menu_jsp.java:154)
org.apache.jsp.lojavirtual.menu_jsp._jspService(menu_jsp.java:83)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:966)
org.apache.jsp.index_jsp._jspService(index_jsp.java:84)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
util.Filtro.doFilter(Filtro.java:30)
note The full stack trace of the root cause is available in the Apache Tomcat/5.5.17 logs.
São as páginas, o bean e o erro mostrado, se alguem pudem me ajudar agradeço