You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Farooq Mahmood <fa...@yahoo.com> on 2005/06/05 21:40:16 UTC

problem in using "x:dataTable" and "x:updateActionListener"

Hi,
I am new to jsf and I m using my faces. I m getting
problem regarding  "x:dataTable" and
"x:updateActionListener". I am actually I have seen
some posts regarding "x:dataTable" and
"x:updateActionListener" but I donot able to solve my
problem. Plz chk this problem and tell me where I m
doing wrong. 
The problem is that when I click on the link instead
of send that particular row (or taskId) it sends the
whole List and then it iterate the whole list and
display the list row values on the next page. Here is
the code:

inbox.jsp

                <x:dataTable id="data"
                        styleClass="scrollerTable"
                       
headerClass="standardTable_Header"
                       
footerClass="standardTable_Header"
                       
rowClasses="standardTable_Row1,standardTable_Row2"
                       
columnClasses="standardTable_Column,standardTable_ColumnCentered,standardTable_Column"
                        var="task"
                       
value="#{inboxTaskBean.taskList}"
                        preserveDataModel="true"
                        rows="10"
                   >

                   <h:column>
                       <f:facet name="header">
                          <h:outputText
value="#{messages['label_taskId']}" />
                       </f:facet>
                       <h:outputText
value="#{task.taskId}" />
                   </h:column>

                   <h:column>
                       <f:facet name="header">
                          <h:outputText
value="#{messages['label_weburi']}" />
                       </f:facet>
	                       
                     <x:commandLink action="task"
immediate="true" >
	                       <h:outputText
value="#{task.webFormURI}" />

	                       <x:updateActionListener
property="#{taskForm.taskId}" value="#{task.taskId}"
/>
                       </x:commandLink>

                   </h:column>

                </x:dataTable>


TaskForm.java

import javax.faces.context.FacesContext;

public class TaskForm {
	
	private String taskId = null;
	private String webFormURI = null;

	public TaskForm(){
		System.out.println("Task Form: " + taskId);
	}

	public String getTaskId() {
		return taskId;
	}

	public void setTaskId(String taskId) {
		
		System.out.println("I m in setTaskId : " + taskId);
		if(taskId != null){
			InboxTask inboxTask = getList().getTask(taskId);
			System.out.println("Complete Task : " +
inboxTask.toString());
			if(inboxTask != null){
				insId = inboxTask.getInsId();
				webFormURI = inboxTask.getWebFormURI();
			}
		}
	}

	public String getWebFormURI() {
		return webFormURI;
	}

	public void setWebFormURI(String webFormURI) {
		this.webFormURI = webFormURI;
	}
	
    private SelectTaskBean getList()
    {
        Object obj =
FacesContext.getCurrentInstance().getApplication().getVariableResolver()
           
.resolveVariable(FacesContext.getCurrentInstance(),
"inboxTaskBean");
        return (SelectTaskBean) obj;
    }
}

taskForm.jsp


        <f:facet name="body">
            <h:panelGroup>
                    <x:saveState
value="#{taskForm.taskId}" />

                    <h:panelGrid columns="1"
styleClass="countryFormTable"
                                
columnClasses="countryFormLabels" >
                        <h:panelGroup>
 	                       <h:outputText
value="#{taskForm.taskId}" />
 	                       <h:outputText
value="#{taskForm.webFormURI}" />

                        </h:panelGroup>

                    </h:panelGrid>
            </h:panelGroup>
        </f:facet>


Regards,
Farooq Mahmood
farooqmahmood@yahoo.com


Re: problem in using "x:dataTable" and "x:updateActionListener"

Posted by Sean Schofield <se...@gmail.com>.
Also, try with <h:dataTable>.  That should help narrow it down as to
whether the problem is on your end or with <x:dataTable.>  AFAIK
<h:dataTable> works fine in this area.

sean

