Re: Tomcat5.5 web application to Tomcat6.0
Thanks, Jacob, for this - truly appreciated. With regards,damar On Fri, Jan 29, 2010 at 5:23 AM, Jakob Korherr jakob.korh...@gmail.comwrote: Hi, I found this http://raibledesigns.com/rd/entry/upgrading_to_tomcat_6 with a quick google search. But I don't think there should be major problems. Regards, Jakob 2010/1/28 Damar Thapa thapa.da...@gmail.com Hi, It may be off-topic here, but I appreciate if somebody in the list could give me some pointers! I have an old JSF application running under Tomcat 5.5., and this has to be moved to a server where Tomcat 6.0.24 is running. Are there any documentation that I need to go about in converting the application to Tomcat 6.0.24 (servlet 2.5)? Thanks, With regard,dt -- With regards, Damar
Tomcat5.5 web application to Tomcat6.0
Hi, It may be off-topic here, but I appreciate if somebody in the list could give me some pointers! I have an old JSF application running under Tomcat 5.5., and this has to be moved to a server where Tomcat 6.0.24 is running. Are there any documentation that I need to go about in converting the application to Tomcat 6.0.24 (servlet 2.5)? Thanks, With regard,dt
t:inputDate value problem in tomahawk 1.1.9
Hi, I just tested the following code: t:inputDate id=bDate type=date value=#{user.bDate} popupCalendar=true/ I am using Myfaces-1.2.8, facelets-1.1.15, and tomahawk-1.1.9. Everything looks fine, but the value of the input date comes out to be a day earlier. For example, if I choose 15 January 2010 in the calendar, it assigns 14 January 2010 to user.bDate. Same thing happens if I disable popupCalendar, and type the date. Is this the bug, incompatibility issue, or I am missing something. Any pointers would be highly appreciated. With regards, Damar
t:inputDate value problem in tomahawk 1.1.9
Hi, Happy New Year 2010 to all. I just tested the following code: t:inputDate id=bDate type=date value=#{user.bDate} popupCalendar=true/ I am using Myfaces-1.2.8, facelets-1.1.15, and tomahawk-1.1.9. Everything looks fine, but the value of the input date comes out to be a day earlier. For example, if I choose 15 January 2010 in the calendar, it assigns 14 January 2010 to user.bDate. Same thing happens if I disable popupCalendar, and type the date. Is this the bug, incompatibility issue, or I am missing something. Any pointers would be highly appreciated. With regards, Damar
t:inputDate value problem in tomahawk 1.1.9
Hi, Happy New Year 2010 to all. I just tested the following code: t:inputDate id=bDate type=date value=#{user.bDate} popupCalendar=true/ I am using Myfaces-1.2.8, facelets-1.1.15, and tomahawk-1.1.9. Everything looks fine, but the value of the input date comes out to be a day earlier. For example, if I choose 15 January 2010 in the calendar, it assigns 14 January 2010 to user.bDate. Same thing happens if I disable popupCalendar, and type the date. Is this the bug, incompatibility issue, or I am missing something. Any pointers would be highly appreciated. With regards, Damar
Re: t:inputDate value problem in tomahawk 1.1.9
On Sat, Jan 2, 2010 at 4:46 PM, Damar Thapa thapa.da...@gmail.com wrote: Hi, Happy New Year 2010 to all. I just tested the following code: t:inputDate id=bDate type=date value=#{user.bDate} popupCalendar=true/ I am using Myfaces-1.2.8, facelets-1.1.15, and tomahawk-1.1.9. Everything looks fine, but the value of the input date comes out to be a day earlier. For example, if I choose 15 January 2010 in the calendar, it assigns 14 January 2010 to user.bDate. Same thing happens if I disable popupCalendar, and type the date. Is this the bug, incompatibility issue, or I am missing something. Any pointers would be highly appreciated. With regards, Damar -- With regards, Damar
t:selectOneMenu f:selectItems problem
Hi, I am trying to create a selctOneMenum, and I have the following snapshot of xhmtl file: t:selectOneMenu value=#{libraryUser.group} f:selectItems value=#{choice.groups}/ /t:selectOneMenu Choice.java (choice.groups) is as follows: public class Choice { private ListSelectItem groups=new ArrayListSelectItem(); public Choice() { groups.add(new SelectItem(1,Test)); groups.add(new SelectItem(2,Test1)); } public ListSelectItem getGroups() { return groups; } public void setGroups(ListSelectItem groups) { this.groups = groups; } } I, however, is getting error message: Caused by: java.lang.IllegalArgumentException: Value binding '#{choice.groups}'of UISelectItems with component-path {Component-Path : [Class: javax.faces.component.UIViewRoot,ViewId: /pages/userInput.xhtml][Class: javax.faces.component.html.HtmlForm,Id: helloForm][Class: javax.faces.component.html.HtmlPanelGrid,Id: j_id8][Class: org.apache.myfaces.component.html.ext.HtmlSelectOneMenu,Id: j_id19][Class: javax.faces.component.UISelectItems,Id: j_id20]} does not reference an Object of type SelectItem, SelectItem[], Collection or Map but of type : null at org.apache.myfaces.shared_tomahawk.util.SelectItemsIterator.hasNext(SelectItemsIterator.java:166) From the error message, it sounds like groups does not have SelectItem object, and I am missing something. I appreciate if somebody can provide me some pointers. Thanks, With regards, Damar
Re: t:inputDate value problem in tomahawk 1.1.9
Thanks, Michael, for this - truly appreciated. With regards, Damar On Sat, Jan 2, 2010 at 5:56 PM, Michael Heinen michael.hei...@recommind.com wrote: Hi Damar, It's caused by different timezones. Pls see this page: http://wiki.apache.org/myfaces/FAQ#Date Michael -Original Message- From: Damar Thapa [mailto:thapa.da...@gmail.com] Sent: Samstag, 2. Januar 2010 09:49 To: MyFaces Discussion Subject: Re: t:inputDate value problem in tomahawk 1.1.9 On Sat, Jan 2, 2010 at 4:46 PM, Damar Thapa thapa.da...@gmail.com wrote: Hi, Happy New Year 2010 to all. I just tested the following code: t:inputDate id=bDate type=date value=#{user.bDate} popupCalendar=true/ I am using Myfaces-1.2.8, facelets-1.1.15, and tomahawk-1.1.9. Everything looks fine, but the value of the input date comes out to be a day earlier. For example, if I choose 15 January 2010 in the calendar, it assigns 14 January 2010 to user.bDate. Same thing happens if I disable popupCalendar, and type the date. Is this the bug, incompatibility issue, or I am missing something. Any pointers would be highly appreciated. With regards, Damar -- With regards, Damar -- With regards, Damar
Re: t:selectOneMenu f:selectItems problem
Hi Jakob, Your way of initializing and populating goups in getGroups() methods worked - thank you very much indeed. With regards, Damar On Sat, Jan 2, 2010 at 10:52 PM, Jakob Korherr jakob.korh...@gmail.comwrote: Hi Damar, It seems like somehow #{choice.groups} resolves to null. I don't really know why, but you can try to debug your app and look at the value of groups. Either some part of your code sets groups to null or it is not initialised at all. In your case, I would write Choice.java in the following way: public class Choice { private ListSelectItem groups; public Choice() { } public ListSelectItem getGroups() { if (groups == null) { groups = new ArrayListSelectItem(); groups.add(new SelectItem(1,Test)); groups.add(new SelectItem(2,Test1)); } return groups; } public void setGroups(ListSelectItem groups) { this.groups = groups; } } Regards, Jakob 2010/1/2 Damar Thapa thapa.da...@gmail.com Hi, I am trying to create a selctOneMenum, and I have the following snapshot of xhmtl file: t:selectOneMenu value=#{libraryUser.group} f:selectItems value=#{choice.groups}/ /t:selectOneMenu Choice.java (choice.groups) is as follows: public class Choice { private ListSelectItem groups=new ArrayListSelectItem(); public Choice() { groups.add(new SelectItem(1,Test)); groups.add(new SelectItem(2,Test1)); } public ListSelectItem getGroups() { return groups; } public void setGroups(ListSelectItem groups) { this.groups = groups; } } I, however, is getting error message: Caused by: java.lang.IllegalArgumentException: Value binding '#{choice.groups}'of UISelectItems with component-path {Component-Path : [Class: javax.faces.component.UIViewRoot,ViewId: /pages/userInput.xhtml][Class: javax.faces.component.html.HtmlForm,Id: helloForm][Class: javax.faces.component.html.HtmlPanelGrid,Id: j_id8][Class: org.apache.myfaces.component.html.ext.HtmlSelectOneMenu,Id: j_id19][Class: javax.faces.component.UISelectItems,Id: j_id20]} does not reference an Object of type SelectItem, SelectItem[], Collection or Map but of type : null at org.apache.myfaces.shared_tomahawk.util.SelectItemsIterator.hasNext(SelectItemsIterator.java:166) From the error message, it sounds like groups does not have SelectItem object, and I am missing something. I appreciate if somebody can provide me some pointers. Thanks, With regards, Damar -- With regards, Damar
Re: c:if question
Hi, Thanks for your message. I am seeing a weird situation! The following snapshot works fine (can display the required output correctly!): h:selectOneMenu id=htmlOrText value=#{email.htmlOrText} f:selectItem itemValue=text itemLabel=Text/ f:selectItem itemValue=html itemLabel=Html/ a4j:support event=onchange reRender=txt,isTxt,isHtml ajaxSingle=true/ /h:selectOneMenu h:outputText id=txtHtml value=#{email.htmlOrText}/ Text: h:outputText id=isTxt value=#{email.htmlOrText == 'text'}/ Html: h:outputText id=isHtml value=#{email.htmlOrText == 'html'}/ But, when I try the following (ironically, the real code that I need!), it does not render: h:selectOneMenu id=htmlOrText value=#{email.htmlOrText} f:selectItem itemValue=text itemLabel=Text/ f:selectItem itemValue=html itemLabel=Html/ a4j:support event=onchange reRender=txt, htm ajaxSingle=true/ /h:selectOneMenu h:inputTextarea id=txt value=#{email.bodyEmail} cols=70 rows=15 rendered=#{email.htmlOrText == 'text'} / t:inputHtml id=htm value=#{email.bodyEmail} addKupuLogo=false rendered=#{email.htmlOrText == 'text'} / Any pointers on this? Thanks once again. With regards, DT On Jan 5, 2008 1:52 AM, simon [EMAIL PROTECTED] wrote: On Sat, 2008-01-05 at 00:44 +0800, Damar Thapa wrote: Hi, I have the following snapshot: h:selectOneRadio id=myRadio value=#{email.htmlOrText} f:selectItem itemValue=text itemLabel=Text/ f:selectItem itemValue=html itemLabel=Html/ a4j:support event=onchange reRender=body / /h:selectOneRadio div id=body c:if test={$email.htmlOrText = 'text'} h:inputTextarea value=#{email.bodyEmail} cols=70 rows=15 / /c:if c:if test={$email.htmlOrText = 'html'} t:inputHtml value=#{email.bodyEmail} addKupuLogo=false/ /c:if /div What I am trying to do is: when the value of radio button is changed, it should render body part, in which ther are two c:ifs. How can I force it to render the body part as the user changes the value of oneselectRadio button? Do not use c:if. Do this instead: h:inputTextarea rendered=#{email.htmlOrText == 'text'} .../ h:inputHtml rendered=#{email.htmlOrText == 'html'} .../ Regards, Simon -- With regards, Damar Thapa, Hong Kong (http://damarsblog.blogspot.com)
c:if question
Hi, I have the following snapshot: h:selectOneRadio id=myRadio value=#{email.htmlOrText} f:selectItem itemValue=text itemLabel=Text/ f:selectItem itemValue=html itemLabel=Html/ a4j:support event=onchange reRender=body / /h:selectOneRadio div id=body c:if test={$email.htmlOrText = 'text'} h:inputTextarea value=#{email.bodyEmail} cols=70 rows=15 / /c:if c:if test={$email.htmlOrText = 'html'} t:inputHtml value=#{email.bodyEmail} addKupuLogo=false/ /c:if /div What I am trying to do is: when the value of radio button is changed, it should render body part, in which ther are two c:ifs. How can I force it to render the body part as the user changes the value of oneselectRadio button? Any pointers would be highly appreciated. Thanks With regards, DT
JSF sun 1.2 RI, facelets 1.1.13, RichFaces 3.1.3 and apache tomahawk 1.1.6
Hi, I have a project running JSF sun 1.2 RI + facelets 1.1.13 + RichFaces 3.1.3, where I would like to add apache tomahawk 1.1.6. feature. I followed the instruction at http://wiki.apache.org/myfaces/How_to_add_MyFaces_support_to_a_Sun_JSF_RI_application (1) I added the following in web.xml: !-- Extensions Filter -- filter filter-nameextensionsFilter/filter-name filter-class org.apache.myfaces.component.html.util.ExtensionsFilter /filter-class init-param description Set the size limit for uploaded files. Format: 10 - 10 bytes 10k - 10 KB 10m - 10 MB 1g - 1 GB /description param-nameuploadMaxFileSize/param-name param-value100m/param-value /init-param init-param description Set the threshold size - files below this limit are stored in memory, files above this limit are stored on disk. Format: 10 - 10 bytes 10k - 10 KB 10m - 10 MB 1g - 1 GB /description param-nameuploadThresholdSize/param-name param-value100k/param-value /init-param !-- init-param param-nameuploadRepositoryPath/param-name param-value/temp/param-value descriptionSet the path where the intermediary files will be stored. /description /init-param -- /filter !-- extension mapping for adding script/, link/, and other resource tags to JSF-pages -- filter-mapping filter-nameMyFacesExtensionsFilter/filter-name !-- servlet-name must match the name of your javax.faces.webapp.FacesServlet entry -- servlet-nameFaces Servlet/servlet-name /filter-mapping !-- extension mapping for serving page-independent resources (javascript, stylesheets, images, etc.) -- filter-mapping filter-nameMyFacesExtensionsFilter/filter-name url-pattern/faces/myFacesExtensionResource/*/url-pattern /filter-mapping !-- end of extension -- (2) Added xmlns:t=http://myfaces.apache.org/tomahawk; in .xhtml file, and (3) Added tomhawk.jar and tomahawk-facelets-taglib.jar in WEB-INF/lib. But, it cannot parse t: tag, have I missed anything here? Any other jar files I have to include? Any pointers would be highly appreciated. -- With regards, Damar
Re: JSF sun 1.2 RI, facelets 1.1.13, RichFaces 3.1.3 and apache tomahawk 1.1.6
Hi Alan, Thanks for your message. For the tomahawk tags, I have tomahawk-facelets-taglib.jar in WEB-INF/lib. With regards, Damar On Dec 15, 2007 4:41 AM, Alan Romaniuc [EMAIL PROTECTED] wrote: You should read also http://wiki.apache.org/myfaces/Use_Facelets_with_Tomahawk facelets can not load tomahawk tag configuration because it does not have one. You must create it, or use Tomahawk-Facelets, the link can be reach from the link above. Damar Thapa escreveu: Hi, I have a project running JSF sun 1.2 RI + facelets 1.1.13 + RichFaces 3.1.3, where I would like to add apache tomahawk 1.1.6. feature. I followed the instruction at http://wiki.apache.org/myfaces/How_to_add_MyFaces_support_to_a_Sun_JSF_RI_application (1) I added the following in web.xml: !-- Extensions Filter -- filter filter-nameextensionsFilter/filter-name filter-class org.apache.myfaces.component.html.util.ExtensionsFilter /filter-class init-param description Set the size limit for uploaded files. Format: 10 - 10 bytes 10k - 10 KB 10m - 10 MB 1g - 1 GB /description param-nameuploadMaxFileSize/param-name param-value100m/param-value /init-param init-param description Set the threshold size - files below this limit are stored in memory, files above this limit are stored on disk. Format: 10 - 10 bytes 10k - 10 KB 10m - 10 MB 1g - 1 GB /description param-nameuploadThresholdSize/param-name param-value100k/param-value /init-param !-- init-param param-nameuploadRepositoryPath/param-name param-value/temp/param-value descriptionSet the path where the intermediary files will be stored. /description /init-param -- /filter !-- extension mapping for adding script/, link/, and other resource tags to JSF-pages -- filter-mapping filter-nameMyFacesExtensionsFilter/filter-name !-- servlet-name must match the name of your javax.faces.webapp.FacesServlet entry -- servlet-nameFaces Servlet/servlet-name /filter-mapping !-- extension mapping for serving page-independent resources (javascript, stylesheets, images, etc.) -- filter-mapping filter-nameMyFacesExtensionsFilter/filter-name url-pattern/faces/myFacesExtensionResource/*/url-pattern /filter-mapping !-- end of extension -- (2) Added xmlns:t= http://myfaces.apache.org/tomahawk; in .xhtml file, and (3) Added tomhawk.jar and tomahawk-facelets-taglib.jar in WEB-INF/lib. But, it cannot parse t: tag, have I missed anything here? Any other jar files I have to include? Any pointers would be highly appreciated. -- With regards, Damar -- With regards, Damar Thapa
Re: how to create a SelectOneMenu with dynamic list
Thank you, Jeff. Truly appreciated. Damar On 11/30/06, Jeff Bischoff [EMAIL PROTECTED] wrote: Damar, Please see link [1] to view the irian examples website. You click MyFaces Sandbox Examples latest build to get the day's examples. I can give you a direct link [2] for what you wanted, and it works today but will break tomorrow. See the date in the URL? So best is to use link [1] and find the component from there. [1] http://www.irian.at/myfaces.jsf [2] http://example.irian.at/example-sandbox-20061129/ajaxChildComboBox.jsf Regards, Jeff Bischoff Kenneth L Kurz Associates, Inc. Damar Thapa wrote: Hi, This link found to be dead now, any idea? http://example.irian.at/example-sandbox-20061118/ajaxChildComboBox.jsf Damar -- With regards, Damar Thapa
Re: how to create a SelectOneMenu with dynamic list
Hi, This link found to be dead now, any idea? http://example.irian.at/example-sandbox-20061118/ajaxChildComboBox.jsf Damar On 11/18/06, Gerald Müllan [EMAIL PROTECTED] wrote: Hi, the list is reduced in the ValueChangeEvent method? Apart from this, i can`t see any mistakes in the code snippet. Any errors shown in the page? (don`t forget t:messages) Alternatively you can also use the sandbox ajax comboBox [1] which should exactly fit your needs and seems to be more user friendly. cheers, Gerald [1] http://example.irian.at/example-sandbox-20061118/ajaxChildComboBox.jsf On 11/18/06, Damar Thapa [EMAIL PROTECTED] wrote: Hi, Somebody on the list may have implemented this. I have two SelectOneMenu, A and B, with the same list. But, when Menu A is selected, the list of B has to be recreated with (full list minus the item selected in Menu A). My valueChangeEvent is something like the following: public void firstChoiceSelected(ValueChangeEvent vce){ String firstChoice=(String)vce.getNewValue(); java.util.ArrayListSelectItem listB=new java.util.ArrayList(); listB=this.getListA(); //ListA=listB initially //remove the item selected in Menu A SelectItem item=new SelectItem(firstChoice,firstChoice); list.remove(item); this.setListB(listA); In my case, valueChangeEvent is called, but the list remains the same. What do I have to do? Any pointers would be highly appreciated. With regards, Damar Thapa -- http://www.irian.at Your JSF powerhouse - JSF Consulting, Development and Courses in English and German Professional Support for Apache MyFaces -- With regards, Damar Thapa
how to create a SelectOneMenu with dynamic list
Hi, Somebody on the list may have implemented this. I have two SelectOneMenu, A and B, with the same list. But, when Menu A is selected, the list of B has to be recreated with (full list minus the item selected in Menu A). My valueChangeEvent is something like the following: public void firstChoiceSelected(ValueChangeEvent vce){ String firstChoice=(String)vce.getNewValue(); java.util.ArrayListSelectItem listB=new java.util.ArrayList(); listB=this.getListA(); //ListA=listB initially //remove the item selected in Menu A SelectItem item=new SelectItem(firstChoice,firstChoice); list.remove(item); this.setListB(listA); In my case, valueChangeEvent is called, but the list remains the same. What do I have to do? Any pointers would be highly appreciated. With regards, Damar Thapa
Re: Selectable DataTable or similar to that
Hi, Thank you, every body, for your great help. But, I have the following snapshot of my Action method: java.util.ArrayList data=this.applications; Iterator FirstObject it=data.iterator(); String title=; java.util.ArrayListStudents students=new java.util.ArrayList(); while(it.hasNext ()) { FirstObject first=(FirstObject) it.next(); title=first.getCourseTitle(); Student student=selectable.getStudent(); Students.add(student); ……. … } SecondObject second=new SecondObject(title,students…) In the above, this.application is the list of FirstObjects that comes from the dataTable. Up to this point I am getting right list. In the second part, I iterate the list, and get title and students list. In the third part, I create second of SecondObject class, using the value of title, students from second part. I am getting the following error: javax.faces.el.EvaluationException: /pages/applicationProcess.xhtml @70,126 actionListener=#{applicationProcess.saveStudents}: java.lang.NullPointerException com.sun.facelets.el.LegacyMethodBinding.invoke(LegacyMethodBinding.java:73) javax.faces.component.UICommand.broadcast(UICommand.java:86) javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:94) javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:168) org.apache.myfaces.lifecycle.LifecycleImpl.invokeApplication(LifecycleImpl.java:343) org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:86) javax.faces.webapp.FacesServlet.service(FacesServlet.java:137) org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:144) note The full stack trace of the root cause is available in the Apache Tomcat/5.5.17 logs. Can somebody point me what I am doing wrong? I am using myfaces-1.1.3, with facelets.. Any pointers would be highly appreciated. Damar On 11/11/06, Madhav Bhargava [EMAIL PROTECTED] wrote: Other more elegant way to do it will be to bind the dataTable with a UIData property in the backing bean. In the action listener method you can then iterate over the rows easily. ~madhav -Original Message- From: Nebinger, David [mailto:[EMAIL PROTECTED] Sent: Friday, November 10, 2006 11:02 PM To: MyFaces Discussion Subject: RE: Selectable DataTable or similar to that Your logic is off; you get the parent but aren't testing it's class before casting. You probably want the code to be: public void saveStudents(ActionEvent event){ SelectableApplicant selectableApplicant = null; java.util.ArrayList selectableApplicants=null; UIComponent tmpComponent = event.getComponent(); while (null != tmpComponent !(tmpComponent instanceof UIData)) { tmpComponent = tmpComponent.getParent(); } if (tmpComponent != null) { Object tmpRowData = ((UIData) tmpComponent).getRowData(); if (tmpRowData instanceof SelectableApplicant) { selectableApplicant = (SelectableApplicant) tmpRowData; selectableApplicants.add(selectableApplicant); } } -Original Message- From: Damar Thapa [mailto:[EMAIL PROTECTED] Sent: Friday, November 10, 2006 11:30 AM To: MyFaces Discussion Subject: Re: Selectable DataTable or similar to that Hi, I have the following actionEvent method: public void saveStudents(ActionEvent event){ SelectableApplicant selectableApplicant = null; java.util.ArrayList selectableApplicants=null; UIComponent tmpComponent = event.getComponent(); while (null != tmpComponent !(tmpComponent instanceof UIData)) { tmpComponent = tmpComponent.getParent(); Object tmpRowData = ((UIData) tmpComponent).getRowData(); if (tmpRowData instanceof SelectableApplicant) { selectableApplicant = (SelectableApplicant) tmpRowData; selectableApplicants.add(selectableApplicant); } } The value of dataTable is applications (a list of SelectableApplicant objects). I am trying to put these object into selectableApplicants list. What I have done wrong here? I am getting following error message: I get the following error: javax.faces.el.EvaluationException: /pages/applicationProcess.xhtml @70,126 actionListener=#{applicationProcess.saveStudents}: java.lang.ClassCastException: javax.faces.component.html.HtmlPanelGrid com.sun.facelets.el.LegacyMethodBinding.invoke(LegacyMethodBin ding.java:73) javax.faces.component.UICommand.broadcast(UICommand.java:86) javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot .java:94) javax.faces.component.UIViewRoot.processApplication(UIViewRoot .java:168) org.apache.myfaces.lifecycle.LifecycleImpl.invokeApplication(L ifecycleImpl.java:343) org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleIm pl.java:86) javax.faces.webapp.FacesServlet.service(FacesServlet.java:137
Re: Selectable DataTable or similar to that
Hi, I have the following actionEvent method: public void saveStudents(ActionEvent event){ SelectableApplicant selectableApplicant = null; java.util.ArrayList selectableApplicants=null; UIComponent tmpComponent = event.getComponent(); while (null != tmpComponent !(tmpComponent instanceof UIData)) { tmpComponent = tmpComponent.getParent(); Object tmpRowData = ((UIData) tmpComponent).getRowData(); if (tmpRowData instanceof SelectableApplicant) { selectableApplicant = (SelectableApplicant) tmpRowData; selectableApplicants.add(selectableApplicant); } } The value of dataTable is applications (a list of SelectableApplicant objects). I am trying to put these object into selectableApplicants list. What I have done wrong here? I am getting following error message: I get the following error: javax.faces.el.EvaluationException: /pages/applicationProcess.xhtml @70,126 actionListener=#{applicationProcess.saveStudents}: java.lang.ClassCastException: javax.faces.component.html.HtmlPanelGrid com.sun.facelets.el.LegacyMethodBinding.invoke(LegacyMethodBinding.java:73) javax.faces.component.UICommand.broadcast(UICommand.java:86) javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:94) javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:168) org.apache.myfaces.lifecycle.LifecycleImpl.invokeApplication(LifecycleImpl.java:343) org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:86) javax.faces.webapp.FacesServlet.service(FacesServlet.java:137) org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:144) Thanks for all the helps! Damar On 11/10/06, Gerald Müllan [EMAIL PROTECTED] wrote: Hi, speaking in code, it would be something like this: public void deleteRow(ActionEvent actionEvent) { UIData uiData = JsfUtils.getUIDataParent(actionEvent); getList().remove(uiData.getRowIndex()); } In JsfUtils: public static UIData getUIDataParent(ActionEvent e) { UIComponent component = e.getComponent(); while (component != null !(component instanceof UIData)) { component = component.getParent(); } return (UIData) component; } cheers, Gerald On 11/10/06, Damar Thapa [EMAIL PROTECTED] wrote: Hi, Sorry to bother you all again! What is the command in action event method to get the dataTable's data so as to manipulate it? I will start googling for this tonight. Thanks, Damar On 11/9/06, Damar Thapa [EMAIL PROTECTED] wrote: Thanks, Simon. I will try this. Damar On 11/9/06, Simon Kitching [EMAIL PROTECTED] wrote: Hi Damar, I think one way to do this is write a simple class: public class SelectableApplicant { private boolean isSelected; private Applicant applicant; // add getters/setters for above } Change applicationProcess.applicants to return a list of SelectableApplicant rather than Applicant directly. Your JSP columns can be: h:column t:selectBooleanCheckbox .. value=#{application.selected}/ /h:column h:column h:outputText value=#{application.applicant.firstName}/ /h:column etc. Obviously, you can now iterate over the rows in the data model, checking the boolean flag and if set processing the associated applicant object. Regards, Simon Damar Thapa wrote: Hi, Thanks for your help – truly appreciated. Now, I am in the last stage of this problem, ie I have to save the data from the dataTable into a new file and in new Class structure. It may be straight forward, anyway, I explain what I am trying to do. The following is the snapshot of my dataTable: t:dataTable id=applicantsData …… …… var=application value=#{applicationProcess.applications} border=1 preserveDataModel=false h:column f:facet name=headerh:outputText value=Selected//f:facet t:selectBooleanCheckbox forceId=true id=chk onclick=onChangeSelect(this); value=#{applicationProcess.selected}/ /h:column h:column f:facet name=headerh:outputText value=First Name//f:facet h:outputText value=#{application.firstName}/ /h:column Surname, Class …. /t:dataTable The dataTable is using applicationProcess.applications list, which is a list of Applicant object. Applicant Object has firstName, surname, class, etc. and I have added t:selectBooleanCheckBox to determine if the individual applicants are selected (and its value ie applicationProcess.selected is not the property of Applicant Class). What I have to do is iterate on the rows of dataTable and if the selectBooleanCheckbox is checked, put it in another List. How can I do this? In the following,say: public
Re: Selectable DataTable or similar to that
Hi, Sorry to bother you all again! What is the command in action event method to get the dataTable's data so as to manipulate it? I will start googling for this tonight. Thanks, Damar On 11/9/06, Damar Thapa [EMAIL PROTECTED] wrote: Thanks, Simon. I will try this. Damar On 11/9/06, Simon Kitching [EMAIL PROTECTED] wrote: Hi Damar, I think one way to do this is write a simple class: public class SelectableApplicant { private boolean isSelected; private Applicant applicant; // add getters/setters for above } Change applicationProcess.applicants to return a list of SelectableApplicant rather than Applicant directly. Your JSP columns can be: h:column t:selectBooleanCheckbox .. value=#{application.selected}/ /h:column h:column h:outputText value=#{application.applicant.firstName}/ /h:column etc. Obviously, you can now iterate over the rows in the data model, checking the boolean flag and if set processing the associated applicant object. Regards, Simon Damar Thapa wrote: Hi, Thanks for your help – truly appreciated. Now, I am in the last stage of this problem, ie I have to save the data from the dataTable into a new file and in new Class structure. It may be straight forward, anyway, I explain what I am trying to do. The following is the snapshot of my dataTable: t:dataTable id=applicantsData …… …… var=application value=#{applicationProcess.applications} border=1 preserveDataModel=false h:column f:facet name=headerh:outputText value=Selected//f:facet t:selectBooleanCheckbox forceId=true id=chk onclick=onChangeSelect(this); value=#{applicationProcess.selected}/ /h:column h:column f:facet name=headerh:outputText value=First Name//f:facet h:outputText value=#{application.firstName}/ /h:column Surname, Class …. /t:dataTable The dataTable is using applicationProcess.applications list, which is a list of Applicant object. Applicant Object has firstName, surname, class, etc. and I have added t:selectBooleanCheckBox to determine if the individual applicants are selected (and its value ie applicationProcess.selected is not the property of Applicant Class). What I have to do is iterate on the rows of dataTable and if the selectBooleanCheckbox is checked, put it in another List. How can I do this? In the following,say: public void saveData(ActionEvent event){ FacesContect context=FacesContext.getCurrentInstance(); List aList=event.getComponent()….. ….. In the above, does event returns List from the dataTable? The value of selectBooleanCheckbox ie applicationProcess.selected is not the property of Applicant class, is it going to be the problem Any pointers would be highly appreciated, and sorry for lengthy and too novice questions. With regards, Damar -- With regards, Damar Thapa -- With regards, Damar Thapa
Re: Selectable DataTable or similar to that
Hi, Thanks for your help – truly appreciated. Now, I am in the last stage of this problem, ie I have to save the data from the dataTable into a new file and in new Class structure. It may be straight forward, anyway, I explain what I am trying to do. The following is the snapshot of my dataTable: t:dataTable id=applicantsData …… …… var=application value=#{applicationProcess.applications} border=1 preserveDataModel=false h:column f:facet name=headerh:outputText value=Selected//f:facet t:selectBooleanCheckbox forceId=true id=chk onclick=onChangeSelect(this); value=#{applicationProcess.selected}/ /h:column h:column f:facet name=headerh:outputText value=First Name//f:facet h:outputText value=#{application.firstName}/ /h:column Surname, Class …. /t:dataTable The dataTable is using applicationProcess.applications list, which is a list of Applicant object. Applicant Object has firstName, surname, class, etc. and I have added t:selectBooleanCheckBox to determine if the individual applicants are selected (and its value ie applicationProcess.selected is not the property of Applicant Class). What I have to do is iterate on the rows of dataTable and if the selectBooleanCheckbox is checked, put it in another List. How can I do this? In the following,say: public void saveData(ActionEvent event){ FacesContect context=FacesContext.getCurrentInstance(); List aList=event.getComponent()….. ….. In the above, does event returns List from the dataTable? The value of selectBooleanCheckbox ie applicationProcess.selected is not the property of Applicant class, is it going to be the problem Any pointers would be highly appreciated, and sorry for lengthy and too novice questions. With regards, Damar On 11/8/06, Damar Thapa [EMAIL PROTECTED] wrote: Hi, I found a typo instead of onchange I had typed onChange, and it was causing the problem of not executing the valueChange method. Sorry for this and thanks for your help. With regards, Damar On 11/8/06, Damar Thapa [EMAIL PROTECTED] wrote: Hi, It is me again. Just to confirm that valuechange-method is not called -- console shows no actions. How can I ensure that it is called? With regards, Damar On 11/8/06, Damar Thapa [EMAIL PROTECTED] wrote: Hi, since no values are displayed at all, possibly valuechange-method is not called. I have put the binding - thanks. How can I check if the method is called? Sorry, this is my very first JSF application. Thanks once again. With regards, Damar On 11/8/06, Gerald Müllan [EMAIL PROTECTED] wrote: Hi, you mean the new list is not re-displayed? Is the valuechange-method called? You have given a wrong binding (left out the #{ } ), in this case maybe thats the problem. regards, Gerald On 11/7/06, Damar Thapa [EMAIL PROTECTED] wrote: Thanks for your message. But, there is no validation error. With regards, Damar On 11/7/06, Jeff Bischoff [EMAIL PROTECTED] wrote: Have you checked to make sure there are no validation errors? Damar Thapa wrote: Hi, I have managed to workout with dataTable now; thank you. But, I have a question about ValueChage event. I have the following snapshot: h:selectOneMenu value=#{applicationProcess.courseTitle} onChange=submit(); valueChangeListener=applicationProcess.changeApplicationList immediate=true f:selectItems value=#{applicationProcess.courses}/ /h:selectOneMenu t:dataTable id=applicantsData styleClass=scrollerTable headerClass=standardTable_Header footerClass=standardTable_Header rowClasses=standardTable_Row1,standardTable_Row2 columnClasses=standardTable_Column,standardTable_ColumnCentered,standardTable_Column var=applications value=#{applicationProcess.applications} border=1 preserveDataModel=false h:column f:facet name=headerh:outputText value=Selected//f:facet t:selectBooleanCheckbox value=#{applicationProcess.selected}/ /h:column ….. …… In the above, changeApplicationList (value change method) changes the list of applications list that is used by dataTable to display applications. The following is the snapshot of my changeApplicationList method (ValueChangeEvent): String course=(String) event.getNewValue(); java.util.ArrayList list=new java.util.ArrayList(); while (result.hasNext()){ fill list with application…. } } this.setApplications(list); } } My question is what triggers to render/re-render dataTable when value is change in SelectOnMenu? Mine is not working. Thanks, Damar On 11/7/06, Jeff Bischoff [EMAIL PROTECTED] wrote: Well yeah, though he probably wants check boxes, to be able
Re: Selectable DataTable or similar to that
Thanks, Simon. I will try this. Damar On 11/9/06, Simon Kitching [EMAIL PROTECTED] wrote: Hi Damar, I think one way to do this is write a simple class: public class SelectableApplicant { private boolean isSelected; private Applicant applicant; // add getters/setters for above } Change applicationProcess.applicants to return a list of SelectableApplicant rather than Applicant directly. Your JSP columns can be: h:column t:selectBooleanCheckbox .. value=#{application.selected}/ /h:column h:column h:outputText value=#{application.applicant.firstName}/ /h:column etc. Obviously, you can now iterate over the rows in the data model, checking the boolean flag and if set processing the associated applicant object. Regards, Simon Damar Thapa wrote: Hi, Thanks for your help – truly appreciated. Now, I am in the last stage of this problem, ie I have to save the data from the dataTable into a new file and in new Class structure. It may be straight forward, anyway, I explain what I am trying to do. The following is the snapshot of my dataTable: t:dataTable id=applicantsData …… …… var=application value=#{applicationProcess.applications} border=1 preserveDataModel=false h:column f:facet name=headerh:outputText value=Selected//f:facet t:selectBooleanCheckbox forceId=true id=chk onclick=onChangeSelect(this); value=#{applicationProcess.selected}/ /h:column h:column f:facet name=headerh:outputText value=First Name//f:facet h:outputText value=#{application.firstName}/ /h:column Surname, Class …. /t:dataTable The dataTable is using applicationProcess.applications list, which is a list of Applicant object. Applicant Object has firstName, surname, class, etc. and I have added t:selectBooleanCheckBox to determine if the individual applicants are selected (and its value ie applicationProcess.selected is not the property of Applicant Class). What I have to do is iterate on the rows of dataTable and if the selectBooleanCheckbox is checked, put it in another List. How can I do this? In the following,say: public void saveData(ActionEvent event){ FacesContect context=FacesContext.getCurrentInstance(); List aList=event.getComponent()….. ….. In the above, does event returns List from the dataTable? The value of selectBooleanCheckbox ie applicationProcess.selected is not the property of Applicant class, is it going to be the problem Any pointers would be highly appreciated, and sorry for lengthy and too novice questions. With regards, Damar -- With regards, Damar Thapa
Re: Selectable DataTable or similar to that
Thanks for your message. But, there is no validation error. With regards, Damar On 11/7/06, Jeff Bischoff [EMAIL PROTECTED] wrote: Have you checked to make sure there are no validation errors? Damar Thapa wrote: Hi, I have managed to workout with dataTable now; thank you. But, I have a question about ValueChage event. I have the following snapshot: h:selectOneMenu value=#{applicationProcess.courseTitle} onChange=submit(); valueChangeListener=applicationProcess.changeApplicationList immediate=true f:selectItems value=#{applicationProcess.courses}/ /h:selectOneMenu t:dataTable id=applicantsData styleClass=scrollerTable headerClass=standardTable_Header footerClass=standardTable_Header rowClasses=standardTable_Row1,standardTable_Row2 columnClasses=standardTable_Column,standardTable_ColumnCentered,standardTable_Column var=applications value=#{applicationProcess.applications} border=1 preserveDataModel=false h:column f:facet name=headerh:outputText value=Selected//f:facet t:selectBooleanCheckbox value=#{applicationProcess.selected}/ /h:column ….. …… In the above, changeApplicationList (value change method) changes the list of applications list that is used by dataTable to display applications. The following is the snapshot of my changeApplicationList method (ValueChangeEvent): String course=(String) event.getNewValue(); java.util.ArrayList list=new java.util.ArrayList(); while (result.hasNext()){ fill list with application…. } } this.setApplications(list); } } My question is what triggers to render/re-render dataTable when value is change in SelectOnMenu? Mine is not working. Thanks, Damar On 11/7/06, Jeff Bischoff [EMAIL PROTECTED] wrote: Well yeah, though he probably wants check boxes, to be able to select several at once. In that case, you can have a dataTable column like: h:column f:facet name=headerh:outputText value=Selected//f:facet t:selectBooleanCheckbox value=#{data.selected}/ /h:column Gerald Müllan wrote: Hi, well, there should be a more nicer solution in order to achieve this. Have a look at the sandbox-examples page. An addition to t:dataTable does exist to get one row selected: http://example.irian.at/example-sandbox-20061106/selectOneRow.jsf Should be exactly what you need? cheers, Gerald On 11/6/06, Jeff Bischoff [EMAIL PROTECTED] wrote: Damar, I would say yes, dataTable is the right component for that. I have at some point done all three items which you wish to do. As for some pointers... well there is this [1], though I have a table with checkboxes, and I didn't need any javascript. [1] http://wiki.apache.org/myfaces/ManagingCheckboxes Regards, Jeff Bischoff Kenneth L Kurz Associates, Inc. Damar Thapa wrote: Hi, I have the following snapshot of my page: h:selectOneMenu value=#{applicationProcess.courseTitle} f:selectItems value=#{applicationProcess.courses}/ /h:selectOneMenu t:dataTable var=applicants value=#{applicationProcess.applications} border=1 preserveDataModel=true t:column h:outputText value=#{applicants.firstName}/ /t:column …….. …. /t:dataTable h:commandButton action=processSelectedItem value=DoSomthing/ Basically, what I have to do: (1) I choose the option in selectOnMenu option, and based on the option chosen here, it brings in the relevant data in dataTable. (2) The rows (records) displayed in dataTable has to be selectable, possibly with check boxes, and (3) After completing records selections in dataTable, I click commandButton, which will trigger the event that processes the selected records. How do I do this? Is DataTable right component for this purpose? How can I make record in dataTable selectable with checkboxes? Any examples on this? Any pointers would be highly appreciated. With regards, Damar -- With regards, Damar Thapa
Re: Selectable DataTable or similar to that
Hi, since no values are displayed at all, possibly valuechange-method is not called. I have put the binding - thanks. How can I check if the method is called? Sorry, this is my very first JSF application. Thanks once again. With regards, Damar On 11/8/06, Gerald Müllan [EMAIL PROTECTED] wrote: Hi, you mean the new list is not re-displayed? Is the valuechange-method called? You have given a wrong binding (left out the #{ } ), in this case maybe thats the problem. regards, Gerald On 11/7/06, Damar Thapa [EMAIL PROTECTED] wrote: Thanks for your message. But, there is no validation error. With regards, Damar On 11/7/06, Jeff Bischoff [EMAIL PROTECTED] wrote: Have you checked to make sure there are no validation errors? Damar Thapa wrote: Hi, I have managed to workout with dataTable now; thank you. But, I have a question about ValueChage event. I have the following snapshot: h:selectOneMenu value=#{applicationProcess.courseTitle} onChange=submit(); valueChangeListener=applicationProcess.changeApplicationList immediate=true f:selectItems value=#{applicationProcess.courses}/ /h:selectOneMenu t:dataTable id=applicantsData styleClass=scrollerTable headerClass=standardTable_Header footerClass=standardTable_Header rowClasses=standardTable_Row1,standardTable_Row2 columnClasses=standardTable_Column,standardTable_ColumnCentered,standardTable_Column var=applications value=#{applicationProcess.applications} border=1 preserveDataModel=false h:column f:facet name=headerh:outputText value=Selected//f:facet t:selectBooleanCheckbox value=#{applicationProcess.selected}/ /h:column ….. …… In the above, changeApplicationList (value change method) changes the list of applications list that is used by dataTable to display applications. The following is the snapshot of my changeApplicationList method (ValueChangeEvent): String course=(String) event.getNewValue(); java.util.ArrayList list=new java.util.ArrayList(); while (result.hasNext()){ fill list with application…. } } this.setApplications(list); } } My question is what triggers to render/re-render dataTable when value is change in SelectOnMenu? Mine is not working. Thanks, Damar On 11/7/06, Jeff Bischoff [EMAIL PROTECTED] wrote: Well yeah, though he probably wants check boxes, to be able to select several at once. In that case, you can have a dataTable column like: h:column f:facet name=headerh:outputText value=Selected//f:facet t:selectBooleanCheckbox value=#{data.selected}/ /h:column Gerald Müllan wrote: Hi, well, there should be a more nicer solution in order to achieve this. Have a look at the sandbox-examples page. An addition to t:dataTable does exist to get one row selected: http://example.irian.at/example-sandbox-20061106/selectOneRow.jsf Should be exactly what you need? cheers, Gerald On 11/6/06, Jeff Bischoff [EMAIL PROTECTED] wrote: Damar, I would say yes, dataTable is the right component for that. I have at some point done all three items which you wish to do. As for some pointers... well there is this [1], though I have a table with checkboxes, and I didn't need any javascript. [1] http://wiki.apache.org/myfaces/ManagingCheckboxes Regards, Jeff Bischoff Kenneth L Kurz Associates, Inc. Damar Thapa wrote: Hi, I have the following snapshot of my page: h:selectOneMenu value=#{applicationProcess.courseTitle} f:selectItems value=#{applicationProcess.courses}/ /h:selectOneMenu t:dataTable var=applicants value=#{applicationProcess.applications} border=1 preserveDataModel=true t:column h:outputText value=#{applicants.firstName}/ /t:column …….. …. /t:dataTable h:commandButton action=processSelectedItem value=DoSomthing/ Basically, what I have to do: (1) I choose the option in selectOnMenu option, and based on the option chosen here, it brings in the relevant data in dataTable. (2) The rows (records) displayed in dataTable has to be selectable, possibly with check boxes, and (3) After completing records selections in dataTable, I click commandButton, which will trigger the event that processes the selected records. How do I do this? Is DataTable right component for this purpose? How can I make record in dataTable selectable with checkboxes? Any examples on this? Any pointers would be highly appreciated. With regards, Damar -- With regards, Damar Thapa -- http://www.irian.at Your JSF powerhouse - JSF Consulting, Development
Re: Selectable DataTable or similar to that
Hi, It is me again. Just to confirm that valuechange-method is not called -- console shows no actions. How can I ensure that it is called? With regards, Damar On 11/8/06, Damar Thapa [EMAIL PROTECTED] wrote: Hi, since no values are displayed at all, possibly valuechange-method is not called. I have put the binding - thanks. How can I check if the method is called? Sorry, this is my very first JSF application. Thanks once again. With regards, Damar On 11/8/06, Gerald Müllan [EMAIL PROTECTED] wrote: Hi, you mean the new list is not re-displayed? Is the valuechange-method called? You have given a wrong binding (left out the #{ } ), in this case maybe thats the problem. regards, Gerald On 11/7/06, Damar Thapa [EMAIL PROTECTED] wrote: Thanks for your message. But, there is no validation error. With regards, Damar On 11/7/06, Jeff Bischoff [EMAIL PROTECTED] wrote: Have you checked to make sure there are no validation errors? Damar Thapa wrote: Hi, I have managed to workout with dataTable now; thank you. But, I have a question about ValueChage event. I have the following snapshot: h:selectOneMenu value=#{applicationProcess.courseTitle} onChange=submit(); valueChangeListener=applicationProcess.changeApplicationList immediate=true f:selectItems value=#{applicationProcess.courses}/ /h:selectOneMenu t:dataTable id=applicantsData styleClass=scrollerTable headerClass=standardTable_Header footerClass=standardTable_Header rowClasses=standardTable_Row1,standardTable_Row2 columnClasses=standardTable_Column,standardTable_ColumnCentered,standardTable_Column var=applications value=#{applicationProcess.applications} border=1 preserveDataModel=false h:column f:facet name=headerh:outputText value=Selected//f:facet t:selectBooleanCheckbox value=#{applicationProcess.selected}/ /h:column ….. …… In the above, changeApplicationList (value change method) changes the list of applications list that is used by dataTable to display applications. The following is the snapshot of my changeApplicationList method (ValueChangeEvent): String course=(String) event.getNewValue(); java.util.ArrayList list=new java.util.ArrayList(); while (result.hasNext()){ fill list with application…. } } this.setApplications(list); } } My question is what triggers to render/re-render dataTable when value is change in SelectOnMenu? Mine is not working. Thanks, Damar On 11/7/06, Jeff Bischoff [EMAIL PROTECTED] wrote: Well yeah, though he probably wants check boxes, to be able to select several at once. In that case, you can have a dataTable column like: h:column f:facet name=headerh:outputText value=Selected//f:facet t:selectBooleanCheckbox value=#{data.selected}/ /h:column Gerald Müllan wrote: Hi, well, there should be a more nicer solution in order to achieve this. Have a look at the sandbox-examples page. An addition to t:dataTable does exist to get one row selected: http://example.irian.at/example-sandbox-20061106/selectOneRow.jsf Should be exactly what you need? cheers, Gerald On 11/6/06, Jeff Bischoff [EMAIL PROTECTED] wrote: Damar, I would say yes, dataTable is the right component for that. I have at some point done all three items which you wish to do. As for some pointers... well there is this [1], though I have a table with checkboxes, and I didn't need any javascript. [1] http://wiki.apache.org/myfaces/ManagingCheckboxes Regards, Jeff Bischoff Kenneth L Kurz Associates, Inc. Damar Thapa wrote: Hi, I have the following snapshot of my page: h:selectOneMenu value=#{applicationProcess.courseTitle} f:selectItems value=#{applicationProcess.courses}/ /h:selectOneMenu t:dataTable var=applicants value=#{applicationProcess.applications} border=1 preserveDataModel=true t:column h:outputText value=#{applicants.firstName}/ /t:column …….. …. /t:dataTable h:commandButton action=processSelectedItem value=DoSomthing/ Basically, what I have to do: (1) I choose the option in selectOnMenu option, and based on the option chosen here, it brings in the relevant data in dataTable. (2) The rows (records) displayed in dataTable has to be selectable, possibly with check boxes, and (3) After completing records selections in dataTable, I click commandButton, which will trigger the event that processes the selected records. How do I do this? Is DataTable right component
Re: Selectable DataTable or similar to that
Hi, I found a typo instead of onchange I had typed onChange, and it was causing the problem of not executing the valueChange method. Sorry for this and thanks for your help. With regards, Damar On 11/8/06, Damar Thapa [EMAIL PROTECTED] wrote: Hi, It is me again. Just to confirm that valuechange-method is not called -- console shows no actions. How can I ensure that it is called? With regards, Damar On 11/8/06, Damar Thapa [EMAIL PROTECTED] wrote: Hi, since no values are displayed at all, possibly valuechange-method is not called. I have put the binding - thanks. How can I check if the method is called? Sorry, this is my very first JSF application. Thanks once again. With regards, Damar On 11/8/06, Gerald Müllan [EMAIL PROTECTED] wrote: Hi, you mean the new list is not re-displayed? Is the valuechange-method called? You have given a wrong binding (left out the #{ } ), in this case maybe thats the problem. regards, Gerald On 11/7/06, Damar Thapa [EMAIL PROTECTED] wrote: Thanks for your message. But, there is no validation error. With regards, Damar On 11/7/06, Jeff Bischoff [EMAIL PROTECTED] wrote: Have you checked to make sure there are no validation errors? Damar Thapa wrote: Hi, I have managed to workout with dataTable now; thank you. But, I have a question about ValueChage event. I have the following snapshot: h:selectOneMenu value=#{applicationProcess.courseTitle} onChange=submit(); valueChangeListener=applicationProcess.changeApplicationList immediate=true f:selectItems value=#{applicationProcess.courses}/ /h:selectOneMenu t:dataTable id=applicantsData styleClass=scrollerTable headerClass=standardTable_Header footerClass=standardTable_Header rowClasses=standardTable_Row1,standardTable_Row2 columnClasses=standardTable_Column,standardTable_ColumnCentered,standardTable_Column var=applications value=#{applicationProcess.applications} border=1 preserveDataModel=false h:column f:facet name=headerh:outputText value=Selected//f:facet t:selectBooleanCheckbox value=#{applicationProcess.selected}/ /h:column ….. …… In the above, changeApplicationList (value change method) changes the list of applications list that is used by dataTable to display applications. The following is the snapshot of my changeApplicationList method (ValueChangeEvent): String course=(String) event.getNewValue(); java.util.ArrayList list=new java.util.ArrayList(); while (result.hasNext()){ fill list with application…. } } this.setApplications(list); } } My question is what triggers to render/re-render dataTable when value is change in SelectOnMenu? Mine is not working. Thanks, Damar On 11/7/06, Jeff Bischoff [EMAIL PROTECTED] wrote: Well yeah, though he probably wants check boxes, to be able to select several at once. In that case, you can have a dataTable column like: h:column f:facet name=headerh:outputText value=Selected//f:facet t:selectBooleanCheckbox value=#{data.selected}/ /h:column Gerald Müllan wrote: Hi, well, there should be a more nicer solution in order to achieve this. Have a look at the sandbox-examples page. An addition to t:dataTable does exist to get one row selected: http://example.irian.at/example-sandbox-20061106/selectOneRow.jsf Should be exactly what you need? cheers, Gerald On 11/6/06, Jeff Bischoff [EMAIL PROTECTED] wrote: Damar, I would say yes, dataTable is the right component for that. I have at some point done all three items which you wish to do. As for some pointers... well there is this [1], though I have a table with checkboxes, and I didn't need any javascript. [1] http://wiki.apache.org/myfaces/ManagingCheckboxes Regards, Jeff Bischoff Kenneth L Kurz Associates, Inc. Damar Thapa wrote: Hi, I have the following snapshot of my page: h:selectOneMenu value=#{applicationProcess.courseTitle} f:selectItems value=#{applicationProcess.courses}/ /h:selectOneMenu t:dataTable var=applicants value=#{applicationProcess.applications} border=1 preserveDataModel=true t:column h:outputText value=#{applicants.firstName}/ /t:column …….. …. /t:dataTable h:commandButton action=processSelectedItem value=DoSomthing/ Basically, what I have to do: (1) I choose the option in selectOnMenu option, and based on the option chosen here
Selectable DataTable or similar to that
Hi, I have the following snapshot of my page: h:selectOneMenu value=#{applicationProcess.courseTitle} f:selectItems value=#{applicationProcess.courses}/ /h:selectOneMenu t:dataTable var=applicants value=#{applicationProcess.applications} border=1 preserveDataModel=true t:column h:outputText value=#{applicants.firstName}/ /t:column …….. …. /t:dataTable h:commandButton action=processSelectedItem value=DoSomthing/ Basically, what I have to do: (1) I choose the option in selectOnMenu option, and based on the option chosen here, it brings in the relevant data in dataTable. (2) The rows (records) displayed in dataTable has to be selectable, possibly with check boxes, and (3) After completing records selections in dataTable, I click commandButton, which will trigger the event that processes the selected records. How do I do this? Is DataTable right component for this purpose? How can I make record in dataTable selectable with checkboxes? Any examples on this? Any pointers would be highly appreciated. With regards, Damar
Re: Selectable DataTable or similar to that
Hi, I have managed to workout with dataTable now; thank you. But, I have a question about ValueChage event. I have the following snapshot: h:selectOneMenu value=#{applicationProcess.courseTitle} onChange=submit(); valueChangeListener=applicationProcess.changeApplicationList immediate=true f:selectItems value=#{applicationProcess.courses}/ /h:selectOneMenu t:dataTable id=applicantsData styleClass=scrollerTable headerClass=standardTable_Header footerClass=standardTable_Header rowClasses=standardTable_Row1,standardTable_Row2 columnClasses=standardTable_Column,standardTable_ColumnCentered,standardTable_Column var=applications value=#{applicationProcess.applications} border=1 preserveDataModel=false h:column f:facet name=headerh:outputText value=Selected//f:facet t:selectBooleanCheckbox value=#{applicationProcess.selected}/ /h:column ….. …… In the above, changeApplicationList (value change method) changes the list of applications list that is used by dataTable to display applications. The following is the snapshot of my changeApplicationList method (ValueChangeEvent): String course=(String) event.getNewValue(); java.util.ArrayList list=new java.util.ArrayList(); while (result.hasNext()){ fill list with application…. } } this.setApplications(list); } } My question is what triggers to render/re-render dataTable when value is change in SelectOnMenu? Mine is not working. Thanks, Damar On 11/7/06, Jeff Bischoff [EMAIL PROTECTED] wrote: Well yeah, though he probably wants check boxes, to be able to select several at once. In that case, you can have a dataTable column like: h:column f:facet name=headerh:outputText value=Selected//f:facet t:selectBooleanCheckbox value=#{data.selected}/ /h:column Gerald Müllan wrote: Hi, well, there should be a more nicer solution in order to achieve this. Have a look at the sandbox-examples page. An addition to t:dataTable does exist to get one row selected: http://example.irian.at/example-sandbox-20061106/selectOneRow.jsf Should be exactly what you need? cheers, Gerald On 11/6/06, Jeff Bischoff [EMAIL PROTECTED] wrote: Damar, I would say yes, dataTable is the right component for that. I have at some point done all three items which you wish to do. As for some pointers... well there is this [1], though I have a table with checkboxes, and I didn't need any javascript. [1] http://wiki.apache.org/myfaces/ManagingCheckboxes Regards, Jeff Bischoff Kenneth L Kurz Associates, Inc. Damar Thapa wrote: Hi, I have the following snapshot of my page: h:selectOneMenu value=#{applicationProcess.courseTitle} f:selectItems value=#{applicationProcess.courses}/ /h:selectOneMenu t:dataTable var=applicants value=#{applicationProcess.applications} border=1 preserveDataModel=true t:column h:outputText value=#{applicants.firstName}/ /t:column …….. …. /t:dataTable h:commandButton action=processSelectedItem value=DoSomthing/ Basically, what I have to do: (1) I choose the option in selectOnMenu option, and based on the option chosen here, it brings in the relevant data in dataTable. (2) The rows (records) displayed in dataTable has to be selectable, possibly with check boxes, and (3) After completing records selections in dataTable, I click commandButton, which will trigger the event that processes the selected records. How do I do this? Is DataTable right component for this purpose? How can I make record in dataTable selectable with checkboxes? Any examples on this? Any pointers would be highly appreciated. With regards, Damar -- With regards, Damar Thapa
Help in writing Validator
Hi, I have one h:inputText field that I would like to validate against the availability of that entry in the database -- accept only if the input text is in the database. Can somebody in list list give me some pointers on this? Thanks, With regards, Damar Thapa
Re: Help in writing Validator
Hi Cagatay, Thanks for your pointers. I will look at the options. With regards, Damar On 11/2/06, Cagatay Civici [EMAIL PROTECTED] wrote: Hi, There are several choices, you may try to write a validator method in your managed bean and do a method binding to it via the validator attribute like; h:inputText validator=#{beanname.validatormethod } / public void validateCode(FacesContext facesContext, UIComponent component, Object value) { //throw new ValidationException if you think value is not valid } Also for better reusing, you can write your own validator and bind it to the inputText by the f:validator / http://publib.boulder.ibm.com/infocenter/radhelp/v6r0m1/index.jsp?topic=/com.ibm.etools.jsf.doc/topics/tjsfcrvalidator.html In addition you can create it's own tag for your validator like in; http://www.jsffaq.com/Wiki.jsp?page=HowToCreateTheCustomValidator Cagatay On 11/2/06, Damar Thapa [EMAIL PROTECTED] wrote: Hi, I have one h:inputText field that I would like to validate against the availability of that entry in the database -- accept only if the input text is in the database. Can somebody in list list give me some pointers on this? Thanks, With regards, Damar Thapa -- With regards, Damar Thapa
General JSF question -- Class object!
Hi, I have following classes: Class Course( String title, String startDate. ….. …. } and Class Apply{ String studnetName; Course firstChoice; . ……. ….. } In the apply form (page), I havae a field to accept course title from the applicant ie h:inputText id=firstChoice value=#{applicant.firstChoice.title}/. Since title is unique, I can retrieve Course object for firstChoice properties later before saving Apply object. But, I am getting firstChoice: Error during model data update. error on #{applicant.firstChoice.title} . Can somebody on the list point me what am I missing? Any pointers would be highly appreciated. Thanks, Damar
Re: General JSF question -- Class object!
Hi David, Thanks for your prompt reply. I am trying similar to your first suggestion. In your case, I suppose, firstChoice has to be type String, but I made firstChoice as type Course, where Course has several properties and one of them is title. So I am trying to do similary to: h:selectOne id=firstChoice value =#{applicant.firstChoice.title} f:selectItems value=#{school.availableCourses}/ /h:selectOne Basically, trying to bind value to #{applicant.firstChoice.title} instead. Is it possible? Thanks, Damar On 10/31/06, David Delbecq [EMAIL PROTECTED] wrote: Hi, Am a little confused by your explaination. I bet you are transforming a textfield String (the course title) somehow in a Course object later. I have 2 suggestions: The first it to replace you textfield with a combo box, like this h:selectOne id=firstChoice value =#{applicant.firstChoice} f:selectItems value=#{school.availableCourses}/ /h:selectOne with your school bean having something like this public SelectItems[] getAvailableCourses(){ ... } The second way to go is to use a converter h:inputText id=firstChoice value =#{applicant.firstChoice} f:converter converterId=my.custom.Converter/ /h:inputText with the converter define in you faces-config.xml: converter converter-idmy.custom.Converter/converter-id converter-classpath.to.my.custom.CourseConverter/converter-class /converter your converter being an implementation of javax.faces.convert.Converter pointer: http://www-128.ibm.com/developerworks/java/library/j-jsf3/ Damar Thapa a écrit : Hi, I have following classes: Class Course( String title, String startDate. ….. …. } and Class Apply{ String studnetName; Course firstChoice; . ……. ….. } In the apply form (page), I havae a field to accept course title from the applicant ie h:inputText id=firstChoice value=#{applicant.firstChoice.title}/. Since title is unique, I can retrieve Course object for firstChoice properties later before saving Apply object. But, I am getting firstChoice: Error during model data update. error on #{applicant.firstChoice.title} . Can somebody on the list point me what am I missing? Any pointers would be highly appreciated. Thanks, Damar -- With regards, Damar Thapa
Re: General JSF question -- Class object!
Thanks, indeed. Damar On 10/31/06, David Delbecq [EMAIL PROTECTED] wrote: This all depends on what you want to do Do you want to 'set the title of firstChoice'? then you map to #{applicant.firstChoice.title} do you want to 'set the firstChoice'? then you map to #{applicant.firstChoice} The SelectItem[] is use to select amongst a list of possible values. You don't have to care how they are wired at html level, You just provide a list of SelectItem[] object which have a visual label (type String), a description (type String, never used) and a Value (type Object). So you can put in value whatever you want, JSF will take care that when an item is selected for selectbox, the backing bean will be update with something like setFirstChoice(selectedItem.getValue()). Btw, sorry, this is not h:selectOne but h:selectOneMenu :D Damar Thapa a écrit : Hi David, Thanks for your prompt reply. I am trying similar to your first suggestion. In your case, I suppose, firstChoice has to be type String, but I made firstChoice as type Course, where Course has several properties and one of them is title. So I am trying to do similary to: h:selectOne id=firstChoice value =#{applicant.firstChoice.title} f:selectItems value=#{school.availableCourses}/ /h:selectOne Basically, trying to bind value to #{applicant.firstChoice.title} instead. Is it possible? Thanks, Damar On 10/31/06, David Delbecq [EMAIL PROTECTED] wrote: Hi, Am a little confused by your explaination. I bet you are transforming a textfield String (the course title) somehow in a Course object later. I have 2 suggestions: The first it to replace you textfield with a combo box, like this h:selectOne id=firstChoice value =#{applicant.firstChoice} f:selectItems value=#{school.availableCourses}/ /h:selectOne with your school bean having something like this public SelectItems[] getAvailableCourses(){ ... } The second way to go is to use a converter h:inputText id=firstChoice value =#{applicant.firstChoice} f:converter converterId=my.custom.Converter/ /h:inputText with the converter define in you faces-config.xml: converter converter-idmy.custom.Converter/converter-id converter-classpath.to.my.custom.CourseConverter/converter-class /converter your converter being an implementation of javax.faces.convert.Converter pointer: http://www-128.ibm.com/developerworks/java/library/j-jsf3/ Damar Thapa a écrit : Hi, I have following classes: Class Course( String title, String startDate. ….. …. } and Class Apply{ String studnetName; Course firstChoice; . ……. ….. } In the apply form (page), I havae a field to accept course title from the applicant ie h:inputText id=firstChoice value=#{applicant.firstChoice.title}/. Since title is unique, I can retrieve Course object for firstChoice properties later before saving Apply object. But, I am getting firstChoice: Error during model data update. error on #{applicant.firstChoice.title} . Can somebody on the list point me what am I missing? Any pointers would be highly appreciated. Thanks, Damar -- With regards, Damar Thapa
Re: General JSF question -- Class object!
Hi Rene, Possibly, it is null. I am still getting firstChoice: Error during model data update. error. I can add two more attribues of type String to hold firstChoice and secondChoice in Applicant class, but as a matter of interest and learning, how it works in JSF? Thanks, Damar n 10/31/06, Rene Guenther [EMAIL PROTECTED] wrote: Is firstChoice != null? Regards Rene On Tue, 31 Oct 2006 20:32:40 +0800 Damar Thapa [EMAIL PROTECTED] wrote: Hi, I have following classes: Class Course( String title, String startDate. ….. …. } and Class Apply{ String studnetName; Course firstChoice; . ……. ….. } In the apply form (page), I havae a field to accept course title from the applicant ie h:inputText id=firstChoice value=#{applicant.firstChoice.title}/. Since title is unique, I can retrieve Course object for firstChoice properties later before saving Apply object. But, I am getting firstChoice: Error during model data update. error on #{applicant.firstChoice.title} . Can somebody on the list point me what am I missing? Any pointers would be highly appreciated. Thanks, Damar -- With regards, Damar Thapa