How to update row in JSF dataTable

This example is enhancing the previous JSF 2 dataTable example, by adding a “update” function to update row in dataTable.

Update Concept

The overall concept is quite simple :

1. Add a “ediatble” property to keep track the row edit status.

//...
public class Order{
 
	String orderNo;
	String productName;
	BigDecimal price;
	int qty;
 
	boolean editable;
 
	public boolean isEditable() {
		return editable;
	}
	public void setEditable(boolean editable) {
		this.editable = editable;
	}

2. Assign a “Edit” link to the end of each row, if clicked, set “ediatble” = true. In JSF 2.0, you can provide the parameter values in the method expression directly, see the edit action below :

//...
<h:dataTable value="#{order.orderList}" var="o">
 
<h:column>
 
    	<f:facet name="header">Action</f:facet>
 
    	<h:commandLink value="Edit" action="#{order.editAction(o)}" rendered="#{not o.editable}" />
 
</h:column>
//...
public String editAction(Order order) {
 
	order.setEditable(true);
	return null;
}

3. In JSF page, if “ediatble” = true, display the input text box for edit; Otherwise just display the normal output text. A simple trick to simulate the update effect :)

//...
<h:dataTable value="#{order.orderList}" var="o">
 
<h:column>
 
    <f:facet name="header">Order No</f:facet>
 
    <h:inputText value="#{o.orderNo}" size="10" rendered="#{o.editable}" />
 
    <h:outputText value="#{o.orderNo}" rendered="#{not o.editable}" />
 
</h:column>

4. Finally, provide a button to save your changes. When you make changes in the input text box and save it, all values will bind to the associated backing bean automatically.

//...
<h:commandButton value="Save Changes" action="#{order.saveAction}" />
</h:column>

Example

A JSF 2.0 example to implement the above concept to update row in dataTable.

1. Managed Bean

A managed bean named “order”, self-explanatory.

package com.mkyong;
 
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
 
@ManagedBean(name="order")
@SessionScoped
public class OrderBean implements Serializable{
 
	private static final long serialVersionUID = 1L;
 
	private static final ArrayList<Order> orderList = 
		new ArrayList<Order>(Arrays.asList(
 
		new Order("A0001", "Intel CPU", 
				new BigDecimal("700.00"), 1),
		new Order("A0002", "Harddisk 10TB", 
				new BigDecimal("500.00"), 2),
		new Order("A0003", "Dell Laptop", 
				new BigDecimal("11600.00"), 8),
		new Order("A0004", "Samsung LCD", 
				new BigDecimal("5200.00"), 3),
		new Order("A0005", "A4Tech Mouse", 
				new BigDecimal("100.00"), 10)
	));
 
	public ArrayList<Order> getOrderList() {
		return orderList;
	}
 
	public String saveAction() {
 
		//get all existing value but set "editable" to false 
		for (Order order : orderList){
			order.setEditable(false);
		}
		//return to current page
		return null;
 
	}
 
	public String editAction(Order order) {
 
		order.setEditable(true);
		return null;
	}
 
	public static class Order{
 
		String orderNo;
		String productName;
		BigDecimal price;
		int qty;
		boolean editable;
 
		public Order(String orderNo, String productName, BigDecimal price, int qty) {
			this.orderNo = orderNo;
			this.productName = productName;
			this.price = price;
			this.qty = qty;
		}
 
		//getter and setter methods
	}
}

2. JSF page

JSF page to display the data with dataTable tag, and create a “edit” link to update the row record.

