Meaningless Drivel is fun!*
The moose likes JSF and the fly likes <a:commandButton not working properly. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "<a:commandButton not working properly." Watch "<a:commandButton not working properly." New topic
Author

<a:commandButton not working properly.

Giannis nasdades
Greenhorn

Joined: Feb 27, 2009
Posts: 10
Hi,

I am currently into making a seam application with ajax,jsf etc in order to make myself familiar with those technologies.
The problem is that i am trying to create a button. When this button is clicked, a method should be execute, which in turn executes a hibernate query. The results should be rendered in an <h:dataTable . When i clicked the buttong nothing at all happens... it is like the button is not registered at all...

My web page:

<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:s="http://jboss.com/products/seam/taglib"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:rich="http://richfaces.org/rich"
xmlns:a="http://richfaces.org/a4j"
template="layout/template.xhtml">

<ui:define name="body">
model: <h:inputText id="searchString" value="#{motorcyclesearchaction.model}"
style="width: 165px;">
<a:support event="onkeyup" action="#{motorcyclesearchaction.find}"
reRender="searchResults" />
</h:inputText>
<a:commandButton id="findMotorcycles" value="Find Motorcycles" action="#{motorcyclesearchaction.find}"
reRender="searchResults"/>
<h:commandButton action="#{motorcyclesearchaction.find}" value="Find Motorcyclesh" reRender="searchResults"/>

<autputPanel id="searchResults">
<div class="section">

<h:dataTable id="motorcycles" value="#{motorcycles}" var="motor"
rendered="#{motorcycles.rowCount>0}">
<h:column>
<f:facet name="make">Address</f:facet>
#{motor.make}
</h:column>

</h:dataTable>
<s:link value="More results" action="#{motorcyclesearchaction.nextPage}"
rendered="#{motorcyclesearchaction.nextPageAvailable}"/>
</div>
</autputPanel>


</ui:define>

</ui:composition>




Below is my action class:




Any help is appreciated.

Thanks in advance,
giannis
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16145
    
  21

1. I don't see an <h:form> tag. JSF builds on HTML, and HTML won't submit without a form. Thus, neither will JSF.

2. The signature for a JSF Action processor MUST be:

public String xxxxxx() {
....
return "zzzzz";
}

Where "zzzz" can be whatever you want the JSF navigator to key on. It's common to return "success" for successful actions and "failure" for failed ones, but all that really matters is that you return a string.

If your signature doesn't match, the action won't fire.


Customer surveys are for companies who didn't pay proper attention to begin with.
Giannis nasdades
Greenhorn

Joined: Feb 27, 2009
Posts: 10
Tim Holloway wrote:1. I don't see an <h:form> tag. JSF builds on HTML, and HTML won't submit without a form. Thus, neither will JSF.

2. The signature for a JSF Action processor MUST be:

public String xxxxxx() {
....
return "zzzzz";
}

Where "zzzz" can be whatever you want the JSF navigator to key on. It's common to return "success" for successful actions and "failure" for failed ones, but all that really matters is that you return a string.

If your signature doesn't match, the action won't fire.



ok great i got it.. very stupid mistake....

thanks a lot for your help,
giannis
Manasa Gowda
Greenhorn

Joined: Aug 12, 2009
Posts: 1
hi.. i need help with using of <facet> tag in faces-config.xml.
how were you able to map <f:facet name="dir">
 
wood burning stoves
 
subject: <a:commandButton not working properly.