another thing: try to use an action instead of an action listener - is this called?
regards, Martin On 8/12/05, Martin Marinschek <[EMAIL PROTECTED]> wrote: > wild shot: is your method signature correct? > > Particularly, are you importing javax.faces.ActionEvent and not > java.awt.ActionEvent? IntelliJ always shows the latter one first when > doing code complete, easy to slip to the wrong import. > > regards, > > Martin > > On 8/12/05, Gregg D Bolinger <[EMAIL PROTECTED]> wrote: > > No problem. Here it is. > > > > <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%> > > <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%> > > <%@ taglib uri="http://myfaces.apache.org/extensions" prefix="x"%> > > <f:view> > > <html> > > <head><title>Simple jsp page</title></head> > > <body> > > <h:form> > > > > <x:commandButton id="editButton" > > actionListener="#{categoryAdmin.edit}" value="Edit" rendered="#{not > > categoryAdmin.updateMode}" /> > > <x:commandButton id="updateButton" > > actionListener="#{categoryAdmin.update}" value="Update" > > rendered="#{categoryAdmin.updateMode}"/> > > > > </h:form> > > </body> > > </html> > > </f:view> > > > > public class CategoryAdmin extends BaseBean { > > > > private boolean updateMode = false; > > > > public boolean isUpdateMode() { > > return updateMode; > > } > > > > public void setUpdateMode(boolean updateMode) { > > this.updateMode = updateMode; > > } > > > > public void edit(ActionEvent event){ > > > > System.out.println("Edit"); > > setUpdateMode(true); > > } > > > > public void update(ActionEvent event){ > > System.out.println("Updating"); > > } > > } > > > > > > > > > > On 8/12/05, Mike Kienenberger <[EMAIL PROTECTED]> wrote: > > > If you post your stripped-down example + the method itself (maybe > > > there's a typo there), we'll probably be better able to suggest > > > something. > > > > > > On 8/12/05, Gregg D Bolinger <[EMAIL PROTECTED]> wrote: > > > > If I strip the page down to only include the 2 buttons (no datatable > > > > or any other components on the page), I get the same result. > > > > > > > > Gregg > > > > > > > > On 8/12/05, Gregg D Bolinger <[EMAIL PROTECTED]> wrote: > > > > > The dataTable's data is fine. Why would that make a difference > > > > > though? > > > > > > > > > > On 8/12/05, Mathias Broekelmann <[EMAIL PROTECTED]> wrote: > > > > > > Is it possible that the returned list for the datatable contains no > > > > > > values in the decode phase? > > > > > > > > > > > > Regards, > > > > > > Mathias > > > > > > > > > > > > Gregg D Bolinger schrieb: > > > > > > > As I stated in my first post, it doesn't matter if it is in > > > > > > > request or > > > > > > > session. I get the same results. saveState didn't solve the > > > > > > > problem > > > > > > > and rendered="#{categoryAdmin.updateMode}" does resolve to true > > > > > > > after > > > > > > > the Edit button is pressed. That was clear in my code I posted. > > > > > > > > > > > > > > Any other ideas? > > > > > > > > > > > > > > Gregg > > > > > > > > > > > > > > On 8/12/05, Mathias Broekelmann <[EMAIL PROTECTED]> wrote: > > > > > > > > > > > > > >>take a look at rendered="#{categoryAdmin.updateMode}" which must > > > > > > >>be true > > > > > > >>to process the actionlistener when the request is decoded. Save > > > > > > >>the > > > > > > >>state of categoryAdmin with t:savestate or make the bean session > > > > > > >>scope. > > > > > > >> > > > > > > >>Hope that helps. > > > > > > >> > > > > > > >>Regards, > > > > > > >>Mathias > > > > > > >> > > > > > > >>Gregg D Bolinger schrieb: > > > > > > >> > > > > > > >>>FYI - the missing # from the actionListener in > > > > > > >>> > > > > > > >>><x:commandButton id="updateButton" > > > > > > >>>actionListener="{categoryAdmin.update}" value="Update" > > > > > > >>>rendered="#{categoryAdmin.updateMode}"/> > > > > > > >>> > > > > > > >>>was corrected as I was typing in a hurry. The problem still > > > > > > >>>persists. > > > > > > >>>Thanks for any help. And I am using MyFaces 1.0.9. Using the > > > > > > >>>latest > > > > > > >>>nightly snapshot did not resolve this issue either. > > > > > > >>> > > > > > > >>>Gregg > > > > > > >>> > > > > > > >>>On 8/11/05, Gregg D Bolinger <[EMAIL PROTECTED]> wrote: > > > > > > >>> > > > > > > >>> > > > > > > >>>>I'm not sure if this is an issue with MyFaces or with how I am > > > > > > >>>>doing > > > > > > >>>>what I am doing or what. I have a very simple page with a a > > > > > > >>>>dataTable. I am wanting to edit the data in the dataTable > > > > > > >>>>inline. > > > > > > >>>>That is to say, not navigating to a seperate page. I have it > > > > > > >>>>setup > > > > > > >>>>with an edit button for each item and when that button is > > > > > > >>>>pressed I > > > > > > >>>>render inputText components and an update button for the > > > > > > >>>>associated > > > > > > >>>>row. This works. > > > > > > >>>> > > > > > > >>>>The problem is that the update button's actionListener method > > > > > > >>>>binding > > > > > > >>>>isn't working. When I press the update button, nothing > > > > > > >>>>happens. The > > > > > > >>>>update(ActionEvent event) method is never called. It doesn't > > > > > > >>>>matter > > > > > > >>>>if the bean is in the session or request. It just doesn't call > > > > > > >>>>the > > > > > > >>>>method. I have stripped the code down to the simplest working > > > > > > >>>>example > > > > > > >>>>that demonstrates this problem which I will post below. As it > > > > > > >>>>is > > > > > > >>>>right now, I am merely showing and hiding the update/edit > > > > > > >>>>buttons. > > > > > > >>>>When I press Edit the edit method is being called and the update > > > > > > >>>>button is rendered where the edit button is now not rendered. > > > > > > >>>>If I > > > > > > >>>>hit update button, the update method is never called and the > > > > > > >>>>edit > > > > > > >>>>button is displayed again, hiding the update button. I realize > > > > > > >>>>that > > > > > > >>>>with each button press a new request is being sent to the > > > > > > >>>>server. > > > > > > >>>>However, it JSF is supposed to save the state of the bean for > > > > > > >>>>actionListeners since it does not navigate from the page. > > > > > > >>>>However, I > > > > > > >>>>don't believe this is working correctly. Any ideas? Thanks. > > > > > > >>>> > > > > > > >>>><f:view> > > > > > > >>>><html> > > > > > > >>>> <head><title>Simple jsp page</title></head> > > > > > > >>>> <body> > > > > > > >>>> <jsp:include page="includes/admin_header.jsp"/> > > > > > > >>>> <h:form> > > > > > > >>>> <x:dataTable var="cat" > > > > > > >>>> binding="#{categoryAdmin.categoryData}" > > > > > > >>>>value="#{categoryAdmin.categoryList}" border="1" > > > > > > >>>>forceIdIndex="#{cat.categoryId}" > > > > > > > >>>> <h:column> > > > > > > >>>> <f:facet name="header"> > > > > > > >>>> <h:outputText value="Description" /> > > > > > > >>>> </f:facet> > > > > > > >>>> <h:outputText value="#{cat.description}"/> > > > > > > >>>> </h:column> > > > > > > >>>> <h:column> > > > > > > >>>> <f:facet name="header"> > > > > > > >>>> <h:outputText value="Cost"/> > > > > > > >>>> </f:facet> > > > > > > >>>> <h:outputText value="#{cat.cost}"/> > > > > > > >>>> > > > > > > >>>> </h:column> > > > > > > >>>> <h:column> > > > > > > >>>> <x:commandButton id="editButton" > > > > > > >>>>actionListener="#{categoryAdmin.edit}" value="Edit" > > > > > > >>>>rendered="#{not > > > > > > >>>>categoryAdmin.updateMode}" /> > > > > > > >>>> <x:commandButton id="updateButton" > > > > > > >>>>actionListener="{categoryAdmin.update}" value="Update" > > > > > > >>>>rendered="#{categoryAdmin.updateMode}"/> > > > > > > >>>> </h:column> > > > > > > >>>> <h:column> > > > > > > >>>> <x:commandButton > > > > > > >>>> actionListener="#{categoryAdmin.delete}" > > > > > > >>>>value="Delete"/> > > > > > > >>>> </h:column> > > > > > > >>>> </x:dataTable> > > > > > > >>>> <f:verbatim><br/></f:verbatim> > > > > > > >>>> > > > > > > >>>> <h:panelGrid columns="2" border="1"> > > > > > > >>>> <h:outputText value="Description"/> > > > > > > >>>> <h:inputText > > > > > > >>>> value="#{categoryAdmin.category.description}" /> > > > > > > >>>> <h:outputText value="Cost"/> > > > > > > >>>> <h:inputText value="#{categoryAdmin.category.cost}"/> > > > > > > >>>> <h:commandButton actionListener="#{categoryAdmin.add}" > > > > > > >>>> value="Save"/> > > > > > > >>>> <h:commandButton actionListener="#{categoryAdmin.cancel}" > > > > > > >>>>value="Cance"/> > > > > > > >>>> </h:panelGrid> > > > > > > >>>> > > > > > > >>>> > > > > > > >>>> </h:form> > > > > > > >>>> </body> > > > > > > >>>></html> > > > > > > >>>></f:view> > > > > > > >>>> > > > > > > >>>>public class CategoryAdmin extends BaseBean implements > > > > > > >>>>Serializable { > > > > > > >>>> > > > > > > >>>> private List categoryList; > > > > > > >>>> private UIData categoryData; > > > > > > >>>> private boolean updateMode = false; > > > > > > >>>> > > > > > > >>>> private Category category; > > > > > > >>>> > > > > > > >>>> public List getCategoryList() { > > > > > > >>>> CategoryService catService = > > > > > > >>>>(CategoryService)getAppContext().getBean("categoryService"); > > > > > > >>>> categoryList = catService.getall(); > > > > > > >>>> return categoryList; > > > > > > >>>> } > > > > > > >>>> > > > > > > >>>> public void setCategoryList(List categoryList) { > > > > > > >>>> > > > > > > >>>> this.categoryList = categoryList; > > > > > > >>>> } > > > > > > >>>> > > > > > > >>>> public UIData getCategoryData() { > > > > > > >>>> > > > > > > >>>> > > > > > > >>>> return categoryData; > > > > > > >>>> } > > > > > > >>>> > > > > > > >>>> > > > > > > >>>> > > > > > > >>>> public void setCategoryData(UIData categoryData) { > > > > > > >>>> this.categoryData = categoryData; > > > > > > >>>> } > > > > > > >>>> > > > > > > >>>> public boolean isUpdateMode() { > > > > > > >>>> return updateMode; > > > > > > >>>> } > > > > > > >>>> > > > > > > >>>> public void setUpdateMode(boolean updateMode) { > > > > > > >>>> this.updateMode = updateMode; > > > > > > >>>> } > > > > > > >>>> > > > > > > >>>> public Category getCategory() { > > > > > > >>>> if (category == null){ > > > > > > >>>> category = new Category(); > > > > > > >>>> } > > > > > > >>>> return category; > > > > > > >>>> } > > > > > > >>>> > > > > > > >>>> public void setCategory(Category category) { > > > > > > >>>> this.category = category; > > > > > > >>>> } > > > > > > >>>> > > > > > > >>>> public void edit(ActionEvent event){ > > > > > > >>>> System.out.println("Edit"); > > > > > > >>>> category = (Category)categoryData.getRowData(); > > > > > > >>>> category.setEditable(true); > > > > > > >>>> setUpdateMode(true); > > > > > > >>>> } > > > > > > >>>> > > > > > > >>>> public void update(ActionEvent event){ > > > > > > >>>> System.out.println("Updating"); > > > > > > >>>> } > > > > > > >>>> > > > > > > >>>> > > > > > > >>>> > > > > > > >>>> public void delete(ActionEvent event){ > > > > > > >>>> > > > > > > >>>> > > > > > > >>>> CategoryService catService = > > > > > > >>>>(CategoryService)getAppContext().getBean("categoryService"); > > > > > > >>>> Category cat = (Category)categoryData.getRowData(); > > > > > > >>>> catService.delete(cat); > > > > > > >>>> setCategoryList(catService.getall()); > > > > > > >>>> > > > > > > >>>> > > > > > > >>>> } > > > > > > >>>> > > > > > > >>>> public void add(ActionEvent event){ > > > > > > >>>> System.out.println("Adding"); > > > > > > >>>> > > > > > > >>>> CategoryService catService = > > > > > > >>>>(CategoryService)getAppContext().getBean("categoryService"); > > > > > > >>>> catService.insert(getCategory()); > > > > > > >>>> > > > > > > >>>> } > > > > > > >>>> > > > > > > >>>> public void cancel(ActionEvent event){ > > > > > > >>>> > > > > > > >>>> } > > > > > > >>>> > > > > > > >>>> public void changeAddMode(ActionEvent event){ > > > > > > >>>> System.out.println("Changing Add Mode"); > > > > > > >>>> > > > > > > >>>> } > > > > > > >>>>} > > > > > > >>>> > > > > > > >> > > > > > > > > > > > > > > > > > > > > > > > -- > > http://www.irian.at > Your JSF powerhouse - > JSF Trainings in English and German > -- http://www.irian.at Your JSF powerhouse - JSF Trainings in English and German

