Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7513205
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T00:06:23+00:00 2026-05-30T00:06:23+00:00

I am trying to delete a database entry by sending the primary key userId

  • 0

I am trying to delete a database entry by sending the primary key “userId” as EL method argument via a command button to my managed bean.

My current code looks like

Bean:

@ManagedBean
@RequestScoped
public class HibernateUserHandling 
{
...
public void deleteUser(String userIdViaXhtml)
{
    Session session = sessionFactory.openSession();
    session.beginTransaction();

    session.createQuery("DELETE FROM AddressDetails WHERE USERID = :userIdViaXhtml");
    session.createQuery("DELETE FROM UserDetails WHERE USERID = :userIdViaXhtml");

    session.getTransaction().commit();
    session.close();
}
...
}

View:

    <html>
    <body>
        <ui:composition template="./generalTemplate.xhtml"
        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">
        <ui:define name="content">
            <h:outputStylesheet library="css" name="cssHibernate.css" />
                <h:form id="main">
                    <h:dataTable value="#{hibernateDataOutput.persons}" var="list"
                                styleClass="order-table"
                                headerClass="order-table-header"
                                rowClasses="order-table-odd-row,order-table-even-row">
                        ...
                            <f:facet name="header">Delete</f:facet>
                            <h:commandButton id="userId" action="#{hibernateUserHandling['deleteUser(list.userId)']}" image="delete.jpg" />
                        </h:column>
                    </h:dataTable>
                    ...
                </h:form>
            </ui:define>
        </ui:composition>
    </body>
</html>

I tested more ways, e.g. via getting the value to a seperate variable in the bean like in a inputText, but nothing worked.

I think I got a totally wrong basic approach.

I get the following error:

