You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Parshuram Sahoo <pa...@patni.com> on 2006/05/17 10:56:58 UTC

Probelms With JSF dataTable and Milionic Menus

Hi

I am using JSF Data table and the milionic menus. When i right click on any row i am getting update and delete menu options. When
i am clicking on the delete i am getting the below exception. and i have written the setter and getter methods for selectedRowId.
My dataTable and meus codes are like below

<h:dataTable value="#{SolutionMgmt.solutions}"
         var="soln"
         border="1" cellspacing="0" cellpadding="2"
	     width="640"
	     onmouseup="WestContextMenu.popup('solnmgmtpopupMenu')">

   	<h:column>
	<f:facet name="header">
		<f:verbatim><b>Code</b></f:verbatim>
	</f:facet>
	<f:verbatim>
		<span class="spanRowId">
        <h:outputText value="#{soln.errorCodes}"/>
		</span>
	</f:verbatim>
  	</h:column>

  	<h:column>
  	<f:facet name="header">
		<f:verbatim><b>Solution Name</b></f:verbatim>
	</f:facet>
    <h:outputText value="#{soln.solutionName}"/>
  	</h:column>

  	<h:column>
  	<f:facet name="header">
		<f:verbatim><b>Description</b></f:verbatim>
	</f:facet>
             <h:outputText value="#{soln.description}"/>
  	</h:column>
	</h:dataTable>
	<h:commandButton id="addnewsolution" type="submit" value = "#{msg.newsolution}" immediate="false">
	</h:commandButton>
	<%-- The milonic menu component --%>
	<h:inputHidden value="#{SolutionMgmt.selectedRowId}" id="selectedRowUuid" />
            <m:menu id="solnmgmtpopupMenu" onselect="WestContextMenu.setSelectedRowId('SolutionMgmt')" contextmenu="true">
            <m:menuitem value="Update" />
            <m:menuitem value="Delete" action="#{SolutionMgmt.deleteSolution}"/>

    </m:menu>



i am using the below java script functions to set the value.

I am getting spans[i].childNodes[0].nodeValue nothing for this. So values are not being set.

 /**
    * Extracts the id of the row that the user has selected.
    */
    this.setSelectedElementId = function(selectedRow) {
		alert ("selectedRow = " + selectedRow);
        var spans = selectedRow.getElementsByTagName("SPAN")
        for (i = 0; i < spans.length; i++) {
            if( spans[i].className == "spanRowId") {
				alert("NODE VALUE = " + spans[i].childNodes[0].nodeValue);
                this.selectedElementId = spans[i].childNodes[0].nodeValue;
				alert ("selectedElementId = " + this.selectedElementId);
            }
        }
    }

    this.popup = function(contextMenuName) {
        // If its not a context menu do not popup
        if(!this.isWestContextMenu(contextMenuName)) {
            return;
        }

        ev=event.button;

        // detect right click and process the popup
        if(ev==2||ev==3){
            document.oncontextmenu = new Function("return false");
            this.selectedElementId = null;
            var selected = this.getContextRow(window.event.srcElement);
            if(selected != null) {
                this.setSelectedElementId(selected);
            }
            //this.setCallingElement(selected);
            if(this.selectedElementId != null) {
                this.doPopup(contextMenuName);
            }
        }


2006-05-17 12:36:10 StandardWrapperValve[Faces Servlet]: Servlet.service() for servlet Faces Servlet threw exception
javax.faces.FacesException: #{SolutionMgmt.deleteSolution}: javax.faces.el.EvaluationException: java.lang.NullPointerException
	at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:98)
	at javax.faces.component.UICommand.broadcast(UICommand.java:332)
	at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:287)
	at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:401)
	at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:95)
	at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:268)
	at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:110)
	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:213)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
	at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
	at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
	at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
	at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
	at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
	at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
	at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
	at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
	at java.lang.Thread.run(Thread.java:536)
Caused by: javax.faces.el.EvaluationException: java.lang.NullPointerException
	at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:150)
	at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:92)
	... 31 more
Caused by: java.lang.NullPointerException
	at com.west.himalaya.ui.ert.beans.SolutionMgmtBBean.deleteSolution(SolutionMgmtBBean.java:81)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:324)
	at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:146)
	... 32 more

Can any one help me in this matter. Thanks in advance.

Regards
Parshuram


http://www.patni.com
World-Wide Partnerships. World-Class Solutions.
_____________________________________________________________________

This e-mail message may contain proprietary, confidential or legally
privileged information for the sole use of the person or entity to
whom this message was originally addressed. Any review, e-transmission
dissemination or other use of or taking of any action in reliance upon
this information by persons or entities other than the intended
recipient is prohibited. If you have received this e-mail in error
kindly delete  this e-mail from your records. If it appears that this
mail has been forwarded to you without proper authority, please notify
us immediately at netadmin@patni.com and delete this mail. 
_____________________________________________________________________