<?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://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      >
    <h:head>
    	<h:outputStylesheet library="css" name="table-style.css"  />
    </h:head>
    <h:body>
 
    	<h1>JSF 2 dataTable example</h1>
    	<h:form>
    	   <h:dataTable value="#{order.orderList}" var="o"
    		styleClass="order-table"
    		headerClass="order-table-header"
    		rowClasses="order-table-odd-row,order-table-even-row"
    	   >
 
    	     <h:column>
 
                <f:facet name="header">Order No</f:facet>
 
    		<h:inputText value="#{o.orderNo}" size="10" rendered="#{o.editable}" />
 
    		<h:outputText value="#{o.orderNo}" rendered="#{not o.editable}" />
 
    	     </h:column>
 
    	     <h:column>
 
    		<f:facet name="header">Product Name</f:facet>
 
    		<h:inputText value="#{o.productName}" size="20" rendered="#{o.editable}" />
 
    		<h:outputText value="#{o.productName}" rendered="#{not o.editable}" />
 
    	     </h:column>
 
    	     <h:column>
 
    		<f:facet name="header">Price</f:facet>
 
    		<h:inputText value="#{o.price}" size="10" rendered="#{o.editable}" />
 
    		<h:outputText value="#{o.price}" rendered="#{not o.editable}" />
 
    	     </h:column>
 
    	     <h:column>
 
    		<f:facet name="header">Quantity</f:facet>
 
    		<h:inputText value="#{o.qty}" size="5" rendered="#{o.editable}" />
 
    		<h:outputText value="#{o.qty}" rendered="#{not o.editable}" />
 
    	     </h:column>
 
    	     <h:column>
 
    		<f:facet name="header">Action</f:facet>
 
    		<h:commandLink value="Edit" action="#{order.editAction(o)}" 
                                       rendered="#{not o.editable}" />
 
    	     </h:column>
 
    	  </h:dataTable>
 
    	  <h:commandButton value="Save Changes" action="#{order.saveAction}" />
 
      </h:form>
    </h:body>	
</html>

3. Demo

From top to bottom, shows a row record being updated.

jsf2-dataTable-Update-Example-1
jsf2-dataTable-Update-Example-2
jsf2-dataTable-Update-Example-3
jsf2-dataTable-Update-Example-4

Download Source Code

Download It – JSF-2-DataTable-Update-Example.zip (10KB)
Tags :

About the Author

mkyong
Founder of Mkyong.com and HostingCompass.com, love Java and open source stuff. Follow him on Twitter, or befriend him on Facebook or Google Plus. If you like my tutorials, consider make a donation to these charities.