/hibernate.xhtml @39,137 action="#{hibernateUserHandling.deleteUser(list.userId)}" Failed to parse the expression [#{hibernateUserHandling.deleteUser(list.userId)}]

Stack trace:

    javax.faces.view.facelets.TagAttributeException: /hibernate.xhtml @39,137 action="#{hibernateUserHandling.deleteUser(list.userId)}" Failed to parse the expression [#{hibernateUserHandling.deleteUser(list.userId)}]
            at com.sun.faces.facelets.tag.TagAttributeImpl.getMethodExpression(TagAttributeImpl.java:232)
            at com.sun.faces.facelets.tag.jsf.ActionSourceRule$ActionMapper2.applyMetadata(ActionSourceRule.java:104)
            at com.sun.faces.facelets.tag.MetadataImpl.applyMetadata(MetadataImpl.java:81)
            at javax.faces.view.facelets.MetaTagHandler.setAttributes(MetaTagHandler.java:129)
            at javax.faces.view.facelets.DelegatingMetaTagHandler.setAttributes(DelegatingMetaTagHandler.java:102)
            at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.doNewComponentActions(ComponentTagHandlerDelegateImpl.java:402)
            at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:159)
            at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120)
            at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:98)
            at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137)
            at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:188)
            at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120)
            at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:98)
            at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137)
            at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:188)
            at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120)
            at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:98)
            at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137)
            at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:188)
            at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120)
            at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:98)
            at com.sun.faces.facelets.tag.ui.DefineHandler.applyDefinition(DefineHandler.java:103)
            at com.sun.faces.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:178)
            at com.sun.faces.facelets.impl.DefaultFaceletContext$TemplateManager.apply(DefaultFaceletContext.java:395)
            at com.sun.faces.facelets.impl.DefaultFaceletContext.includeDefinition(DefaultFaceletContext.java:366)
            at com.sun.faces.facelets.tag.ui.InsertHandler.apply(InsertHandler.java:108)
            at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137)
            at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:188)
            at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120)
            at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:98)
            at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137)
            at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:188)
            at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120)
            at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:98)
            at com.sun.faces.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:93)
            at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:98)
            at com.sun.faces.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:86)
            at com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:308)
            at com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:367)
            at com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:346)
            at com.sun.faces.facelets.impl.DefaultFaceletContext.includeFacelet(DefaultFaceletContext.java:199)
            at com.sun.faces.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:155)
            at com.sun.faces.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:93)
            at com.sun.faces.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:86)
            at com.sun.faces.facelets.impl.DefaultFacelet.apply(DefaultFacelet.java:152)
            at com.sun.faces.application.view.FaceletViewHandlingStrategy.buildView(FaceletViewHandlingStrategy.java:769)
            at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:100)
            at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
            at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
            at javax.faces.webapp.FacesServlet.service(FacesServlet.java:410)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
            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:127)
            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.Http11AprProcessor.process(Http11AprProcessor.java:877)
            at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:594)
            at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1675)
            at java.lang.Thread.run(Thread.java:619)
    Caused by: javax.el.ELException: Failed to parse the expression [#{hibernateUserHandling.deleteUser(list.userId)}]
            at org.apache.el.lang.ExpressionBuilder.createNodeInternal(ExpressionBuilder.java:146)
            at org.apache.el.lang.ExpressionBuilder.build(ExpressionBuilder.java:172)
            at org.apache.el.lang.ExpressionBuilder.createMethodExpression(ExpressionBuilder.java:223)
            at org.apache.el.ExpressionFactoryImpl.createMethodExpression(ExpressionFactoryImpl.java:57)
            at com.sun.faces.facelets.tag.TagAttributeImpl.getMethodExpression(TagAttributeImpl.java:222)
            ... 61 more
    Caused by: org.apache.el.parser.ParseException: Encountered " "(" "( "" at line 1, column 35.
    Was expecting one of:
        "}" ...
        "." ...
        "[" ...
        ">" ...
        "gt" ...
        "<" ...
        "lt" ...
        ">=" ...
        "ge" ...
        "<=" ...
        "le" ...
        "==" ...
        "eq" ...
        "!=" ...
        "ne" ...
        "&&" ...
        "and" ...
        "||" ...
        "or" ...
        "*" ...
        "+" ...
        "-" ...
        "/" ...
        "div" ...
        "%" ...
        "mod" ...

            at org.apache.el.parser.ELParser.generateParseException(ELParser.java:2142)
            at org.apache.el.parser.ELParser.jj_consume_token(ELParser.java:2024)
            at org.apache.el.parser.ELParser.DeferredExpression(ELParser.java:113)
            at org.apache.el.parser.ELParser.CompositeExpression(ELParser.java:40)
            at org.apache.el.lang.ExpressionBuilder.createNodeInternal(ExpressionBuilder.java:114)
            ... 65 more
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T00:06:24+00:00Added an answer on May 30, 2026 at 12:06 am

    Your Facelet composition is wrong. Anything outside <ui:composition> is ignored in final view and the template client content needs to go inside <ui:define>. You have the <h:form> outside the template definition <ui:define>, so it is not included in the final view and hence the buttons don’t have any form to submit and they just won’t seem to work at all.

    Rearrange your Facelet template client as follows:

    <ui:composition template="./generalTemplate.xhtml"
        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">
    
        <ui:define name="content">
            <h:outputStylesheet library="css" name="cssHibernate.css" />
            <h:form id="main">
                <h:dataTable value="#{hibernateDataOutput.persons}" var="list"
                             styleClass="order-table"
                             headerClass="order-table-header"
                             rowClasses="order-table-odd-row,order-table-even-row">
                    <h:column>
                        <f:facet name="header">Delete</f:facet>
                        <h:commandButton id="userId" action="#{hibernateUserHandling.deleteUser(list.userId)}" image="delete.jpg" />
                    </h:column>
                </h:dataTable>
            </h:form>
        </ui:define>
    </ui:composition>        
    

    See also:

    • commandButton/commandLink/ajax action/listener method not invoked or input value not updated
    • How to include another XHTML in XHTML using JSF 2.0 Facelets?

    Unrelated to your concrete problem, the Hibernate code is flawed. But that’s subject to a different question.


    Update: as per the stacktrace which you edited afterwards in the question,

    Caused by: javax.el.ELException: Failed to parse the expression [#{hibernateUserHandling.deleteUser(list.userId)}]
    

    Apparently your environment does not support EL 2.2 at all. You need to make sure that the web.xml is declared conform Servlet 3.0 API and that you’re deploying to a Servlet 3.0 compatible servlet container (e.g. Tomcat 7, Glassfish 3, JBoss AS 6, etc).

    See also:

    • How to call a method with a parameter in JSF
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to delete several rows from a MySQL 5.0.45 database: delete from
I am trying to delete an existing database in SQL Server 2005. My first
I'm trying to create a simple button that deletes a row from the database.
I'm trying to have a menu button to clear my database when it is
I am trying to delete an AttendeeEvent from the database with EF4, however I
I am trying to delete expired entries in a MySQL database, on creation or
i am trying to add and delete records(games) from my database using jquery and
i'm trying to delete a row in the database with GetDeleteCommand() and DataAdapter.Update(). with
I'm trying to delete a user's schema from a database and I'm getting the
While trying to delete the data from my SQL Server CE 3.5 database, I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.