• 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
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

Help. commandButton does not invoke Bean's method.

 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
my commandButton does not work�

Please advise me what am I doing wrong? My command button does not invoke method in Bean. System.out.println() would not print message in submit() method.

In jsp page:

<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>

<h:commandButton action="#{ServicesBackingBean.submit}" value="#{bundle.addNewlySoldServiceButtonValue}" id="submit"/>

In faces-config.xml:

<faces-config>
<managed-bean>
<managed-bean-name>ServicesBackingBean</managed-bean-name>
<managed-bean-class>
com.softlets.projects.travelcards.beans.ServicesBackingBean
</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>

<navigation-rule>
<navigation-case>
<from-outcome>success</from-outcome>
<to-view-id>/in.jsp</to-view-id>
</navigation-case>
</navigation-rule>
</faces-config>



In ServicesBackingBean.java:


Setters and getters
�.

public String submit()
{
System.out.println(" ************ I am here in submit() method ********* ");
return �success�;
}
 
Sergey Kargopolov
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My Netbeans gives me some messages. Maybe it might help you to get an ideas.

When added an id to HTML Form tag and JSF message for form id I started getting some messages in Netbeans.

Here are my HTML FORM details:

<form id="submitForm">
.
.
.
<td><h:inputText value="#{ServicesBean.serviceName}" id="serviceName" size="50"/></td>
.
.
.
<h:commandButton action="#{ServicesBean.addService}" value="#{bundle.addNewlySoldServiceButtonValue}" id="submitButton"/>
</form>

<h:message for="submitForm"/>

Here are NetBeans Messages:

WARNING: Unable to find component with ID 'submitForm' in view.
18.12.2006 12:09:29 com.sun.faces.el.impl.Coercions applyArithmeticOperator
WARNING: Attempt to apply operator "-" to null value
18.12.2006 12:09:29 com.sun.faces.el.impl.Coercions applyArithmeticOperator
WARNING: Attempt to apply operator "-" to null value
18.12.2006 12:09:35 com.sun.faces.renderkit.html_basic.HtmlBasicRenderer getForComponent
WARNING: Unable to find component with ID 'submitForm' in view.


Thank you.
 
Sergey Kargopolov
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I was able to fix the problem with invoking Bean's method.

I should have used <h:form> instead of <form> tag. This was the problem.
 
reply
    Bookmark Topic Watch Topic
  • New Topic