Comments

  • rudelaris

    value=”#{e.orderNo}”: The class ‘java.lang.String’ does not have the property ‘orderNo’.

  • Emmanuel

    Hi Mkyong,

    I write my owner code with separated classes. The edit button isn’t working.

    How I can do.

    Thanks.

  • Pingback: Edit row data from richfaces datatable | Technology & Programming Answers()

  • poovendan

    Thank you.,

  • KanDaLS

    Thanks mkyong. I am referring to this code for my application and when I click the edit link it says the following error ” Cannot cast from java.lang.string to java.lang.Integer”. Here is the stack trace for your reference.

    java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer
    at com.sun.faces.renderkit.html_basic.MenuRenderer.renderSelect(MenuRenderer.java:843)
    at com.sun.faces.renderkit.html_basic.MenuRenderer.encodeEnd(MenuRenderer.java:294)
    at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:879)
    at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:308)
    at com.sun.faces.renderkit.html_basic.TableRenderer.renderRow(TableRenderer.java:376)
    at com.sun.faces.renderkit.html_basic.TableRenderer.encodeChildren(TableRenderer.java:157)
    at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:849)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1663)
    at javax.faces.render.Renderer.encodeChildren(Renderer.java:164)
    at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:849)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1663)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1666)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1666)
    at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:389)
    at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:127)
    at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:117)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:97)
    at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:135)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:335)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:947)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1009)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

  • R.N. Hermann

    I’d like to open a modal form dialog when clicking in the “Edit” command link of the datatable. What have I to do to do it?

  • R.N. Hermann

    Great tutorial :)

  • Omar

    Is there a way to do this but with JSF 1.2? As I can see u use the View socope for the bean, but how can u do this with a Request bean and conecting to DB. I’ve read some solutions using and preserveDataModel, but none of this works, at least with this example and using request bean with JSF 1.2

    Thanks in advance

  • Nilkamal

    How to affect update operation directly on database

  • Nilkamal

    Hi,
    How to do it same thing and insert and update in database

  • Pingback: JSF 2.0 Tutorial()

  • Rita

    Hi,

    I can’t make the arrayList static final as I need to get data data from database and save edited datatable to database. It is not working without static final. Please suggest

  • Ravi

    Hi Young,

    Could you please tell me how to access the updated “orderList” in my action or action listener method if the Bean scope is in “request”..

    Thanks,
    Ravi.

  • zmn

    I have an application which uses a database in the backside. All the data in the application come from the database. Some data in database are continuesly updated every 20 seconds and I want to display these new data in the application ( within ) without refreshing the entire page. How could it be possible without any action or event handling mechanisim from within the main page. any help will really be appreciated….

  • trung

    hi you. How to add the cancel button in this example. This mean that when user click on edit button, then type something on the textboxes, and then click on cancel button which the data is not updated? thanks.

  • vinothkumar.S.M

    How could we do the same using JSF 1.2?

  • Jacques PIOTROWSKI

    Update for the table-style.css :

    .order-table{
    border-collapse:collapse;
    }

    .order-table-header{
    text-align:center;
    background:none repeat scroll 0 0 #E5E5E5;
    border-bottom:1px solid #BBBBBB;
    padding:16px;
    }

    .order-table-odd-row{
    background:none repeat scroll 0 0 #FFFFFF;
    border-top:1px solid #BBBBBB;
    }

    .order-table-even-row{
    background:none repeat scroll 0 0 #F9F9F9;
    border-top:1px solid #BBBBBB;
    }

    .evenRow {
    background-color: #F5F5DC;
    }
    .oddRow {
    background-color: #FFE4C4;
    }

    .celluleLeft {
    font-family:verdana,arial,helvetica,sans-serif;
    font-size:13px;
    text-align: left;
    text-transform: uppercase;
    }
    .celluleRight {
    font-family:verdana,arial,helvetica,sans-serif;
    font-size:13px;
    text-align: right;
    }
    .celluleCenter {
    font-family:verdana,arial,helvetica,sans-serif;
    font-size:13px;
    text-align: center;
    text-transform: uppercase;
    }

  • Jacques PIOTROWSKI

    I merged the three examples in one : ADD, UPDATE, DELETE in one XHTML page and one Java Bean, with many improvements :

    &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
    &lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; 
        &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
    &lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;   
          xmlns:h=&quot;http://java.sun.com/jsf/html&quot;
          xmlns:f=&quot;http://java.sun.com/jsf/core&quot;&gt;
        &lt;h:head&gt;
            &lt;h:outputStylesheet library=&quot;css&quot; name=&quot;table-style.css&quot;  /&gt;
        &lt;/h:head&gt;
        &lt;h:body&gt;
     
            &lt;h1&gt;JSF 2 dataTable example (modified by Jacques Piotrowski, France)&lt;/h1&gt;
            &lt;h:outputText id=&quot;nbOrder&quot; value=&quot; Number of orders : #{order.nbOrder}&quot; /&gt;
     
            &lt;h:form id=&quot;addOrder&quot;&gt;
                &lt;h:dataTable value=&quot;#{order.orderList}&quot; var=&quot;o&quot;
                             styleClass=&quot;order-table&quot;
                             headerClass=&quot;order-table-header&quot;
                             rowClasses=&quot;order-table-odd-row,order-table-even-row&quot;&gt;
     
                    &lt;h:column&gt;
                        &lt;f:facet name=&quot;header&quot;&gt;Order No&lt;/f:facet&gt;
                        &lt;h:inputText value=&quot;#{o.orderNo}&quot; size=&quot;10&quot; maxlength=&quot;10&quot; rendered=&quot;#{o.editable}&quot; /&gt;
                        &lt;h:outputText value=&quot;#{o.orderNo}&quot; rendered=&quot;#{not o.editable}&quot; /&gt;
                    &lt;/h:column&gt;
     
                    &lt;h:column&gt;
                        &lt;f:facet name=&quot;header&quot;&gt;Product Name&lt;/f:facet&gt;
                        &lt;h:inputText value=&quot;#{o.productName}&quot; size=&quot;20&quot; maxlength=&quot;20&quot; rendered=&quot;#{o.editable}&quot; /&gt;
                        &lt;h:outputText value=&quot;#{o.productName}&quot; rendered=&quot;#{not o.editable}&quot; /&gt;
                    &lt;/h:column&gt;
     
                    &lt;h:column&gt;
                        &lt;f:facet name=&quot;header&quot;&gt;Price&lt;/f:facet&gt;
                        &lt;h:inputText value=&quot;#{o.price}&quot; size=&quot;10&quot; maxlength=&quot;10&quot; rendered=&quot;#{o.editable}&quot; /&gt;
                        &lt;h:outputText value=&quot;#{o.price}&quot; rendered=&quot;#{not o.editable}&quot; /&gt;
                    &lt;/h:column&gt;
     
                    &lt;h:column&gt;
                        &lt;f:facet name=&quot;header&quot;&gt;Quantity&lt;/f:facet&gt;
                        &lt;h:inputText value=&quot;#{o.qty}&quot; size=&quot;5&quot; maxlength=&quot;5&quot; rendered=&quot;#{o.editable}&quot; /&gt;
                        &lt;h:outputText value=&quot;#{o.qty}&quot; rendered=&quot;#{not o.editable}&quot; /&gt;
                    &lt;/h:column&gt;
     
                    &lt;h:column&gt;
                        &lt;f:facet name=&quot;header&quot;&gt;Edit&lt;/f:facet&gt;
                        &lt;h:commandLink value=&quot;Edit&quot; immediate=&quot;true&quot; action=&quot;#{order.editAction(o)}&quot; rendered=&quot;#{not o.editable}&quot; /&gt;
                        &lt;h:commandLink value=&quot;Save Changes&quot; immediate=&quot;true&quot; action=&quot;#{order.saveAction}&quot; rendered=&quot;#{o.editable}&quot; /&gt;
                    &lt;/h:column&gt;
     
                    &lt;h:column&gt;
                        &lt;f:facet name=&quot;header&quot;&gt;Delete&lt;/f:facet&gt;
                        &lt;h:commandLink value=&quot;Delete&quot; immediate=&quot;true&quot; action=&quot;#{order.deleteAction(o)}&quot; rendered=&quot;#{not o.editable}&quot; /&gt;
                    &lt;/h:column&gt;                    
     
                &lt;/h:dataTable&gt;
     
                &lt;h3&gt;Enter Order&lt;/h3&gt;
                &lt;table&gt;
                    &lt;tr&gt;
                        &lt;td styleClass=&quot;celluleLeft&quot;&gt;Order No :&lt;/td&gt;
                        &lt;td&gt;&lt;h:inputText id=&quot;orderNo&quot; size=&quot;10&quot; maxlength=&quot;10&quot; value=&quot;#{order.orderNo}&quot; required=&quot;true&quot; /&gt;&lt;/td&gt;
                    &lt;/tr&gt;
                    &lt;tr&gt;
                        &lt;td styleClass=&quot;celluleLeft&quot;&gt;Product Name :&lt;/td&gt;
                        &lt;td&gt;&lt;h:inputText id=&quot;productName&quot; size=&quot;20&quot; maxlength=&quot;20&quot; value=&quot;#{order.productName}&quot; required=&quot;true&quot; /&gt;&lt;/td&gt;
                    &lt;/tr&gt;
                    &lt;tr&gt;
                        &lt;td styleClass=&quot;celluleLeft&quot;&gt;Quantity :&lt;/td&gt;
                        &lt;td&gt;&lt;h:inputText id=&quot;qty&quot; size=&quot;5&quot; maxlength=&quot;5&quot; value=&quot;#{order.qty}&quot; required=&quot;true&quot; /&gt;&lt;/td&gt;
                    &lt;/tr&gt;
                    &lt;tr&gt;
                        &lt;td styleClass=&quot;celluleLeft&quot;&gt;Price :&lt;/td&gt;
                        &lt;td&gt;&lt;h:inputText id=&quot;price&quot; size=&quot;10&quot; maxlength=&quot;10&quot; value=&quot;#{order.price}&quot; required=&quot;true&quot; /&gt;&lt;/td&gt;
                    &lt;/tr&gt;
                &lt;/table&gt;
                &lt;h:commandButton value=&quot;Add New Order&quot; action=&quot;#{order.addAction}&quot; rendered=&quot;#{not order.editable}&quot; /&gt;
     
            &lt;/h:form&gt;
        &lt;/h:body&gt;
     
    &lt;/html&gt;
    package org.jpiotrowski;
     
    import java.io.Serializable;
    import java.math.BigDecimal;
    import java.util.ArrayList;
    import java.util.Arrays;
    import javax.faces.bean.ManagedBean;
    import javax.faces.bean.ViewScoped;
     
    @ManagedBean(name = &quot;order&quot;)
    @ViewScoped
    public class OrderBean implements Serializable {
     
        private static final long serialVersionUID = 1L;
        transient int i;
        transient int nbOrder;
        String orderNo;
        String productName;
        BigDecimal price;
        int qty;
        boolean editable = false;
        private static final ArrayList&lt;Order&gt; orderList = new ArrayList&lt;Order&gt;();
     
        public ArrayList&lt;Order&gt; getOrderList() {
     
            return orderList;
     
        }
     
        public final int getNbOrder() {
            nbOrder = orderList.size();
            return nbOrder;
        }
     
        public String getOrderNo() {
            return orderNo;
        }
     
        public void setOrderNo(final String orderNo) {
            this.orderNo = orderNo;
        }
     
        public String getProductName() {
            return productName;
        }
     
        public void setProductName(final String productName) {
            this.productName = productName;
        }
     
        public BigDecimal getPrice() {
            return price;
        }
     
        public void setPrice(final BigDecimal price) {
            this.price = price;
        }
     
        public int getQty() {
            return qty;
        }
     
        public void setQty(final int qty) {
            this.qty = qty;
        }
     
        public boolean isEditable() {
            return editable;
        }
     
        public void setEditable(final boolean editable) {
            this.editable = editable;
        }
     
        public String saveAction() {
     
            //get all existing value but set &quot;editable&quot; to false 
            for (Order order : orderList) {
                order.setEditable(false);
            }
     
            //return to current page
            return null;
     
        }
     
        public String editAction(final Order order) {
     
            order.setEditable(true);
            return null;
        }
     
        public String addAction() {
     
            final Order order = new Order(this.orderNo, this.productName, this.price, this.qty);
            orderList.add(order);
            setEditable(false);
            setOrderNo(null);
            setProductName(null);
            setPrice(null);
            setQty(0);
            return null;
        }
     
        public String deleteAction(final Order order) {
     
            orderList.remove(order);
            return null;
        }
     
        public static class Order {
     
            String orderNo;
            String productName;
            BigDecimal price;
            int qty;
            boolean editable;
     
            public Order(final String orderNo, final String productName, final BigDecimal price, final int qty) {
                this.orderNo = orderNo;
                this.productName = productName;
                this.price = price;
                this.qty = qty;
            }
     
            public boolean isEditable() {
                return editable;
            }
     
            public void setEditable(final boolean editable) {
                this.editable = editable;
            }
     
            public String getOrderNo() {
                return orderNo;
            }
     
            public void setOrderNo(final String orderNo) {
                this.orderNo = orderNo;
            }
     
            public String getProductName() {
                return productName;
            }
     
            public void setProductName(final String productName) {
                this.productName = productName;
            }
     
            public BigDecimal getPrice() {
                return price;
            }
     
            public void setPrice(final BigDecimal price) {
                this.price = price;
            }
     
            public int getQty() {
                return qty;
            }
     
            public void setQty(final int qty) {
                this.qty = qty;
            }
        }
    }
    • Luis Enrique Velasquez Gomez

      Hi, I am new in java,how can I do this but with a database? Excuse my English

      • Vursana Lan

        AJ.. AJ.. AJEY.. Hey yavrum hey..

        44 > 23

        Androidceee seni nas?l sevdi?imi… androidceeee rüyalarda gördü?ümü androidce uykusuz gecelerimi

        SAYGI

  • Giuse

    Hi Mkyong,

    can you give tutor, how can implementation in database jsf-mysql about “Update Concept”.

    what the mean :

    for (Order order : orderList){
    order.setEditable(false);
    }

    thank you before.

  • Lumia

    Hey Mkyong,

    This is very helpful example. But i have make a separate class for Order,so i cant get update the inputText from outputText when i m click on edit button. So,what should be the problem? Because i make a separate class for Order that;s why i m not able to change the textbox? Thanks in advance

  • ANDREW

    Hello, first of all thanks for this amazing example!

    How can I do to keep non editable one of the registries of the row and the others editables when I press the “edit” button?

    Thanks a lot!

    Andrew

    • http://www.mkyong.com mkyong

      Sorry, i didn’t implement in JSF before, but jQuery. Hope someone can help you.

  • Hagay

    Hello,

    First, thanks a lot for this helpful tutorial.

    I’m running the above over Google App Engine with Java 1.6 and I get the following when loading the page.
    I realize it is probably related to the fact of passing a parameter via JSF when calling order.editAction(o). MAybe related to the Google environment.

    Please advise.

    Thanks,

    Hagay.

    Problem accessing /orderForm.jsf. Reason:

    /orderForm.xhtml @67,71 action=”#{order.editAction(o)}” Error Parsing: #{order.editAction(o)}
    Caused by:

    javax.faces.view.facelets.TagAttributeException: /orderForm.xhtml @67,71 action=”#{order.editAction(o)}” Error Parsing: #{order.editAction(o)}
    at com.sun.faces.facelets.tag.TagAttributeImpl.getMethodExpression(TagAttributeImpl.java:232)
    ……

    Caused by: javax.el.ELException: Error Parsing: #{order.editAction(o)}
    at org.apache.el.lang.ExpressionBuilder.createNodeInternal(ExpressionBuilder.java:125)
    ……

    Caused by: org.apache.el.parser.ParseException: Encountered ” “(” “( “” at line 1, column 19.
    Was expecting one of:
    “}” …

    • http://www.mkyong.com mkyong

      Make sure your environment is using >= JSF2.0 , to support parameter passing in EL method. The common mistake is using old JSF jars and try to use the new EL implementation.

  • Jonas Grimsgaard

    Lovely tutorial. Clean and great explanation.
    Unfortunately it’s not working when I’m implementing it with my own code.

    Do you know about any know programmering errors with this approach?

  • http://aaa.com Adnan

    How can action attribut take an argument of type order?Kindly reply soon

  • http://DataTable-LazyLoading Petar Banicevic

    Oh this is awesome article. Maybe once we could tackle lazy loading (on demand loading). I had run some examples, it’s tough but possible…

    • http://www.mkyong.com mkyong

      Do you mind to share your examples?

      • learner

        I am getting same problem as Hagay… what should i do??? i tried with updating my project with latest jsf..but still its not working.