On 6/21/05, Sean Schofield <se...@gmail.com> wrote:
> Does it work with preserve datamodel = false?  I wonder if that might
> be the problem...  It's supposed to work either way of course.
> 
> sean
> 
> On 6/5/05, Farooq Mahmood <fa...@yahoo.com> wrote:
> > Hi,
> > I am new to jsf and I m using my faces. I m getting
> > problem regarding  "x:dataTable" and
> > "x:updateActionListener". I am actually I have seen
> > some posts regarding "x:dataTable" and
> > "x:updateActionListener" but I donot able to solve my
> > problem. Plz chk this problem and tell me where I m
> > doing wrong.
> > The problem is that when I click on the link instead
> > of send that particular row (or taskId) it sends the
> > whole List and then it iterate the whole list and
> > display the list row values on the next page. Here is
> > the code:
> >
> > inbox.jsp
> >
> >                 <x:dataTable id="data"
> >                         styleClass="scrollerTable"
> >
> > headerClass="standardTable_Header"
> >
> > footerClass="standardTable_Header"
> >
> > rowClasses="standardTable_Row1,standardTable_Row2"
> >
> > columnClasses="standardTable_Column,standardTable_ColumnCentered,standardTable_Column"
> >                         var="task"
> >
> > value="#{inboxTaskBean.taskList}"
> >                         preserveDataModel="true"
> >                         rows="10"
> >                    >
> >
> >                    <h:column>
> >                        <f:facet name="header">
> >                           <h:outputText
> > value="#{messages['label_taskId']}" />
> >                        </f:facet>
> >                        <h:outputText
> > value="#{task.taskId}" />
> >                    </h:column>
> >
> >                    <h:column>
> >                        <f:facet name="header">
> >                           <h:outputText
> > value="#{messages['label_weburi']}" />
> >                        </f:facet>
> >
> >                      <x:commandLink action="task"
> > immediate="true" >
> >                                <h:outputText
> > value="#{task.webFormURI}" />
> >
> >                                <x:updateActionListener
> > property="#{taskForm.taskId}" value="#{task.taskId}"
> > />
> >                        </x:commandLink>
> >
> >                    </h:column>
> >
> >                 </x:dataTable>
> >
> >
> > TaskForm.java
> >
> > import javax.faces.context.FacesContext;
> >
> > public class TaskForm {
> >
> >         private String taskId = null;
> >         private String webFormURI = null;
> >
> >         public TaskForm(){
> >                 System.out.println("Task Form: " + taskId);
> >         }
> >
> >         public String getTaskId() {
> >                 return taskId;
> >         }
> >
> >         public void setTaskId(String taskId) {
> >
> >                 System.out.println("I m in setTaskId : " + taskId);
> >                 if(taskId != null){
> >                         InboxTask inboxTask = getList().getTask(taskId);
> >                         System.out.println("Complete Task : " +
> > inboxTask.toString());
> >                         if(inboxTask != null){
> >                                 insId = inboxTask.getInsId();
> >                                 webFormURI = inboxTask.getWebFormURI();
> >                         }
> >                 }
> >         }
> >
> >         public String getWebFormURI() {
> >                 return webFormURI;
> >         }
> >
> >         public void setWebFormURI(String webFormURI) {
> >                 this.webFormURI = webFormURI;
> >         }
> >
> >     private SelectTaskBean getList()
> >     {
> >         Object obj =
> > FacesContext.getCurrentInstance().getApplication().getVariableResolver()
> >
> > .resolveVariable(FacesContext.getCurrentInstance(),
> > "inboxTaskBean");
> >         return (SelectTaskBean) obj;
> >     }
> > }
> >
> > taskForm.jsp
> >
> >
> >         <f:facet name="body">
> >             <h:panelGroup>
> >                     <x:saveState
> > value="#{taskForm.taskId}" />
> >
> >                     <h:panelGrid columns="1"
> > styleClass="countryFormTable"
> >
> > columnClasses="countryFormLabels" >
> >                         <h:panelGroup>
> >                                <h:outputText
> > value="#{taskForm.taskId}" />
> >                                <h:outputText
> > value="#{taskForm.webFormURI}" />
> >
> >                         </h:panelGroup>
> >
> >                     </h:panelGrid>
> >             </h:panelGroup>
> >         </f:facet>
> >
> >
> > Regards,
> > Farooq Mahmood
> > farooqmahmood@yahoo.com
> >
> >
>

