Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within JSF
Search Coderanch
Advance search
Google search
Register / Login
This week's book giveaway is in the
Design and Architecture
forum.
We're giving away four copies of
Communication Patterns: A Guide for Developers and Architects
and have Jacqui Read on-line!
See
this thread
for details.
Win a copy of
Communication Patterns: A Guide for Developers and Architects
this week in the
Design and Architecture
forum!
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Ron McLeod
Paul Clapham
Devaka Cooray
Liutauras Vilda
Sheriffs:
Jeanne Boyarsky
paul wheaton
Henry Wong
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Tim Moores
Carey Brown
Mikalai Zaikin
Bartenders:
Lou Hamers
Piet Souris
Frits Walraven
Forum:
JSF
Error: Dynamic Menu + Richfaces + A4j
Benigno Sales
Greenhorn
Posts: 2
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi,
I´m having problems when i try to create a dynamic menu, getting the params from the data base.
Menu.xhtml
<a4j:outputPanel ajaxRendered="true" id="mainOutPutPanel"> <a4j:form> <rich:toolBar binding="#{indexBackingBean.menu}" itemSeparator="true"> <rich:menuItem action="#{indexBackingBean.setIndex}" value="Home"/> </rich:toolBar> <a4j:include id="principal" viewId="#{indexBackingBean.viewId}" /> </a4j:form> </a4j:outputPanel>
IndexBackingBean.java
public class IndexBackingBean { private String viewId = "principal.xhtml"; private HtmlToolBar menu = new HtmlToolBar(); public IndexBackingBean() throws SQLException { } public HtmlToolBar getMenu() { return menu; } public void setMenu(HtmlToolBar menu) { this.menu = menu; } public String getViewId() { return viewId; } public void setViewId(String paginaAtual) { this.viewId = paginaAtual; } public void setIndex() { this.viewId = "principal.xhtml"; } public void setCrudUsuario() { this.viewId = "crudUsuario.xhtml"; System.out.println("[ Changing page to crudUsuario.xhtml ]"); } public void carregaMenu() throws SQLException { List<Menu> menus = new ArrayList<Menu>(); List<HtmlDropDownMenu> htmlDropDownMenus = new ArrayList<HtmlDropDownMenu>(); Usuario u = (Usuario) Utilitario.getHttpSessionObject("usuario"); PermissaoDAO permissaoDAO = new PermissaoDAO(); List<Permissao> permissoes = permissaoDAO.buscaPermissoesPorPerfil(u.getPerfil()); System.out.println("[ Starting load menu ]"); for (Permissao permissao : permissoes) { Menu m = permissao.getMenu(); if (!menus.contains(m)) { menus.add(m); } } for (Menu m : menus) { List<HtmlMenuItem> htmlMenuItems = new ArrayList<HtmlMenuItem>(); FacesContext facesContext = FacesContext.getCurrentInstance(); for (ItemMenu itemMenu : m.getItensMenu()) { HtmlMenuItem htmlMenuItem = new HtmlMenuItem(); ELContext el = facesContext.getELContext(); Application app = facesContext.getApplication(); ExpressionFactory ef = app.getExpressionFactory(); MethodExpression methodExpression = ef.createMethodExpression(el, itemMenu.getViewId(), String.class, new Class[]{}); htmlMenuItem.setActionExpression(methodExpression); htmlMenuItem.setValue(itemMenu); htmlMenuItem.setSubmitMode("ajax"); htmlMenuItems.add(htmlMenuItem); } HtmlDropDownMenu htmlDropDownMenu = new HtmlDropDownMenu(); htmlDropDownMenu.setValue(m); htmlDropDownMenu.getChildren().addAll(htmlMenuItems); htmlDropDownMenus.add(htmlDropDownMenu); } menu.getChildren().addAll(htmlDropDownMenus); System.out.println("[ Menu loaded. ]"); }
The menu is loades, but when i click on a link of the menu, returns the follow error:
type Exception report message description The server encountered an internal error () that prevented it from fulfilling this request. exception javax.servlet.ServletException: Argument Error: Parameter text is null javax.faces.webapp.FacesServlet.service(FacesServlet.java:256) org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:206) org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290) org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388) org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515) org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390) root cause SEVERE: Servlet.service() for servlet Faces Servlet threw exception java.lang.NullPointerException: Argument Error: Parameter text is null at com.sun.faces.renderkit.html_basic.HtmlResponseWriter.writeText(HtmlResponseWriter.java:694) at org.richfaces.renderkit.html.DropDownMenuRenderer.doEncodeBegin(DropDownMenuRenderer.java:191) at org.richfaces.renderkit.html.DropDownMenuRenderer.doEncodeBegin(DropDownMenuRenderer.java:128) at org.ajax4jsf.renderkit.RendererBase.encodeBegin(RendererBase.java:100) at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:788) at org.ajax4jsf.renderkit.RendererBase.renderChild(RendererBase.java:275) at org.richfaces.renderkit.html.ToolBarRendererBase.encodeChildren(ToolBarRendererBase.java:103) at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:812) at org.ajax4jsf.renderkit.RendererBase.renderChild(RendererBase.java:277) at org.ajax4jsf.renderkit.RendererBase.renderChildren(RendererBase.java:258) at org.ajax4jsf.renderkit.RendererBase.renderChild(RendererBase.java:279) at org.ajax4jsf.renderkit.RendererBase.renderChildren(RendererBase.java:258) at org.richfaces.renderkit.html.PanelRenderer.doEncodeChildren(PanelRenderer.java:200) at org.richfaces.renderkit.html.PanelRenderer.doEncodeChildren(PanelRenderer.java:195) at org.ajax4jsf.renderkit.RendererBase.encodeChildren(RendererBase.java:120) at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:812) at org.ajax4jsf.renderkit.RendererBase.renderChild(RendererBase.java:277) at org.ajax4jsf.renderkit.RendererBase.renderChildren(RendererBase.java:258) at org.ajax4jsf.renderkit.RendererBase.renderChild(RendererBase.java:279) at org.ajax4jsf.renderkit.RendererBase.renderChildren(RendererBase.java:258) at org.ajax4jsf.renderkit.html.AjaxOutputPanelRenderer.encodeChildren(AjaxOutputPanelRenderer.java:78) at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:812) at javax.faces.component.UIComponent.encodeAll(UIComponent.java:886) at javax.faces.component.UIComponent.encodeAll(UIComponent.java:892) at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:592) at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:100) at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:176) at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106) at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251) at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:206) at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290) at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388) at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454) at java.lang.Thread.run(Thread.java:619) 21/06/2010 12:29:41 com.sun.faces.lifecycle.LifecycleImpl phase WARNING: executePhase(RENDER_RESPONSE 6,com.sun.faces.context.FacesContextImpl@1372bdb) threw exception javax.faces.FacesException: java.lang.NullPointerException: Argument Error: Parameter text is null at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:675) at javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:650) at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:681) at javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:650) at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:681) at javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:650) at org.ajax4jsf.component.AjaxViewRoot.encodeChildren(AjaxViewRoot.java:551) at javax.faces.component.UIComponent.encodeAll(UIComponent.java:886) at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:592) at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:100) at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:176) at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106) at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251) at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:206) at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290) at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388) at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454) at java.lang.Thread.run(Thread.java:619)
Please HELP MEU, and sorry for the bad english!
Benigno Sales
Greenhorn
Posts: 2
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hello ??? Someone help me!
I got this tall by not having enough crisco in my diet as a kid. This ad looks like it had plenty of shortening:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
check box in simple html tag in jsf
Horrendous EL problem
javax.faces.FacesException: javax.faces.model.NoRowAvailableException
Help me I am getting this Error...Exception thrown during phase execution:
Error reading "member"
More...