yeah, session or request, didn't matter. And it shouldn't matter. It should work either way. This is about to drive me nuts. lol.
On 8/12/05, Martin Marinschek <[EMAIL PROTECTED]> wrote: > Request scope, there it is... > > set it to session, and try again - oh, you said you did, right? > > regards, > > Martin > > On 8/12/05, Gregg D Bolinger <[EMAIL PROTECTED]> wrote: > > <!DOCTYPE faces-config > > PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN" > > "http://java.sun.com/dtd/web-facesconfig_1_1.dtd"> > > > > <faces-config> > > > > <managed-bean> > > <description>Administer Categories</description> > > <managed-bean-name>categoryAdmin</managed-bean-name> > > <managed-bean-class>com.gthought.pnp.web.beans.CategoryAdmin</managed-bean-class> > > <managed-bean-scope>request</managed-bean-scope> > > </managed-bean> > > > > </faces-config> > > > > > > On 8/12/05, Martin Marinschek <[EMAIL PROTECTED]> wrote: > > > I just tried exactly your example, copied out - it works just fine... > > > > > > can you post your faces-config.xml? > > > > > > that can be the only difference now... > > > > > > regards, > > > > > > Martin > > > > > > On 8/12/05, Gregg D Bolinger <[EMAIL PROTECTED]> wrote: > > > > I take it that when you all run a similar example, it works for you? > > > > > > > > Gregg > > > > > > > > On 8/12/05, Gregg D Bolinger <[EMAIL PROTECTED]> wrote: > > > > > Ok, here is a reply to all: > > > > > > > > > > What happens if you use an h:commandButton instead? - Doesn't matter > > > > > What happens if you dump the render statement? - Then the update > > > > > method is called just fine > > > > > > > > > > Is "#{not categoryAdmin.updateMode}" legal? I've always used ! to > > > > > this point - yes, this is legal. > > > > > > > > > > is your method signature correct? - Yes, I am importing the correct > > > > > class > > > > > > > > > > try to use an action instead of an action listener - is > > > > > this called? - I get the same results with this. The update method is > > > > > not called. > > > > > > > > > > Thanks for all the suggestions guys. > > > > > > > > > > Gregg > > > > > > > > > > > > > > > On 8/12/05, Martin Marinschek <[EMAIL PROTECTED]> wrote: > > > > > > 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 > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > > 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 >