Re: problem in using "x:dataTable" and "x:updateActionListener"

Posted by Sean Schofield <se...@gmail.com>.
Does it work with preserve datamodel = false?  I wonder if that might
be the problem...  It's supposed to work either way of course.

sean

On 6/5/05, Farooq Mahmood <fa...@yahoo.com> wrote:
> Hi,
> I am new to jsf and I m using my faces. I m getting
> problem regarding  "x:dataTable" and
> "x:updateActionListener". I am actually I have seen
> some posts regarding "x:dataTable" and
> "x:updateActionListener" but I donot able to solve my
> problem. Plz chk this problem and tell me where I m
> doing wrong.
> The problem is that when I click on the link instead
> of send that particular row (or taskId) it sends the
> whole List and then it iterate the whole list and
> display the list row values on the next page. Here is
> the code:
> 
> inbox.jsp
> 
>                 <x:dataTable id="data"
>                         styleClass="scrollerTable"
> 
> headerClass="standardTable_Header"
> 
> footerClass="standardTable_Header"
> 
> rowClasses="standardTable_Row1,standardTable_Row2"
> 
> columnClasses="standardTable_Column,standardTable_ColumnCentered,standardTable_Column"
>                         var="task"
> 
> value="#{inboxTaskBean.taskList}"
>                         preserveDataModel="true"
>                         rows="10"
>                    >
> 
>                    <h:column>
>                        <f:facet name="header">
>                           <h:outputText
> value="#{messages['label_taskId']}" />
>                        </f:facet>
>                        <h:outputText
> value="#{task.taskId}" />
>                    </h:column>
> 
>                    <h:column>
>                        <f:facet name="header">
>                           <h:outputText
> value="#{messages['label_weburi']}" />
>                        </f:facet>
> 
>                      <x:commandLink action="task"
> immediate="true" >
>                                <h:outputText
> value="#{task.webFormURI}" />
> 
>                                <x:updateActionListener
> property="#{taskForm.taskId}" value="#{task.taskId}"
> />
>                        </x:commandLink>
> 
>                    </h:column>
> 
>                 </x:dataTable>
> 
> 
> TaskForm.java
> 
> import javax.faces.context.FacesContext;
> 
> public class TaskForm {
> 
>         private String taskId = null;
>         private String webFormURI = null;
> 
>         public TaskForm(){
>                 System.out.println("Task Form: " + taskId);
>         }
> 
>         public String getTaskId() {
>                 return taskId;
>         }
> 
>         public void setTaskId(String taskId) {
> 
>                 System.out.println("I m in setTaskId : " + taskId);
>                 if(taskId != null){
>                         InboxTask inboxTask = getList().getTask(taskId);
>                         System.out.println("Complete Task : " +
> inboxTask.toString());
>                         if(inboxTask != null){
>                                 insId = inboxTask.getInsId();
>                                 webFormURI = inboxTask.getWebFormURI();
>                         }
>                 }
>         }
> 
>         public String getWebFormURI() {
>                 return webFormURI;
>         }
> 
>         public void setWebFormURI(String webFormURI) {
>                 this.webFormURI = webFormURI;
>         }
> 
>     private SelectTaskBean getList()
>     {
>         Object obj =
> FacesContext.getCurrentInstance().getApplication().getVariableResolver()
> 
> .resolveVariable(FacesContext.getCurrentInstance(),
> "inboxTaskBean");
>         return (SelectTaskBean) obj;
>     }
> }
> 
> taskForm.jsp
> 
> 
>         <f:facet name="body">
>             <h:panelGroup>
>                     <x:saveState
> value="#{taskForm.taskId}" />
> 
>                     <h:panelGrid columns="1"
> styleClass="countryFormTable"
> 
> columnClasses="countryFormLabels" >
>                         <h:panelGroup>
>                                <h:outputText
> value="#{taskForm.taskId}" />
>                                <h:outputText
> value="#{taskForm.webFormURI}" />
> 
>                         </h:panelGroup>
> 
>                     </h:panelGrid>
>             </h:panelGroup>
>         </f:facet>
> 
> 
> Regards,
> Farooq Mahmood
> farooqmahmood@yahoo.com
> 
>