AW: bind HtmlPanelGrid dynamically in datatable
Hi! Thanks a lot for your solutions (really simple ;-)). Regards, Stefan -Ursprüngliche Nachricht- Von: fabio fornelli [mailto:[EMAIL PROTECTED] Gesendet: Montag, 24. Oktober 2005 17:17 An: MyFaces Discussion Betreff: Re: bind HtmlPanelGrid dynamically in datatable Stefan Gesigora wrote: Hi folks! Problem: I wanna show a Link in a datatable if the user has a specific right and if he hasn't I wanna show only text. If I use the rendered tag the text wasn't shown if rendered = false. Hi ya! what about this? a command link is rendered only when the boolean variable sessionScope.ucs.secGroup is set to true otherwhise an output text is displayed. h:commandLink value=UNLOCK action=#{odgPwdHandler.unlockUser} rendered=#{ (sessionScope.ucs.secGroup) } f:param name=uid value=#{result.userId}/ /h:commandLink h:outputText value=UNLOCK rendered=#{(not sessionScope.ucs.secGroup) }/ BTW you can embed this in a Datatable cheers fabio So I tried to put an HtmlPanelGrid into my datatable with the attribute: binding=#{row.testPanel} (row is the var for the rows...). But it didn't work. I got error messages like this: Error setting property 'testPanel' in bean of type null What can I do except writing a custom component??? regards, Stefan
AW: Finding a component with a specific id
Hi! You need the name/id of the form enclosing your component! Then you can use the findComponent method in this way: UIComponent table = facesContext.getViewRoot().findComponent(formId + : + tableId); Or you has a binding to your parentcomponent (f.e. form) and call the finComponent method at the parentcomponent only with the tableId. If you are using this method you must ensure that the tableId doesn't change! Regards, Stefan -Ursprüngliche Nachricht- Von: Simon Kitching [mailto:[EMAIL PROTECTED] Gesendet: Dienstag, 25. Oktober 2005 06:07 An: MyFaces Discussion Betreff: Finding a component with a specific id Hi, From a custom renderer I need to be able to find a component with a specific id. Page: o:colSelector tableId=table1 .../ t:dataTable id=table1 ... .. /t:dataTable From the renderer for the o:colSelector I've tried: UIComponent table = facesContext.getViewRoot().findComponent(tableId); UIComponent table = component.findComponent(tableId); UIComponent table = component.findComponent(: + tableId); but had no luck. The table is enclosed in a subview named body, so the id actually gets output as body:table1. I've tried all the above with that string too, and no luck. Any ideas how I should locate that table component by id?? [And BTW, is it possible for a component in a naming container to have an id that is *not* prefixed by its NamingContainer parent's id?] On a related note, looking at the source for UIComponent.findComponent, I see it calls _ComponentUtils.findComponent which is as follows. static UIComponent findComponent(UIComponent findBase, String id) { if (idsAreEqual(id,findBase)) { return findBase; } for (Iterator it = findBase.getFacetsAndChildren(); it.hasNext(); ) { UIComponent childOrFacet = (UIComponent)it.next(); if (!(childOrFacet instanceof NamingContainer)) { UIComponent find = findComponent(childOrFacet, id); if (find != null) return find; } else if (idsAreEqual(id,childOrFacet)) { return childOrFacet; } } return null; } What's the point of that instanceof NamingContainer? Why doesn't the search recurse into NamingContainer children of findBase? Thanks, Simon
Re: inputCalendar javascript Error on IE
Currently there is a lot done with regard to patching and bug fixes. So the releases and the nightly builds are kind of a moving target. Glad that you found one that fixed both issues for you ;) regards, Martin On 10/24/05, Kevin [EMAIL PROTECTED] wrote: Hi, For those of you who have encountered this JavaScript error in IE with inputCalendar or inputDate, you might want to try downloading 1.1.1RC3. I updated my project to use to use that version today and the inputCalendar now works again in IE for me. Previously, I had downloaded a nightly build from 10/17/2005 in order to fix a problem I was experiencing with jscookmenu. So, 1.1.1RC3 seems to contain fixes for both of my previous problems. Keep up the good work! Cheers, Kevin Hutson -- http://www.irian.at Your JSF powerhouse - JSF Trainings in English and German
Dynamic tabs
Hi, In my application I need to present the user with something similar to an Excel document, i.e., several tabs (Excel sheets) and the possibility to edit tabular data (using a datatable) for every tab. Has anyone tried something like this? I would really appreciate to hear about your approaches.
Re: Comparable validation design
@attribute name: is there something like this in the RI 1.2? I think that yes, so maybe we should go with their name for this. @comparable: right, there is the interface name - I didn't think about that. But then the equalsValidator is named by the method it calls - so maybe we should take the method name here as well - compareToValidator or more simple compareValidator ? Forget about my suggestions if I start to enerve you - then just take the interface name ;) regards, Martin On 10/24/05, Mike Kienenberger [EMAIL PROTECTED] wrote: comparingValidator works for me. As Alexander pointed out, I used comparableValidator as a first guess because it works on any objects implementing Comparable. I don't see the need for comparingValidator to depend on the OptionalValidatorFramework, although the supporting boolean wrapping validator that Alexander proposed might share code with the OVF project. The OptionalValidatorFramework isn't quite ready yet. I'd say it's 95% done functionally, but there's still some more work that needs to be done to handle converters better. Now that we've got it functional, we have a lot of cleanup that remains. I'm also not happy with how the facelets integration was implemented, and I need to work out those details with the Facelets folks. Does anyone have a suggestion on the attribute name for specifying an optional identifier of the message as it is the message-files? This attribute would be a good tomahawk extension for all validators. On 10/22/05, Jesse Alexander (KBSA 21) [EMAIL PROTECTED] wrote: -Original Message- Just a naming thing - shouldn't it be comparingValidator or compareValidator instead of comparableValidator? -/Original Message- I guess the name is just a first throw... maybe comparable because it accepts any Comparable object... But part of bringing it up here is get some more opinions. -Original Message- By the way, are you guys going to move the optional validator framework over as well? -/Original Message- Well, I opened the jsf-comp project as a means to try out stuff in a shared way. the rules for getting access are more loose. And when the community thinks our stuff is good enough, I would really enjoy seeing it moved to the myfaces project. Consider our project as a playground for shareable components, a testbed before moving them to MyFaces. the comparable/comparing validator most likely will depend on the optional validator stuff. Does that sound good? regards, Alexander -- http://www.irian.at Your JSF powerhouse - JSF Trainings in English and German
Re: PROBLEMS WITH TREE2
I don't think that the browser cache is the problem - if the browser would cache the html of the tree then you would also get the old (administrator's) tree displayed. Imho the problem is a session bean containing your tree data. You should destroy all session data when a user logs out. rosalba bochicchio wrote: I've probably found the trouble. I suppose it is a problem due to browser caching...I'll try to explain it: my web app is a management console. It's made up of a menu, which is a tree, a fix header and a content page. Whe I click on the nodes of the tree I want the content page to change. I can log in as simple user or Administrator. When I log in as Administrator I can see, as a menu, a tree made up of all the users of the console. Instead, when I log in as a simple user I can see anly myself. The behaviour is the following one: When I log in as simple user and the as Administrator, everything works fine. When I log in as Administrator and then as simple user, I get the problem I tried to describe in the previous message...that is, when clicking on the unique node of the tree I get the exception! I suppose the reason is that the browser caches the tree with the nodes related to all the user, and gets the exception when the node is made up of a single node...Do you think it's a possible reason? have you any suggestion to solve the question? Thanks, Rosalba --- CONNER, BRENDAN (SBCSI) [EMAIL PROTECTED] wrote: Can you try with the latest release (1.1.1RC3)? - Brendan -Original Message- From: rosalba bochicchio [mailto:[EMAIL PROTECTED] Sent: Friday, October 21, 2005 5:02 AM To: users@myfaces.apache.org Subject: PROBLEMS WITH TREE2 I'm using myfaces 1.0.9. I have a problem with tree2...when I click on one of the nodes, I want to view a new page. But the click on the node generates the following error: java.lang.IllegalArgumentException: Node with id 0:1. Failed to parse 0:1 at org.apache.myfaces.custom.tree2.TreeModel.getNodeById(Ljava.lang.String; )Lorg.apache.myfaces.custom.tree2.TreeNode;(TreeModel.java:153) at org.apache.myfaces.custom.tree2.TreeModel.setNodeId(Ljava.lang.String;)V (TreeModel.java:71) at org.apache.myfaces.custom.tree2.UITreeData.setNodeId(Ljava.lang.String;) V(UITreeData.java:290) at org.apache.myfaces.custom.tree2.HtmlTree.setNodeId(Ljava.lang.String;)V( HtmlTree.java:80) at org.apache.myfaces.custom.tree2.HtmlTreeRenderer.decode(Ljavax.faces.con text.FacesContext;Ljavax.faces.component.UIComponent;)V(HtmlTreeRenderer .java:104) at javax.faces.component.UIComponentBase.decode(Ljavax.faces.context.FacesC ontext;)V(UIComponentBase.java:305) at org.apache.myfaces.custom.tree2.UITreeData.processDecodes(Ljavax.faces.c ontext.FacesContext;)V(UITreeData.java:139) at org.apache.myfaces.custom.tree2.HtmlTree.processDecodes(Ljavax.faces.con text.FacesContext;)V(HtmlTree.java:91) at javax.faces.component.UIComponentBase.processDecodes(Ljavax.faces.contex t.FacesContext;)V(UIComponentBase.java:407) at javax.faces.component.UIComponentBase.processDecodes(Ljavax.faces.contex t.FacesContext;)V(UIComponentBase.java:407) at javax.faces.component.UIViewRoot.processDecodes(Ljavax.faces.context.Fac esContext;)V(UIViewRoot.java:151) at org.apache.myfaces.lifecycle.LifecycleImpl.applyRequestValues(Ljavax.fac es.context.FacesContext;)Z(LifecycleImpl.java:177) at org.apache.myfaces.lifecycle.LifecycleImpl.execute(Ljavax.faces.context. FacesContext;)V(LifecycleImpl.java:87) at javax.faces.webapp.FacesServlet.service(Ljavax.servlet.ServletRequest;Lj avax.servlet.ServletResponse;)V(FacesServlet.java:109) at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run()L java.lang.Object;(ServletStubImpl.java:996) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(Ljavax.servlet.S ervletRequest;Ljavax.servlet.ServletResponse;Lweblogic.servlet.internal. FilterChainImpl;)V(ServletStubImpl.java:419) at weblogic.servlet.internal.TailFilter.doFilter(Ljavax.servlet.ServletRequ est;Ljavax.servlet.ServletResponse;Ljavax.servlet.FilterChain;)V(TailFil ter.java:28) at weblogic.servlet.internal.FilterChainImpl.doFilter(Ljavax.servlet.Servle tRequest;Ljavax.servlet.ServletResponse;)V(FilterChainImpl.java:27) at org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(Ljavax. servlet.ServletRequest;Ljavax.servlet.ServletResponse;Ljavax.servlet.Fil terChain;)V(ExtensionsFilter.java:112) at weblogic.servlet.internal.FilterChainImpl.doFilter(Ljavax.servlet.Servle tRequest;Ljavax.servlet.ServletResponse;)V(FilterChainImpl.java:27) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.r un()Ljava.lang.Object;(WebAppServletContext.java:6458) at
Re: How to use t:saveState ?
Are you using client-side state saving? Try to switch to it just for trying out if this works. regards, Martin On 10/24/05, Juan Medín Piñeiro [EMAIL PROTECTED] wrote: Sorry, It was a typo writing the code in the mail. It should be: f:view BODY t:saveState value=#{aRequestScopedObject}/ h:form styleClass=form id=form1 Yes, ARequestScopedObject implements Serializable. The html form code generated by the code above is: form id=form1 method=post action=/testbox/faces/app/savestate/test1.jsp enctype=application/x-www-form-urlencoded input id=form1:text1 type=text name=form1:text1 value=/ input id=form1:text2 type=text name=form1:text2 value=/ input type=submit value=Submit name=form1:button1 id=form1:button1/ input type=hidden name=form1 value=form1 / /form Where text1 and text2 are text fields I included to test it. There is no html code for the saveState() tag. Regards, - Juan On 10/24/05, David G. Friedman [EMAIL PROTECTED] wrote: Juan, What is testState and shouldn't that be #{testState} ? Did you make it serializable so it can be saved? Regards, David -Original Message- From: Juan Medín Piñeiro [mailto:[EMAIL PROTECTED] Sent: Monday, October 24, 2005 10:42 AM To: MyFaces Discussion Subject: Re: How to use t:saveState ? It's inside the view and outside the form. From the test code: f:view BODY t:saveState value=testState/ h:form styleClass=form id=form1 more markup code Regards, - Juan On 10/24/05, David G. Friedman [EMAIL PROTECTED] wrote: Juan, Is it inside the f:view or outside the view? Regards, David -Original Message- From: Juan Medín Piñeiro [mailto:[EMAIL PROTECTED] Sent: Monday, October 24, 2005 10:28 AM To: users@myfaces.apache.org Subject: How to use t:saveState ? Hi, I've been trying to use t:saveState without success. As far as I can read in the wiki and in the examples, you just need to include a t:saveState value=xxx/ in the JSP and the information will travel to the client and back in the next request. So I created 3 pages, test1, test2 and test3, each with a t:saveState value=aRequestScopedObject/. In the backing bean I do something like: aRequestScopedObject = (ARequestScopedObject) getFacesContext() .getApplication() .createValueBinding(#{aRequestScopedObject}) .getValue(getFacesContext()); And then I set several properties on it. Well, when I reach the test2 page _all changes_ are lost. Reading the generated HTML I don't see anything at all related to the saveState info in the form (!?) Am I missing anything ? Any comment would be really welcome. It seems to be very simple to use, the only strange thing is that I'm using the Sun RI + Tomahawk. Thanks in advance, - Juancho -- http://www.irian.at Your JSF powerhouse - JSF Trainings in English and German
Re: [tobago] error bad type in putfield/putstatic in layout tag
Volker Weber schrieb: Hello Stefan, i can't replicate your problem, could you explain a bit more what you have done? Actually I tried to build the web application from scratch using the example webapp as a template. I'm using maven2, and it's the first project I setup from scratch with maven2, so I think I simply miss some crucial configuration or resource. This is what i did trying to replicate this: In the file webapp/WEB-INF/tags/layout/overview.tag from tobago-example-demo i removed all content between tc:page.. and /tc:page. this results in no error, i got the expected empty page. I found an error in your page: the label must be #{appBundle.pageTitle}, but this can't be the reason of your exception. I fixed the typo but as you already said: this is not the reason for the error. Maybe a look into my war-file will give you an idea what I might have missed. index.jsp intro.jsp META-INF/ META-INF/MANIFEST.MF META-INF/maven/ META-INF/maven/app/ META-INF/maven/app/app-webapp/ META-INF/maven/app/app-webapp/pom.properties META-INF/maven/app/app-webapp/pom.xml tobago-resource/ tobago-resource/html/ tobago-resource/html/standard/ tobago-resource/html/standard/standard/ tobago-resource/html/standard/standard/property/ tobago-resource/html/standard/standard/property/app.properties.x tobago/ tobago/html/ tobago/html/richmond/ tobago/html/richmond/mozilla/ tobago/html/richmond/mozilla/style/ tobago/html/richmond/mozilla/style/style.css tobago/html/richmond/msie/ tobago/html/richmond/msie/style/ tobago/html/richmond/msie/style/style.css tobago/html/richmond/opera/ tobago/html/richmond/opera/style/ tobago/html/richmond/opera/style/tobago-sheet.css tobago/html/richmond/standard/ tobago/html/richmond/standard/image/ tobago/html/richmond/standard/image/ascending.gif tobago/html/richmond/standard/image/calendarFastNext.gif tobago/html/richmond/standard/image/calendarFastNextDisabled.gif tobago/html/richmond/standard/image/calendarFastPrev.gif tobago/html/richmond/standard/image/calendarFastPrevDisabled.gif tobago/html/richmond/standard/image/calendarNext.gif tobago/html/richmond/standard/image/calendarNextDisabled.gif tobago/html/richmond/standard/image/calendarPrev.gif tobago/html/richmond/standard/image/calendarPrevDisabled.gif tobago/html/richmond/standard/image/date.gif tobago/html/richmond/standard/image/descending.gif tobago/html/richmond/standard/image/fastNext.gif tobago/html/richmond/standard/image/fastPrev.gif tobago/html/richmond/standard/image/first.gif tobago/html/richmond/standard/image/firstDisabled.gif tobago/html/richmond/standard/image/foldericon.gif tobago/html/richmond/standard/image/I.gif tobago/html/richmond/standard/image/L.gif tobago/html/richmond/standard/image/last.gif tobago/html/richmond/standard/image/lastDisabled.gif tobago/html/richmond/standard/image/Lminus.gif tobago/html/richmond/standard/image/Lplus.gif tobago/html/richmond/standard/image/MenuArrow.gif tobago/html/richmond/standard/image/MenuCheckmark.gif tobago/html/richmond/standard/image/MenuRadioChecked.gif tobago/html/richmond/standard/image/new.gif tobago/html/richmond/standard/image/next.gif tobago/html/richmond/standard/image/nextDisabled.gif tobago/html/richmond/standard/image/openfoldericon.gif tobago/html/richmond/standard/image/poweredBy.gif tobago/html/richmond/standard/image/prev.gif tobago/html/richmond/standard/image/prevDisabled.gif tobago/html/richmond/standard/image/remove.gif tobago/html/richmond/standard/image/Rminus.gif
Re: Setting a collection????
Can you elaborate a bit more - with snippets from your source? regards, Martin On 10/24/05, Rafael Nami [EMAIL PROTECTED] wrote: Hi everyone We are trying to do something like this: In a page, we have to populate a collection with informations, so we gave to the user a inputText that he can write how much informations he wanna add, and after he submits it, the page is reconstructed adding n lines in this dataTable with forms, to the user complete the informations. The problem is that the faces isn't accepting the collection when i try to execute the action - it's passing the components with null value to the backing bean. What did I have to do? Does JSF didn't have this kind of stuff? What am I going wrong? Thanks in advance and Best Regards Rafael Mauricio Nami -- http://www.irian.at Your JSF powerhouse - JSF Trainings in English and German
RE: [PROPOSAL] PRETTY_HTML, was [RE: JFS's html output]
-Original Message- Just for discussion: Why implement the pretty-html option in every renderer? I think, it would be easier to postprocess the content in the framework before returning the complete html-content to the browser. What do you think? I found e.g. http://sourceforge.net/projects/jtidy which could do this probably. Does anybody know an other Java library which could do this job? The big efford would be, that you could use the RI of SUN also and the content would also be pretty formatted then. -/Original Message- Sort of writing a PrettyHtmlFilter? Might be the easiest way to go for it. regards Alexander
Re: [tobago] error bad type in putfield/putstatic in layout tag
Hello Stefan, your war includes the content of tobago-theme-richmond-zip.zip, but misses the tobago-theme-richmond.jar. If your included the richmond theme in your tobago-config.xml you will get a ClassNotFoundException: org.apache.myfaces.tobago.context.RichmondTheme. But this is also not your original error. Can you try out without the app.tag, it seems me to be more a jsp problem than a tobago one. regards Volker Weber Hedtfeld wrote: [...] Maybe a look into my war-file will give you an idea what I might have missed. index.jsp intro.jsp META-INF/ META-INF/MANIFEST.MF [...] -- Don't answer to From: address! Mail to this account are droped if not recieved via mailinglist. To contact me direct create the mail address by concatenating my forename to my senders domain.
Re: error with sandbox ajax component on
It depends if you provide the maxItems attribute or not - if not, first example below, if yes, second sample below: public List getItems(String prefix) { List li = new ArrayList(); li.add(prefix+1); li.add(prefix+2); li.add(prefix+3); li.add(prefix+4); li.add(prefix+5); li.add(prefix+6); return li; } public List getItems(String prefix, Integer maxSize) { List li = new ArrayList(); for(int i = 0; i maxSize.intValue(); i++) { li.add(prefix+ +(i+1)); } return li; } regards, Martin On 10/25/05, Marco Mistroni [EMAIL PROTECTED] wrote: hello, actually i have deployed the sandbox.war application from examples nightly build Martin, since i get hold of you, forgive me if i ask you a question about the ajax tag. The method of the backing bean that is supposed to be called, what would be its signature? public List myMethod() or public List myMethod(String inputParam) ? thanks for your answer and regards marco On 10/25/05, Martin Marinschek [EMAIL PROTECTED] wrote: Are you using a different version of sandbox.jar and myfaces-all.jar? regards, Martin On 10/25/05, Marco Mistroni [EMAIL PROTECTED] wrote: hello all, i m trying to get acquainted wiht Ajax tag from sandbox i downloaded the latest nightly build (as of now, it is myfaces-20051024-examples.zip).. i have deployed the sandbox.war application on jboss 3.2.5, and what i got is the following error javax.faces.FacesException: org.apache.myfaces.component.html.util.AddResource.addJavaScriptToHeader (Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;ZLjavax/faces/context/FacesContext;)V org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:421) org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView (JspViewHandlerImpl.java:234) org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:300) javax.faces.webapp.FacesServlet.service(FacesServlet.java:95) org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter (ExtensionsFilter.java:122) anyone could help me out? thanks in advance and regards marco -- 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
Re: error with sandbox ajax component on
hello, actually i have deployed the sandbox.war application from examples nightly build Martin, since i get hold of you, forgive me if i ask you a question about the ajax tag. The method of the backing bean that is supposed to be called, what would be its signature? public List myMethod() or public List myMethod(String inputParam) ? thanks for your answer and regards marco On 10/25/05, Martin Marinschek [EMAIL PROTECTED] wrote: Are you using a different version of sandbox.jar and myfaces-all.jar?regards,Martin On 10/25/05, Marco Mistroni [EMAIL PROTECTED] wrote: hello all, i m trying to get acquainted wiht Ajax tag from sandbox i downloaded the latest nightly build (as of now, it is myfaces-20051024-examples.zip).. i have deployed the sandbox.war application on jboss 3.2.5, and what i got is the following error javax.faces.FacesException: org.apache.myfaces.component.html.util.AddResource.addJavaScriptToHeader (Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;ZLjavax/faces/context/FacesContext;)V org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:421) org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView (JspViewHandlerImpl.java:234) org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:300) javax.faces.webapp.FacesServlet.service(FacesServlet.java:95) org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter (ExtensionsFilter.java:122) anyone could help me out? thanks in advance and regardsmarco--http://www.irian.at Your JSF powerhouse -JSF Trainings in English and German
Dynamic menu using navigationMenuItems and NavigationMenuItem
Hi all In my backing bean Im able to dynamically construct the menu tree and it display well on my index.jsp page. The ugly is that I cannot really recognise which menu item has been pressed by the user. I know that a function call is made to the function passed in the action argument. I can for sure give the same function name to called for each menu node, but how do I recognise which menu node have been selected? If I assign different functions to be called for each menu node I loose the dynamism of the menu solution, as I would have to touch the Java code each time a menu node is added or removed. Might be I did not understand it right and would appreciate any tips and hints or an idea how to get around, in JMHO, this restriction. Thanks for all inputs and helps. Cheers Roland
Re: error with sandbox ajax component on
As to your other problem - anything more in your log, stacktrace? regards, Martin On 10/25/05, Martin Marinschek [EMAIL PROTECTED] wrote: It depends if you provide the maxItems attribute or not - if not, first example below, if yes, second sample below: public List getItems(String prefix) { List li = new ArrayList(); li.add(prefix+1); li.add(prefix+2); li.add(prefix+3); li.add(prefix+4); li.add(prefix+5); li.add(prefix+6); return li; } public List getItems(String prefix, Integer maxSize) { List li = new ArrayList(); for(int i = 0; i maxSize.intValue(); i++) { li.add(prefix+ +(i+1)); } return li; } regards, Martin On 10/25/05, Marco Mistroni [EMAIL PROTECTED] wrote: hello, actually i have deployed the sandbox.war application from examples nightly build Martin, since i get hold of you, forgive me if i ask you a question about the ajax tag. The method of the backing bean that is supposed to be called, what would be its signature? public List myMethod() or public List myMethod(String inputParam) ? thanks for your answer and regards marco On 10/25/05, Martin Marinschek [EMAIL PROTECTED] wrote: Are you using a different version of sandbox.jar and myfaces-all.jar? regards, Martin On 10/25/05, Marco Mistroni [EMAIL PROTECTED] wrote: hello all, i m trying to get acquainted wiht Ajax tag from sandbox i downloaded the latest nightly build (as of now, it is myfaces-20051024-examples.zip).. i have deployed the sandbox.war application on jboss 3.2.5, and what i got is the following error javax.faces.FacesException: org.apache.myfaces.component.html.util.AddResource.addJavaScriptToHeader (Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;ZLjavax/faces/context/FacesContext;)V org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:421) org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView (JspViewHandlerImpl.java:234) org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:300) javax.faces.webapp.FacesServlet.service(FacesServlet.java:95) org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter (ExtensionsFilter.java:122) anyone could help me out? thanks in advance and regards marco -- 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
Companies using MyFaces
Hi *, please add your company's name on http://wiki.apache.org/myfaces/Companies_Using_MyFaces if you use MyFaces in one of your applications at these companies. The list starts looking impressive - good idea, Bruno ;) regards, Martin
valueChangeListener - inputText - Which method is correct?
Ive seen 3 different examples of using the valueChangeListener attribute. Ive seen Example 1: JSP h:inputText value=foo f:valueChangeListener type=com.jsf.MyValueChangeListener//h:inputText CODE public class MyValueChangeListener implements ValueChangeListener { public MyValueChangeListener() { } public void processValueChange(ValueChangeEvent vce) throws AbortProcessingException { System.out.println(A value has changed!); }} Example 2: JSP h:inputText id=partNumber value=#{nonConformingMaterial.partNumber} required=true valueChangeListener=#{nonConformingMaterial.changeEvent} onclick=submit() immediate=true / Example 3: JSP s:inputSuggestAjax suggestedItemsMethod=#{inputSuggestAjax.getItems} styleLocation= / I like example 3, very sexy. (see http://irian.at/myfaces-sandbox/inputSuggestAjax.jsf) But its not what I need in my application. What I need is, when an inputText is filled in, an action is called so that another inputText field is automatically filled in. I presume that I should be trying to get example 1 working. Would you agree?
Re: error with sandbox ajax component on
It really looks as if you would use an older version of the implementation. JBoss supplies a version with MyFaces already, so try to get rid of this and replace it with your new version. regards, Martin On 10/25/05, Marco Mistroni [EMAIL PROTECTED] wrote: Hello Martin, here's stack trace 2005-10-25 11:23:06,220 ERROR [org.jboss.web.localhost.Engine] ApplicationDispatcher[/sandbox] Servlet.service() for servlet jsp threw exception java.lang.NoSuchMethodError: org.apache.myfaces.component.html.util.AddResource.addJavaScriptToHeader(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;ZLjavax/faces/context/FacesContext;)V at org.apache.myfaces.custom.inputsuggestajax.InputSuggestAjaxRenderer.encodeJavascript(InputSuggestAjaxRenderer.java:73) at org.apache.myfaces.custom.inputsuggestajax.InputSuggestAjaxRenderer.encodeEnd(InputSuggestAjaxRenderer.java:98) at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:331) at org.apache.myfaces.renderkit.RendererUtils.renderChild(RendererUtils.java:450) at org.apache.myfaces.renderkit.html.HtmlGridRendererBase.renderChildren(HtmlGridRendererBase.java:203) at org.apache.myfaces.renderkit.html.HtmlGridRendererBase.encodeEnd(HtmlGridRendererBase.java:85) at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:331) at javax.faces.webapp.UIComponentTag.encodeEnd(UIComponentTag.java:349) at javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:253) at org.apache.myfaces.taglib.UIComponentBodyTagBase.doEndTag(UIComponentBodyTagBase.java:55) at org.apache.jsp.inputSuggestAjax_jsp._jspx_meth_h_panelGrid_0(inputSuggestAjax_jsp.java:245) at org.apache.jsp.inputSuggestAjax_jsp._jspx_meth_h_form_0(inputSuggestAjax_jsp.java:190) at org.apache.jsp.inputSuggestAjax_jsp._jspx_meth_f_view_0(inputSuggestAjax_jsp.java:157) at org.apache.jsp.inputSuggestAjax_jsp._jspService(inputSuggestAjax_jsp.java:106) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94) at javax.servlet.http.HttpServlet.service(HttpServlet.java:810) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236) at javax.servlet.http.HttpServlet.service(HttpServlet.java:810) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:703) at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463) at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398) at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:312) at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:415) at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:234) at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:300) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:95) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157) at org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsFilter.java:122) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:72) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102) at org.jboss.web.tomcat.security.JBossSecurityMgrRealm.invoke(JBossSecurityMgrRealm.java:275) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102) at
Re: valueChangeListener - inputText - Which method is correct?
If it applies, you can use the technique explained in http://wiki.apache.org/myfaces/SubmitPageOnValueChange using the inputText instead of the selectOneMenu. It should work. Or if you want to play with javascript you can take a look at http://www.irian.at/myfaces/jslistener.jsf to see how the jslistener works, Regards, Bruno 2005/10/25, Jeffrey Porter [EMAIL PROTECTED]: I've seen 3 different examples of using the valueChangeListener attribute. I've seen… Example 1: JSP h:inputText value=foo f:valueChangeListener type=com.jsf.MyValueChangeListener/ /h:inputText CODE public class MyValueChangeListener implements ValueChangeListener { public MyValueChangeListener() { } public void processValueChange(ValueChangeEvent vce) throws AbortProcessingException { System.out.println(A value has changed!); } } Example 2: JSP h:inputText id=partNumber value=#{nonConformingMaterial.partNumber} required=true valueChangeListener=#{nonConformingMaterial.changeEvent} onclick=submit() immediate=true / Example 3: JSP s:inputSuggestAjax suggestedItemsMethod=#{inputSuggestAjax.getItems} styleLocation= / I like example 3, very sexy. (see http://irian.at/myfaces-sandbox/inputSuggestAjax.jsf) But it's not what I need in my application. What I need is, when an inputText is filled in, an action is called so that another inputText field is automatically filled in. I presume that I should be trying to get example 1 working. Would you agree?
Re: error with sandbox ajax component on
FYI, the default implementation in JBoss4.0.3 is in %JBOSS_HOME%/server/%JBOSS_CONF%/deploy/jbossweb-tomcat55.sar/jsf-libs Regards, Bruno 2005/10/25, Martin Marinschek [EMAIL PROTECTED]: It really looks as if you would use an older version of the implementation. JBoss supplies a version with MyFaces already, so try to get rid of this and replace it with your new version. regards, Martin On 10/25/05, Marco Mistroni [EMAIL PROTECTED] wrote: Hello Martin, here's stack trace 2005-10-25 11:23:06,220 ERROR [org.jboss.web.localhost.Engine] ApplicationDispatcher[/sandbox] Servlet.service() for servlet jsp threw exception java.lang.NoSuchMethodError: org.apache.myfaces.component.html.util.AddResource.addJavaScriptToHeader(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;ZLjavax/faces/context/FacesContext;)V at org.apache.myfaces.custom.inputsuggestajax.InputSuggestAjaxRenderer.encodeJavascript(InputSuggestAjaxRenderer.java:73) at org.apache.myfaces.custom.inputsuggestajax.InputSuggestAjaxRenderer.encodeEnd(InputSuggestAjaxRenderer.java:98) at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:331) at org.apache.myfaces.renderkit.RendererUtils.renderChild(RendererUtils.java:450) at org.apache.myfaces.renderkit.html.HtmlGridRendererBase.renderChildren(HtmlGridRendererBase.java:203) at org.apache.myfaces.renderkit.html.HtmlGridRendererBase.encodeEnd(HtmlGridRendererBase.java:85) at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:331) at javax.faces.webapp.UIComponentTag.encodeEnd(UIComponentTag.java:349) at javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:253) at org.apache.myfaces.taglib.UIComponentBodyTagBase.doEndTag(UIComponentBodyTagBase.java:55) at org.apache.jsp.inputSuggestAjax_jsp._jspx_meth_h_panelGrid_0(inputSuggestAjax_jsp.java:245) at org.apache.jsp.inputSuggestAjax_jsp._jspx_meth_h_form_0(inputSuggestAjax_jsp.java:190) at org.apache.jsp.inputSuggestAjax_jsp._jspx_meth_f_view_0(inputSuggestAjax_jsp.java:157) at org.apache.jsp.inputSuggestAjax_jsp._jspService(inputSuggestAjax_jsp.java:106) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94) at javax.servlet.http.HttpServlet.service(HttpServlet.java:810) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236) at javax.servlet.http.HttpServlet.service(HttpServlet.java:810) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:703) at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463) at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398) at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:312) at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:415) at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:234) at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:300) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:95) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157) at org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsFilter.java:122) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:72) at
Problem with NavigationMenuItem
Hi, I am trying to construct a menu in my backing bean, and want to display it with jscookmenu. I can construct the menu, and jscookmenu can display it. Problem is, I couln't figure out how I can assign an action to the NavigationMenuItem. Here is how I construct the NavigationMenuItem: menu[0] = new NavigationMenuItem(Logout,#{UserBean.logout}, null, false); When I click on this menu item on the resulting page, the page reloads instead of running the logout method in my backing bean. I tried constructing the menu statically in the jsp page, but I get the same effect: t:navigationMenuItem id=menu1_1 itemLabel=Logout action=#{UserBean.logout} / Does the NavigationMenuItem support this kind of action mapping? If so, is the action syntax different than that of the CommandButton? (When I try with a CommandButton, the logout method is called: h:commandButton value=Logout action=#{UserBean.logout}/h:commandButton ) Thank you, Turgay Zengin
RE: valueChangeListener - inputText - Which method is correct?
Thanks Bruno. Great links. The spec for h:inputText states that it has the MethodBinding attribute valueChangeListener. So if I set this as... h:inputText id=name value=#{ncm.name} required=true valueChangeListener=#{ncm.changeEvent} / Should it not call my method in the ncm class? public void changeEvent(ValueChangeEvent event) { String partNo = ((String)event.getNewValue()); } Or am I missing something? Jeff. -Original Message- From: Bruno Aranda [mailto:[EMAIL PROTECTED] Sent: 25 October 2005 11:34 To: MyFaces Discussion Subject: Re: valueChangeListener - inputText - Which method is correct? If it applies, you can use the technique explained in http://wiki.apache.org/myfaces/SubmitPageOnValueChange using the inputText instead of the selectOneMenu. It should work. Or if you want to play with javascript you can take a look at http://www.irian.at/myfaces/jslistener.jsf to see how the jslistener works, Regards, Bruno 2005/10/25, Jeffrey Porter [EMAIL PROTECTED]: I've seen 3 different examples of using the valueChangeListener attribute. I've seen... Example 1: JSP h:inputText value=foo f:valueChangeListener type=com.jsf.MyValueChangeListener/ /h:inputText CODE public class MyValueChangeListener implements ValueChangeListener { public MyValueChangeListener() { } public void processValueChange(ValueChangeEvent vce) throws AbortProcessingException { System.out.println(A value has changed!); } } Example 2: JSP h:inputText id=partNumber value=#{nonConformingMaterial.partNumber} required=true valueChangeListener=#{nonConformingMaterial.changeEvent} onclick=submit() immediate=true / Example 3: JSP s:inputSuggestAjax suggestedItemsMethod=#{inputSuggestAjax.getItems} styleLocation= / I like example 3, very sexy. (see http://irian.at/myfaces-sandbox/inputSuggestAjax.jsf) But it's not what I need in my application. What I need is, when an inputText is filled in, an action is called so that another inputText field is automatically filled in. I presume that I should be trying to get example 1 working. Would you agree?
Re: Dynamic tabs
Any ideas about this spreadsheet-like stuff using MyFaces?2005/10/25, Enrique Medina [EMAIL PROTECTED]: Hi, In my application I need to present the user with something similar to an Excel document, i.e., several tabs (Excel sheets) and the possibility to edit tabular data (using a datatable) for every tab. Has anyone tried something like this? I would really appreciate to hear about your approaches.
Re: valueChangeListener - inputText - Which method is correct?
Yes, but the ValueChangeEvent will be processed in the Process Validations phase, after submitting the form. So if you want to change the value of the other inputText when the first changes, you need to submit the form (technique #1). Otherwise, you can use javascript if it is an option to you (if you don't have to process the form). Hope it is clear now, Bruno 2005/10/25, Jeffrey Porter [EMAIL PROTECTED]: Thanks Bruno. Great links. The spec for h:inputText states that it has the MethodBinding attribute valueChangeListener. So if I set this as... h:inputText id=name value=#{ncm.name} required=true valueChangeListener=#{ncm.changeEvent} / Should it not call my method in the ncm class? public void changeEvent(ValueChangeEvent event) { String partNo = ((String)event.getNewValue()); } Or am I missing something? Jeff. -Original Message- From: Bruno Aranda [mailto:[EMAIL PROTECTED] Sent: 25 October 2005 11:34 To: MyFaces Discussion Subject: Re: valueChangeListener - inputText - Which method is correct? If it applies, you can use the technique explained in http://wiki.apache.org/myfaces/SubmitPageOnValueChange using the inputText instead of the selectOneMenu. It should work. Or if you want to play with javascript you can take a look at http://www.irian.at/myfaces/jslistener.jsf to see how the jslistener works, Regards, Bruno 2005/10/25, Jeffrey Porter [EMAIL PROTECTED]: I've seen 3 different examples of using the valueChangeListener attribute. I've seen... Example 1: JSP h:inputText value=foo f:valueChangeListener type=com.jsf.MyValueChangeListener/ /h:inputText CODE public class MyValueChangeListener implements ValueChangeListener { public MyValueChangeListener() { } public void processValueChange(ValueChangeEvent vce) throws AbortProcessingException { System.out.println(A value has changed!); } } Example 2: JSP h:inputText id=partNumber value=#{nonConformingMaterial.partNumber} required=true valueChangeListener=#{nonConformingMaterial.changeEvent} onclick=submit() immediate=true / Example 3: JSP s:inputSuggestAjax suggestedItemsMethod=#{inputSuggestAjax.getItems} styleLocation= / I like example 3, very sexy. (see http://irian.at/myfaces-sandbox/inputSuggestAjax.jsf) But it's not what I need in my application. What I need is, when an inputText is filled in, an action is called so that another inputText field is automatically filled in. I presume that I should be trying to get example 1 working. Would you agree?
Re: Design question: how best to pass query from search-form to result-page
you also could use t:saveState on your backing bean instead of putting it into the session ;-) Rick Gruber-Riemer wrote: Hi I would like to know what the best practice is to pass a query from a search-form to a results page. With this a mean page A with some form elements to search for records in a database and page B showning a table of results with all matches. I can come up with the following 5 alternatives: * [A]: A.jsp and B.jsp refer to the same Backing Bean, which has session scope. So when B.jsp is called and the table rendered, the Backing Bean has directly access to the search form fields and can use these to submit a query in a DAO. * [B]: A.jsp and B.jsp have Backing Beans A.java and B.java in request scope. A.java puts the form elements within its action method into a Map, which is stored in either the request or the session. B.java reads the Map from either session or request and uses them to submit a query in a DAO. * [C]: pages and beans like [B]. But A.java's action method actually makes query in DAO and then puts the result in session or request. * [D]: This time in A.java's action method FacesContext is used to get an instance of B.java and set the form parameters with getters/setters, such that in the render phase of b.jsp a query can be made against a DAO. * [E]: In A.java's action method submit the form parameters to a DAO method, which returns a query string. This is then set into a session parameter. In B.java get the query string from the session parameter and use it then to submit a query in the DAO. The beauty of this would be that the concrete DAO implementation would generate the relevant query, such that it would be transparent for the Backing Bean and a Business Delegat whether we use a Hibernate implementation or plain SQL or JDO ... And the query string does not use a lot of memory in the session :-). Plus a select count(*) in the DAO already when getting the query string in A.java could reveal, whether the user has to be more precice as the query would return to many records (configurable). Pros/cons: * [A]: Positive: easy to implement. Negative: session scope and results potentially hanging around in session (e.g. for simple pager). * [B]: Positive: request scope. Negative: as with [A] the Map gets some logic with field names that need to be maintained. * [C]: Positive: easy to implement. Negative: As with [A] there can be problems if using request parameters in portlets (as far as I know). Results can be big and somehow should be nullified in session as soon as pointer is set in B.java. * [D]: Negative: not really an improvement over [A]; I do not like to play with BackingBeans in FacesContext (- session vs. request scope?) * [E]: Positive: I just like it ;-) Any comments?
RE: valueChangeListener - inputText - Which method is correct?
Title: RE: valueChangeListener - inputText - Which method is correct? The spec says ... MethodBinding representing a value change listener method that will be notified when a new value has been set for this input component. I was left with the impression from this that when the field's value changes then the method would get called. Not when the form is submitted. I dont need to process the form. I'm in the situation where a person types in a part number, and the several other fields are auto populated from that value (i.e. the part description manufacture). The form is not submitted thought till they have entered a load of other details. I guess I can look at getting some _javascript_ to do this. But its a shame there isnt a method for this in MyFaces. I see that I can write something like this h:selectBooleanCheckbox valueChangeListener=#{resumeBean.changeColorMode} > immediate=true/ But this results in the form being submitted error messages being displayed because of fields not filled. This would confuse the user, since They've not pressed the submit button yet. Jeff. -Original Message- From: Bruno Aranda [mailto:[EMAIL PROTECTED]] Sent: 25 October 2005 11:57 To: MyFaces Discussion Subject: Re: valueChangeListener - inputText - Which method is correct? Yes, but the ValueChangeEvent will be processed in the Process Validations phase, after submitting the form. So if you want to change the value of the other inputText when the first changes, you need to submit the form (technique #1). Otherwise, you can use _javascript_ if it is an option to you (if you don't have to process the form). Hope it is clear now, Bruno 2005/10/25, Jeffrey Porter [EMAIL PROTECTED]: Thanks Bruno. Great links. The spec for h:inputText states that it has the MethodBinding attribute valueChangeListener. So if I set this as... h:inputText id=name value=#{ncm.name} required=true valueChangeListener=#{ncm.changeEvent} / Should it not call my method in the ncm class? public void changeEvent(ValueChangeEvent event) { String partNo = ((String)event.getNewValue()); } Or am I missing something? Jeff. -Original Message- From: Bruno Aranda [mailto:[EMAIL PROTECTED]] Sent: 25 October 2005 11:34 To: MyFaces Discussion Subject: Re: valueChangeListener - inputText - Which method is correct? If it applies, you can use the technique explained in http://wiki.apache.org/myfaces/SubmitPageOnValueChange using the inputText instead of the selectOneMenu. It should work. Or if you want to play with _javascript_ you can take a look at http://www.irian.at/myfaces/jslistener.jsf to see how the jslistener works, Regards, Bruno 2005/10/25, Jeffrey Porter [EMAIL PROTECTED]: I've seen 3 different examples of using the valueChangeListener attribute. I've seen... Example 1: JSP h:inputText value=foo f:valueChangeListener type=com.jsf.MyValueChangeListener/ /h:inputText CODE public class MyValueChangeListener implements ValueChangeListener { public MyValueChangeListener() { } public void processValueChange(ValueChangeEvent vce) throws AbortProcessingException { System.out.println(A value has changed!); } } Example 2: JSP h:inputText id=partNumber value=#{nonConformingMaterial.partNumber} required=true valueChangeListener=#{nonConformingMaterial.changeEvent} > immediate=true / Example 3: JSP s:inputSuggestAjax suggestedItemsMethod=#{inputSuggestAjax.getItems} styleLocation= / I like example 3, very sexy. (see http://irian.at/myfaces-sandbox/inputSuggestAjax.jsf) But it's not what I need in my application. What I need is, when an inputText is filled in, an action is called so that another inputText field is automatically filled in. I presume that I should be trying to get example 1 working. Would you agree?
RE: Finding a component with a specific id
Have you tried putting the colSelector after the datatable? It sounds like the view does not yet contain the table. I thought myFaces had similar issues with the DataScroller in ealier versions (maybe still do). Maybe take a look on how they handled? Of course, just a guess. Good luck -Original Message- From: Simon Kitching [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 25, 2005 12:07 AM To: MyFaces Discussion Subject: Finding a component with a specific id Hi, From a custom renderer I need to be able to find a component with a specific id. Page: o:colSelector tableId=table1 .../ t:dataTable id=table1 ... .. /t:dataTable From the renderer for the o:colSelector I've tried: UIComponent table = facesContext.getViewRoot().findComponent(tableId); UIComponent table = component.findComponent(tableId); UIComponent table = component.findComponent(: + tableId); but had no luck. The table is enclosed in a subview named body, so the id actually gets output as body:table1. I've tried all the above with that string too, and no luck. Any ideas how I should locate that table component by id?? [And BTW, is it possible for a component in a naming container to have an id that is *not* prefixed by its NamingContainer parent's id?] On a related note, looking at the source for UIComponent.findComponent, I see it calls _ComponentUtils.findComponent which is as follows. static UIComponent findComponent(UIComponent findBase, String id) { if (idsAreEqual(id,findBase)) { return findBase; } for (Iterator it = findBase.getFacetsAndChildren(); it.hasNext(); ) { UIComponent childOrFacet = (UIComponent)it.next(); if (!(childOrFacet instanceof NamingContainer)) { UIComponent find = findComponent(childOrFacet, id); if (find != null) return find; } else if (idsAreEqual(id,childOrFacet)) { return childOrFacet; } } return null; } What's the point of that instanceof NamingContainer? Why doesn't the search recurse into NamingContainer children of findBase? Thanks, Simon
Re: [PROPOSAL] PRETTY_HTML, was [RE: JFS's html output]
I have not checked out the code yet, but I guess the easiest solution to deal with it would be a servlet filter. Maybe a phase listener also would be possible. But why implement it at all, to my experience the Mozilla plugin gives excellent results. Werner Strittmatter, Stephan wrote: Hi, some weeks ago I tried this option also without having pretty code. Just for discussion: Why implement the pretty-html option in every renderer? I think, it would be easier to postprocess the content in the framework before returning the complete html-content to the browser. What do you think? I found e.g. http://sourceforge.net/projects/jtidy which could do this probably. Does anybody know an other Java library which could do this job? The big efford would be, that you could use the RI of SUN also and the content would also be pretty formatted then. Regards, Stephan -Original Message- From: Bruno Aranda [mailto:[EMAIL PROTECTED] Sent: Monday, October 24, 2005 4:25 PM To: MyFaces Discussion Subject: Re: JFS's html output Yes, that's the option I was talking about, but AFAIK the functionality is not implemented for most of the component renderers, leaving it almost useless... Every render should check the value of this property and render carriage returns to output a readable html, Regards, Bruno 2005/10/24, CONNER, BRENDAN (SBCSI) [EMAIL PROTECTED]: I know that there's an option you can put into your web.xml file that's supposed to take care of that, although I haven't experimented with it: context-param param-nameorg.apache.myfaces.PRETTY_HTML/param-name param-valuetrue/param-value description If true, rendered HTML code will be formatted, so that it is human readable. i.e. additional line separators and whitespace will be written, that do not influence the HTML code. Default: true /description /context-param - Brendan -Original Message- From: Nicola Benaglia [mailto:[EMAIL PROTECTED] Sent: Monday, October 24, 2005 5:12 AM To: users@myfaces.apache.org Subject: JFS's html output Hi ! I was wondering why my JFS's output is not friendly human readable. I looked into my generated HTML page and the code is not at all indented. Is that a normal JSF behaviour or is there a way to get a little bit more readable code ? Thank you, Nico --- Questa mail ed eventuali suoi allegati sono strettamente confidenziali. Se ricevete per errore questa mail, Vi preghiamo cortesemente di cancellarla immediatamente e di segnalare l'errore a chi ve l'ha spedita. Se Voi non siete il reale destinatario di questa mail non siete autorizzati alla copia, alla distribuzione e alla stampa di essa ne tantomeno ad una eventuale modifica dei contenuti. This message and any attachments are confidential and intended solely for the addressees. If you receive this message in error, please delete it and immediately notify the sender. If the reader of this message is not the intended recipient, you are hereby notified that any unauthorized use, copying, publication, printing or dissemination is prohibited. E-mails are susceptible to alteration.
Re: [PROPOSAL] PRETTY_HTML, was [RE: JFS's html output]
Well, you might want to do it in IE? something like JTidy in our ExtensionFilter might be a good option. regards, Martin On 10/25/05, Werner Punz [EMAIL PROTECTED] wrote: I have not checked out the code yet, but I guess the easiest solution to deal with it would be a servlet filter. Maybe a phase listener also would be possible. But why implement it at all, to my experience the Mozilla plugin gives excellent results. Werner Strittmatter, Stephan wrote: Hi, some weeks ago I tried this option also without having pretty code. Just for discussion: Why implement the pretty-html option in every renderer? I think, it would be easier to postprocess the content in the framework before returning the complete html-content to the browser. What do you think? I found e.g. http://sourceforge.net/projects/jtidy which could do this probably. Does anybody know an other Java library which could do this job? The big efford would be, that you could use the RI of SUN also and the content would also be pretty formatted then. Regards, Stephan -Original Message- From: Bruno Aranda [mailto:[EMAIL PROTECTED] Sent: Monday, October 24, 2005 4:25 PM To: MyFaces Discussion Subject: Re: JFS's html output Yes, that's the option I was talking about, but AFAIK the functionality is not implemented for most of the component renderers, leaving it almost useless... Every render should check the value of this property and render carriage returns to output a readable html, Regards, Bruno 2005/10/24, CONNER, BRENDAN (SBCSI) [EMAIL PROTECTED]: I know that there's an option you can put into your web.xml file that's supposed to take care of that, although I haven't experimented with it: context-param param-nameorg.apache.myfaces.PRETTY_HTML/param-name param-valuetrue/param-value description If true, rendered HTML code will be formatted, so that it is human readable. i.e. additional line separators and whitespace will be written, that do not influence the HTML code. Default: true /description /context-param - Brendan -Original Message- From: Nicola Benaglia [mailto:[EMAIL PROTECTED] Sent: Monday, October 24, 2005 5:12 AM To: users@myfaces.apache.org Subject: JFS's html output Hi ! I was wondering why my JFS's output is not friendly human readable. I looked into my generated HTML page and the code is not at all indented. Is that a normal JSF behaviour or is there a way to get a little bit more readable code ? Thank you, Nico --- Questa mail ed eventuali suoi allegati sono strettamente confidenziali. Se ricevete per errore questa mail, Vi preghiamo cortesemente di cancellarla immediatamente e di segnalare l'errore a chi ve l'ha spedita. Se Voi non siete il reale destinatario di questa mail non siete autorizzati alla copia, alla distribuzione e alla stampa di essa ne tantomeno ad una eventuale modifica dei contenuti. This message and any attachments are confidential and intended solely for the addressees. If you receive this message in error, please delete it and immediately notify the sender. If the reader of this message is not the intended recipient, you are hereby notified that any unauthorized use, copying, publication, printing or dissemination is prohibited. E-mails are susceptible to alteration. -- http://www.irian.at Your JSF powerhouse - JSF Trainings in English and German
Re: Setting a collection????
Sorry folks. I was putting the inputFields inside a f:verbatim. Now it's running fine :) Best Regards Rafael Mauricio Nami 2005/10/25, Martin Marinschek [EMAIL PROTECTED]: Can you elaborate a bit more - with snippets from your source?regards,MartinOn 10/24/05, Rafael Nami [EMAIL PROTECTED] wrote: Hi everyone We are trying to do something like this: In a page, we have to populate a collection with informations, so we gave to the user a inputText that he can write how much informations he wanna add, and after he submits it, the page is reconstructed adding n lines in this dataTable with forms, to the user complete the informations. The problem is that the faces isn't accepting the collection when i try to execute the action - it's passing the components with null value to the backing bean. What did I have to do? Does JSF didn't have this kind of stuff? What am I going wrong? Thanks in advance and Best Regards Rafael Mauricio Nami--http://www.irian.atYour JSF powerhouse -JSF Trainings in English and German
Re: error with sandbox ajax component on
hELLO Bruno, thanx but i m still on jboss 3.2.5. regards marco On 10/25/05, Bruno Aranda [EMAIL PROTECTED] wrote: FYI, the default implementation in JBoss4.0.3 is in%JBOSS_HOME%/server/%JBOSS_CONF%/deploy/jbossweb-tomcat55.sar /jsf-libsRegards,Bruno2005/10/25, Martin Marinschek [EMAIL PROTECTED]: It really looks as if you would use an older version of the implementation. JBoss supplies a version with MyFaces already, so try to get rid of this and replace it with your new version. regards, Martin On 10/25/05, Marco Mistroni [EMAIL PROTECTED] wrote: Hello Martin, here's stack trace 2005-10-25 11:23:06,220 ERROR [org.jboss.web.localhost.Engine ] ApplicationDispatcher[/sandbox] Servlet.service() for servlet jsp threw exception java.lang.NoSuchMethodError: org.apache.myfaces.component.html.util.AddResource.addJavaScriptToHeader (Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;ZLjavax/faces/context/FacesContext;)V at org.apache.myfaces.custom.inputsuggestajax.InputSuggestAjaxRenderer.encodeJavascript(InputSuggestAjaxRenderer.java :73) at org.apache.myfaces.custom.inputsuggestajax.InputSuggestAjaxRenderer.encodeEnd(InputSuggestAjaxRenderer.java:98) at javax.faces.component.UIComponentBase.encodeEnd (UIComponentBase.java:331) at org.apache.myfaces.renderkit.RendererUtils.renderChild(RendererUtils.java:450) at org.apache.myfaces.renderkit.html.HtmlGridRendererBase.renderChildren (HtmlGridRendererBase.java:203) at org.apache.myfaces.renderkit.html.HtmlGridRendererBase.encodeEnd(HtmlGridRendererBase.java:85) at javax.faces.component.UIComponentBase.encodeEnd (UIComponentBase.java:331) at javax.faces.webapp.UIComponentTag.encodeEnd(UIComponentTag.java:349) at javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java :253) at org.apache.myfaces.taglib.UIComponentBodyTagBase.doEndTag(UIComponentBodyTagBase.java:55) at org.apache.jsp.inputSuggestAjax_jsp._jspx_meth_h_panelGrid_0 (inputSuggestAjax_jsp.java:245) at org.apache.jsp.inputSuggestAjax_jsp._jspx_meth_h_form_0(inputSuggestAjax_jsp.java:190) at org.apache.jsp.inputSuggestAjax_jsp._jspx_meth_f_view_0 (inputSuggestAjax_jsp.java:157) at org.apache.jsp.inputSuggestAjax_jsp._jspService(inputSuggestAjax_jsp.java:106) at org.apache.jasper.runtime.HttpJspBase.service (HttpJspBase.java:94) at javax.servlet.http.HttpServlet.service(HttpServlet.java:810) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java :324) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236) at javax.servlet.http.HttpServlet.service(HttpServlet.java:810) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:703) at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463) at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java :398) at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:312) at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch (ServletExternalContextImpl.java:415) at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:234) at org.apache.myfaces.lifecycle.LifecycleImpl.render (LifecycleImpl.java:300) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:95) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java :237) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157) at org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter (ExtensionsFilter.java:122) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186) at org.apache.catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain.java:157) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214) at org.apache.catalina.core.StandardValveContext.invokeNext (StandardValveContext.java:104) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.StandardContextValve.invokeInternal (StandardContextValve.java:198) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152) at org.apache.catalina.core.StandardValveContext.invokeNext (StandardValveContext.java:104) at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:72) at org.apache.catalina.core.StandardValveContext.invokeNext (StandardValveContext.java:102) at org.jboss.web.tomcat.security.JBossSecurityMgrRealm.invoke(JBossSecurityMgrRealm.java:275) at org.apache.catalina.core.StandardValveContext.invokeNext
Re: error with sandbox ajax component on
Hello, i solved my problem... just to let anyone know if they run in same situation Martin was right (partially :) )... on my deploy directory i have deployed 3 .war files all related to myFaces (blank.war, simple.war and sandbox.war) sandbox.war was using the latest myfaces jars, while blank and simple were using old jars (i guess from some time ago.) for some reason, it looks like jboss was trying use for sandbox.war the same myfaces jar files used by previous applications. In fact, when i undeploy blank.war and simple.war, everything went fine thanx again and regards marco On 10/25/05, Marco Mistroni [EMAIL PROTECTED] wrote: Hello, right for some reasons, it works with jboss 4.0.2.. so problem is entirely mine.. i m going to do further testing thanx anyway and regards marco On 10/25/05, Marco Mistroni [EMAIL PROTECTED] wrote: hELLO Bruno, thanx but i m still on jboss 3.2.5. regards marco On 10/25/05, Bruno Aranda [EMAIL PROTECTED] wrote: FYI, the default implementation in JBoss4.0.3 is in%JBOSS_HOME%/server/%JBOSS_CONF%/deploy/jbossweb-tomcat55.sar /jsf-libsRegards,Bruno2005/10/25, Martin Marinschek [EMAIL PROTECTED] : It really looks as if you would use an older version of the implementation. JBoss supplies a version with MyFaces already, so try to get rid of this and replace it with your new version. regards, Martin On 10/25/05, Marco Mistroni [EMAIL PROTECTED] wrote: Hello Martin, here's stack trace 2005-10-25 11:23:06,220 ERROR [org.jboss.web.localhost.Engine ] ApplicationDispatcher[/sandbox] Servlet.service () for servlet jsp threw exception java.lang.NoSuchMethodError: org.apache.myfaces.component.html.util.AddResource.addJavaScriptToHeader (Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;ZLjavax/faces/context/FacesContext;)V at org.apache.myfaces.custom.inputsuggestajax.InputSuggestAjaxRenderer.encodeJavascript(InputSuggestAjaxRenderer.java :73) at org.apache.myfaces.custom.inputsuggestajax.InputSuggestAjaxRenderer.encodeEnd (InputSuggestAjaxRenderer.java:98) at javax.faces.component.UIComponentBase.encodeEnd (UIComponentBase.java:331) at org.apache.myfaces.renderkit.RendererUtils.renderChild (RendererUtils.java:450) at org.apache.myfaces.renderkit.html.HtmlGridRendererBase.renderChildren (HtmlGridRendererBase.java:203) at org.apache.myfaces.renderkit.html.HtmlGridRendererBase.encodeEnd (HtmlGridRendererBase.java:85) at javax.faces.component.UIComponentBase.encodeEnd (UIComponentBase.java:331) at javax.faces.webapp.UIComponentTag.encodeEnd(UIComponentTag.java :349) at javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java :253) at org.apache.myfaces.taglib.UIComponentBodyTagBase.doEndTag(UIComponentBodyTagBase.java :55) at org.apache.jsp.inputSuggestAjax_jsp._jspx_meth_h_panelGrid_0 (inputSuggestAjax_jsp.java:245) at org.apache.jsp.inputSuggestAjax_jsp._jspx_meth_h_form_0 (inputSuggestAjax_jsp.java:190) at org.apache.jsp.inputSuggestAjax_jsp._jspx_meth_f_view_0 (inputSuggestAjax_jsp.java:157) at org.apache.jsp.inputSuggestAjax_jsp._jspService (inputSuggestAjax_jsp.java:106) at org.apache.jasper.runtime.HttpJspBase.service (HttpJspBase.java:94) at javax.servlet.http.HttpServlet.service(HttpServlet.java :810) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java :324) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java :292) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236) at javax.servlet.http.HttpServlet.service(HttpServlet.java:810) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java :157) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:703) at org.apache.catalina.core.ApplicationDispatcher.processRequest (ApplicationDispatcher.java:463) at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java :398) at org.apache.catalina.core.ApplicationDispatcher.forward (ApplicationDispatcher.java:312) at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch (ServletExternalContextImpl.java:415) at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView (JspViewHandlerImpl.java:234) at org.apache.myfaces.lifecycle.LifecycleImpl.render (LifecycleImpl.java:300) at javax.faces.webapp.FacesServlet.service(FacesServlet.java :95) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java :237) at org.apache.catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain.java:157) at org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter (ExtensionsFilter.java:122) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain.java:186) at org.apache.catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain.java:157) at
Re: command button for link
The parameter action=somewhere is referring to an from-outcome defined in your faces-config.xml, therefore you can't directly address your regpart.jsf. A navigation rule like navigation-rule from-view-id*/from-view-id navigation-case from-outcomeregpart/from-outcome to-view-id/regpart.jsf/to-view-id redirect / /navigation-case /navigation-rule with an commandButton like h:commandButton action=regpart value=your text/ should work. [EMAIL PROTECTED] wrote: What is the correct usage of command button for a link? h:commandButton action=/regpart.jsf value=#{agency.lwbackword} / does not work.
Re: [PROPOSAL] PRETTY_HTML, was [RE: JFS's html output]
+1 for that. I was never a big fan of the PRETTY_HTML and I never found it to work very well anyways. sean On 10/25/05, Strittmatter, Stephan [EMAIL PROTECTED] wrote: On the other hand, when there is already such an ExtensionFilter in jtidy (I also haven't known that), why spend efford to make pretty output in myFaces? Why not removing the context parameter org.apache.myfaces.PRETTY_HTML and create instead a short section in the wiki about jtidy as ExtentionFilter? Just focusing on the main goal of MyFaces... Regards, Stephan -Original Message- From: Jesse Alexander (KBSA 21) [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 25, 2005 2:05 PM To: MyFaces Discussion Subject: RE: [PROPOSAL] PRETTY_HTML, was [RE: JFS's html output] -Original Message- I prefer to add a additional filter instead of doing this in the ExtensionFilter. jtidy has already a filter for this: http://jtidy.sourceforge.net/multiproject/jtidyservlet/filter.html -/Original Message- That's what I had hopes for (just no time to check ;-) thanks for checking it out regards Alexander
RE: x:commandLink and onClick
That was my first try. The confirmation box pops up properly, but the form does not submit after clicking the 'OK' button. Has anyone else had this trouble? Judging from the archives, it appears that people have had mixed results with different methods. -Original Message- From: Marius Kreis [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 25, 2005 7:32 AM To: MyFaces Discussion Subject: Re: x:commandLink and onClick This sounds like an error in your javascript. Perhaps you should try onClick=return confirm('Are you sure...?'); James Reynolds wrote: I'm trying to add some confirmation to the onClick event for my commandLink. The mail archives have good suggestions including: 1. Call a function defined on the page like this: onclick=return validate() 2. Construct the javascript as such: onclick=if (!confirm('Are you sure you want to delete this record?')) return In each case, I'm receiving Object Expected errors in Internet Explorer. What is the best way of handling this task? Thanks
Re: How to use t:saveState ?
Martin, It does work. Changing the STATE_SAVING_METHOD to client as you suggested solved the problem (at last ! :) The only problem is that the poor user will receive the state data for the whole application... It's a high price to pay for saveState. Does it always require to store the data in the client ? BTW, thanks to you and David for the help. Regards, - Juan On 10/25/05, Martin Marinschek [EMAIL PROTECTED] wrote: Are you using client-side state saving? Try to switch to it just for trying out if this works. regards, Martin On 10/24/05, Juan Medín Piñeiro [EMAIL PROTECTED] wrote: Sorry, It was a typo writing the code in the mail. It should be: f:view BODY t:saveState value=#{aRequestScopedObject}/ h:form styleClass=form id=form1 Yes, ARequestScopedObject implements Serializable. The html form code generated by the code above is: form id=form1 method=post action=/testbox/faces/app/savestate/test1.jsp enctype=application/x-www-form-urlencoded input id=form1:text1 type=text name=form1:text1 value=/ input id=form1:text2 type=text name=form1:text2 value=/ input type=submit value=Submit name=form1:button1 id=form1:button1/ input type=hidden name=form1 value=form1 / /form Where text1 and text2 are text fields I included to test it. There is no html code for the saveState() tag. Regards, - Juan On 10/24/05, David G. Friedman [EMAIL PROTECTED] wrote: Juan, What is testState and shouldn't that be #{testState} ? Did you make it serializable so it can be saved? Regards, David -Original Message- From: Juan Medín Piñeiro [mailto:[EMAIL PROTECTED] Sent: Monday, October 24, 2005 10:42 AM To: MyFaces Discussion Subject: Re: How to use t:saveState ? It's inside the view and outside the form. From the test code: f:view BODY t:saveState value=testState/ h:form styleClass=form id=form1 more markup code Regards, - Juan On 10/24/05, David G. Friedman [EMAIL PROTECTED] wrote: Juan, Is it inside the f:view or outside the view? Regards, David -Original Message- From: Juan Medín Piñeiro [mailto:[EMAIL PROTECTED] Sent: Monday, October 24, 2005 10:28 AM To: users@myfaces.apache.org Subject: How to use t:saveState ? Hi, I've been trying to use t:saveState without success. As far as I can read in the wiki and in the examples, you just need to include a t:saveState value=xxx/ in the JSP and the information will travel to the client and back in the next request. So I created 3 pages, test1, test2 and test3, each with a t:saveState value=aRequestScopedObject/. In the backing bean I do something like: aRequestScopedObject = (ARequestScopedObject) getFacesContext() .getApplication() .createValueBinding(#{aRequestScopedObject}) .getValue(getFacesContext()); And then I set several properties on it. Well, when I reach the test2 page _all changes_ are lost. Reading the generated HTML I don't see anything at all related to the saveState info in the form (!?) Am I missing anything ? Any comment would be really welcome. It seems to be very simple to use, the only strange thing is that I'm using the Sun RI + Tomahawk. Thanks in advance, - Juancho -- http://www.irian.at Your JSF powerhouse - JSF Trainings in English and German
Re: How to use t:saveState ?
Strange. this should work. Can you open a jira-issue on this? regards, Martin On 10/25/05, Juan Medín Piñeiro [EMAIL PROTECTED] wrote: Martin, It does work. Changing the STATE_SAVING_METHOD to client as you suggested solved the problem (at last ! :) The only problem is that the poor user will receive the state data for the whole application... It's a high price to pay for saveState. Does it always require to store the data in the client ? BTW, thanks to you and David for the help. Regards, - Juan On 10/25/05, Martin Marinschek [EMAIL PROTECTED] wrote: Are you using client-side state saving? Try to switch to it just for trying out if this works. regards, Martin On 10/24/05, Juan Medín Piñeiro [EMAIL PROTECTED] wrote: Sorry, It was a typo writing the code in the mail. It should be: f:view BODY t:saveState value=#{aRequestScopedObject}/ h:form styleClass=form id=form1 Yes, ARequestScopedObject implements Serializable. The html form code generated by the code above is: form id=form1 method=post action=/testbox/faces/app/savestate/test1.jsp enctype=application/x-www-form-urlencoded input id=form1:text1 type=text name=form1:text1 value=/ input id=form1:text2 type=text name=form1:text2 value=/ input type=submit value=Submit name=form1:button1 id=form1:button1/ input type=hidden name=form1 value=form1 / /form Where text1 and text2 are text fields I included to test it. There is no html code for the saveState() tag. Regards, - Juan On 10/24/05, David G. Friedman [EMAIL PROTECTED] wrote: Juan, What is testState and shouldn't that be #{testState} ? Did you make it serializable so it can be saved? Regards, David -Original Message- From: Juan Medín Piñeiro [mailto:[EMAIL PROTECTED] Sent: Monday, October 24, 2005 10:42 AM To: MyFaces Discussion Subject: Re: How to use t:saveState ? It's inside the view and outside the form. From the test code: f:view BODY t:saveState value=testState/ h:form styleClass=form id=form1 more markup code Regards, - Juan On 10/24/05, David G. Friedman [EMAIL PROTECTED] wrote: Juan, Is it inside the f:view or outside the view? Regards, David -Original Message- From: Juan Medín Piñeiro [mailto:[EMAIL PROTECTED] Sent: Monday, October 24, 2005 10:28 AM To: users@myfaces.apache.org Subject: How to use t:saveState ? Hi, I've been trying to use t:saveState without success. As far as I can read in the wiki and in the examples, you just need to include a t:saveState value=xxx/ in the JSP and the information will travel to the client and back in the next request. So I created 3 pages, test1, test2 and test3, each with a t:saveState value=aRequestScopedObject/. In the backing bean I do something like: aRequestScopedObject = (ARequestScopedObject) getFacesContext() .getApplication() .createValueBinding(#{aRequestScopedObject}) .getValue(getFacesContext()); And then I set several properties on it. Well, when I reach the test2 page _all changes_ are lost. Reading the generated HTML I don't see anything at all related to the saveState info in the form (!?) Am I missing anything ? Any comment would be really welcome. It seems to be very simple to use, the only strange thing is that I'm using the Sun RI + Tomahawk. Thanks in advance, - Juancho -- 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
Re: [PROPOSAL] PRETTY_HTML, was [RE: JFS's html output]
+1 as well Strittmatter, Stephan wrote: On the other hand, when there is already such an ExtensionFilter in jtidy (I also haven't known that), why spend efford to make pretty output in myFaces? Why not removing the context parameter org.apache.myfaces.PRETTY_HTML and create instead a short section in the wiki about jtidy as ExtentionFilter? Just focusing on the main goal of MyFaces... Regards, Stephan
Re: x:commandLink and onClick
sorry, my mistake. i think h:form onSubmit=return confirm('text'); .. should work James Reynolds wrote: That was my first try. The confirmation box pops up properly, but the form does not submit after clicking the 'OK' button. Has anyone else had this trouble? Judging from the archives, it appears that people have had mixed results with different methods. -Original Message- From: Marius Kreis [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 25, 2005 7:32 AM To: MyFaces Discussion Subject: Re: x:commandLink and onClick This sounds like an error in your javascript. Perhaps you should try onClick=return confirm('Are you sure...?'); James Reynolds wrote: I'm trying to add some confirmation to the onClick event for my commandLink. The mail archives have good suggestions including: 1. Call a function defined on the page like this: onclick=return validate() 2. Construct the javascript as such: onclick=if (!confirm('Are you sure you want to delete this record?')) return In each case, I'm receiving Object Expected errors in Internet Explorer. What is the best way of handling this task? Thanks
RE: x:commandLink and onClick
Oh! That's a good idea. However, that presents another problem for my page. By way of some background, I'm using a dataTable to build a list of upcoming conferences. The final column contains two links inside, Edit and Delete. The Edit navigates to a detail page, while the delete would obviously remove the record and reload the page. I also have an Add Conference button outside of the table. Using the onSubmit attribute would prompt for confirmation no matter what control is activated. Perhaps I should just use commandButtons instead of commandLinks and avoid the issue altogether. -Original Message- From: Marius Kreis [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 25, 2005 8:26 AM To: MyFaces Discussion Subject: Re: x:commandLink and onClick sorry, my mistake. i think h:form onSubmit=return confirm('text'); .. should work James Reynolds wrote: That was my first try. The confirmation box pops up properly, but the form does not submit after clicking the 'OK' button. Has anyone else had this trouble? Judging from the archives, it appears that people have had mixed results with different methods. -Original Message- From: Marius Kreis [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 25, 2005 7:32 AM To: MyFaces Discussion Subject: Re: x:commandLink and onClick This sounds like an error in your javascript. Perhaps you should try onClick=return confirm('Are you sure...?'); James Reynolds wrote: I'm trying to add some confirmation to the onClick event for my commandLink. The mail archives have good suggestions including: 1. Call a function defined on the page like this: onclick=return validate() 2. Construct the javascript as such: onclick=if (!confirm('Are you sure you want to delete this record?')) return In each case, I'm receiving Object Expected errors in Internet Explorer. What is the best way of handling this task? Thanks
Re: How to use t:saveState ?
done. Regards, - Juan On 10/25/05, Martin Marinschek [EMAIL PROTECTED] wrote: Strange. this should work. Can you open a jira-issue on this? regards, Martin On 10/25/05, Juan Medín Piñeiro [EMAIL PROTECTED] wrote: Martin, It does work. Changing the STATE_SAVING_METHOD to client as you suggested solved the problem (at last ! :) The only problem is that the poor user will receive the state data for the whole application... It's a high price to pay for saveState. Does it always require to store the data in the client ? BTW, thanks to you and David for the help. Regards, - Juan On 10/25/05, Martin Marinschek [EMAIL PROTECTED] wrote: Are you using client-side state saving? Try to switch to it just for trying out if this works. regards, Martin On 10/24/05, Juan Medín Piñeiro [EMAIL PROTECTED] wrote: Sorry, It was a typo writing the code in the mail. It should be: f:view BODY t:saveState value=#{aRequestScopedObject}/ h:form styleClass=form id=form1 Yes, ARequestScopedObject implements Serializable. The html form code generated by the code above is: form id=form1 method=post action=/testbox/faces/app/savestate/test1.jsp enctype=application/x-www-form-urlencoded input id=form1:text1 type=text name=form1:text1 value=/ input id=form1:text2 type=text name=form1:text2 value=/ input type=submit value=Submit name=form1:button1 id=form1:button1/ input type=hidden name=form1 value=form1 / /form Where text1 and text2 are text fields I included to test it. There is no html code for the saveState() tag. Regards, - Juan On 10/24/05, David G. Friedman [EMAIL PROTECTED] wrote: Juan, What is testState and shouldn't that be #{testState} ? Did you make it serializable so it can be saved? Regards, David -Original Message- From: Juan Medín Piñeiro [mailto:[EMAIL PROTECTED] Sent: Monday, October 24, 2005 10:42 AM To: MyFaces Discussion Subject: Re: How to use t:saveState ? It's inside the view and outside the form. From the test code: f:view BODY t:saveState value=testState/ h:form styleClass=form id=form1 more markup code Regards, - Juan On 10/24/05, David G. Friedman [EMAIL PROTECTED] wrote: Juan, Is it inside the f:view or outside the view? Regards, David -Original Message- From: Juan Medín Piñeiro [mailto:[EMAIL PROTECTED] Sent: Monday, October 24, 2005 10:28 AM To: users@myfaces.apache.org Subject: How to use t:saveState ? Hi, I've been trying to use t:saveState without success. As far as I can read in the wiki and in the examples, you just need to include a t:saveState value=xxx/ in the JSP and the information will travel to the client and back in the next request. So I created 3 pages, test1, test2 and test3, each with a t:saveState value=aRequestScopedObject/. In the backing bean I do something like: aRequestScopedObject = (ARequestScopedObject) getFacesContext() .getApplication() .createValueBinding(#{aRequestScopedObject}) .getValue(getFacesContext()); And then I set several properties on it. Well, when I reach the test2 page _all changes_ are lost. Reading the generated HTML I don't see anything at all related to the saveState info in the form (!?) Am I missing anything ? Any comment would be really welcome. It seems to be very simple to use, the only strange thing is that I'm using the Sun RI + Tomahawk. Thanks in advance, - Juancho -- 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
Re: Validating a DataTable
My guess is no. One thing you could do is add a validator to some other EditableValueHolder component on your page, but have the validator check the dataTable constraint instead of the EVH component. You could create a for attribute (like t:dataScroller or t:equalsValidator) that points to the correct component to check. It might be worthwhile to create a globalValidationHolder component that simply holds validators like this, implements EVH, and does nothing else. Another option is to perform the check in your action methods. The downside to this is that you'd have to check it for every possible action or actionlistener. On 10/25/05, Navid Vahdat [EMAIL PROTECTED] wrote: Hello Everyone! I see, that custom validators are used together with EditableValueHolders. I need to test weather the number of rows in a DataTable matches a given constraint. Is there any way to add a Validator to a DataTable? Cheers, Navid
RE: command button for link
h:commandButton action=displayRegPart value=#{agency.lwbackword}/ where displayRegPart is an outcome defined in your faces-config.xml file as leading to /regpart.jsf: from-outcomedisplayRegPart/from-outcome to-view-id/regpart.jsf/to-view-id - Brendan -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, October 24, 2005 6:29 PM To: users@myfaces.apache.org Subject: command button for link What is the correct usage of command button for a link? h:commandButton action=/regpart.jsf value=#{agency.lwbackword} / does not work.
Re: Validating a DataTable
Hello, i don't understand your intention. The purpose of a validator is to validate user input. Correct me if i'm wrong, but as i know it isn't possible for the user to change the rowcount of a datatable on client side. So what did you want to validate? regards Volker Hello Everyone! I see, that custom validators are used together with EditableValueHolders. I need to test weather the number of rows in a DataTable matches a given constraint. Is there any way to add a Validator to a DataTable? Cheers, Navid -- Don't answer to From: address! Mail to this account are droped if not recieved via mailinglist. To contact me direct create the mail address by concatenating my forename to my senders domain.
Help still needed with valueChangeListener
I have the code that calls my ValueChangeListener implementation. That part works, the bit Im having trouble with is setting the new a value on page. JSP h:inputText id=partNumber value=#{nonConformingMaterial.partNumber} required=true immediate=true onchange=submit() f:valueChangeListener type=org.me.jsf.actions.NonConformingMaterialAL/ /h:inputText The code I have is CODE public class NonConformingMaterialAL implements ValueChangeListener { public void processValueChange(ValueChangeEvent vce) throws AbortProcessingException { String partNo = ((String)vce.getNewValue()); System.out.println(A value has changed! + partNo); // This doesnt save show the new value.?!??! FacesContext ctxt = FacesContext.getCurrentInstance(); if (null != vce.getNewValue()) { ctxt.getExternalContext().getSessionMap().put(SHOWTHIS, partNumber); } ctxt.renderResponse(); } } This doesnt set the value SHOWTHIS in the field though. Can someone please help? Thanks Jeff.
RE: Finding a component with a specific id
You might already have looked this up; the JavaDoc for UIComponent has an extensive description of the lookup algorithm used: http://java.sun.com/j2ee/javaserverfaces/1.1_01/docs/api/index.html - Brendan -Original Message- From: Simon Kitching [mailto:[EMAIL PROTECTED] Sent: Monday, October 24, 2005 11:07 PM To: MyFaces Discussion Subject: Finding a component with a specific id Hi, From a custom renderer I need to be able to find a component with a specific id. Page: o:colSelector tableId=table1 .../ t:dataTable id=table1 ... .. /t:dataTable From the renderer for the o:colSelector I've tried: UIComponent table = facesContext.getViewRoot().findComponent(tableId); UIComponent table = component.findComponent(tableId); UIComponent table = component.findComponent(: + tableId); but had no luck. The table is enclosed in a subview named body, so the id actually gets output as body:table1. I've tried all the above with that string too, and no luck. Any ideas how I should locate that table component by id?? [And BTW, is it possible for a component in a naming container to have an id that is *not* prefixed by its NamingContainer parent's id?] On a related note, looking at the source for UIComponent.findComponent, I see it calls _ComponentUtils.findComponent which is as follows. static UIComponent findComponent(UIComponent findBase, String id) { if (idsAreEqual(id,findBase)) { return findBase; } for (Iterator it = findBase.getFacetsAndChildren(); it.hasNext(); ) { UIComponent childOrFacet = (UIComponent)it.next(); if (!(childOrFacet instanceof NamingContainer)) { UIComponent find = findComponent(childOrFacet, id); if (find != null) return find; } else if (idsAreEqual(id,childOrFacet)) { return childOrFacet; } } return null; } What's the point of that instanceof NamingContainer? Why doesn't the search recurse into NamingContainer children of findBase? Thanks, Simon
Re: valueChangeListener - inputText - Which method is correct?
JSF is server-side processing. So anything that JSF does requires a form submit. You can try marking the input field and the triggering action (not actionListener) as immediate. That should cause it to validate and execute your action before the other fields. I think this will also short-circuit the rest of the JSF processing, and you won't get validation errors for other fields. I could be wrong, though. However, you're also going to short-circuit the model-update phase, so you may find this makes it difficult to accomplish your goal of reading values and updating values on components. The way I've handled this in my own project is to use javascript to force an immediate submit, and create an optional validation framework (OVF) that allows the full JSF lifecycle to execute even though some components fail to validate. The example below (combined with the OVF) would submit the change, but not perform any validation or model updates for components with optional validators. For my own use case, I want the validation errors to show up, but not stop the lifecyle, so it reads soft instead of none in the example code. This allows components that pass validation to be available after the updateModel phase. Unfortunately, it's still an all or nothing situation for components marked as optionally-validating. On my todo list is to allow you to dynamically group components, depending on the control causing the action, so that some components are non-validating, some are soft-validating (generate error messages, but don't short-circuit the lifecycle) and some are hard-validating (standard JSF behavior where a validation error ends the current lifecyle). I haven't decided whether the best implementation for this is to specify controls by id (soft=inputText1,inputText2, hard=inputText3, none=inputText4) or by somehow specifying groups on the optional validators. Quite honestly, if you have the ability to do this all in pure javascript, that's the easier solution. Doing conditional validation, especially when you need some components to be valid afterward, is hard in JSF. h:selectOneMenu id=namedLocationInput onchange=pulldownChanged() value=#{dataModel.workorder.physicalLocation} title=No location selected f:selectItems value=#{page.physicalLocationItems}/ /h:selectOneMenu script language=javascript // ![CDATA[ function pulldownChanged(){ clear_form(); document.forms['form'].elements['NET_SF_JSFC_OPT_VDTR_MODE'].value='none'; document.getElementById(form:nonclearingRefreshButton).click(); } // ]] f:verbatim input type=submit style=display: none; onclick=document.forms['form'].elements['autoScroll'].value=getScrolling(); value=Submit name=form:refreshButton id=form:nonclearingRefreshButton/ /f:verbatim On 10/25/05, Jeffrey Porter [EMAIL PROTECTED] wrote: The spec says ... MethodBinding representing a value change listener method that will be notified when a new value has been set for this input component. I was left with the impression from this that when the field's value changes then the method would get called. Not when the form is submitted. I don't need to process the form. I'm in the situation where a person types in a part number, and the several other fields are auto populated from that value (i.e. the part description manufacture). The form is not submitted thought till they have entered a load of other details. I guess I can look at getting some javascript to do this. But it's a shame there isn't a method for this in MyFaces. I see that I can write something like this… h:selectBooleanCheckbox valueChangeListener=#{resumeBean.changeColorMode} onchange=submit() immediate=true/ But this results in the form being submitted error messages being displayed because of fields not filled. This would confuse the user, since They've not pressed the submit button yet. Jeff. -Original Message- From: Bruno Aranda [mailto:[EMAIL PROTECTED] Sent: 25 October 2005 11:57 To: MyFaces Discussion Subject: Re: valueChangeListener - inputText - Which method is correct? Yes, but the ValueChangeEvent will be processed in the Process Validations phase, after submitting the form. So if you want to change the value of the other inputText when the first changes, you need to submit the form (technique #1). Otherwise, you can use javascript if it is an option to you (if you don't have to process the form). Hope it is clear now, Bruno 2005/10/25, Jeffrey Porter [EMAIL PROTECTED]: Thanks Bruno. Great links. The spec for h:inputText states that it has the MethodBinding attribute valueChangeListener. So if I set this as... h:inputText id=name value=#{ncm.name} required=true valueChangeListener=#{ncm.changeEvent} / Should it not call my method in the ncm class? public void changeEvent(ValueChangeEvent event) {
Re: Validating a DataTable
Hi Volker! I'm currently implementing a Web-GUI for an application generated from a UML-meta-model. To model a 1:n or m:n relationship (general associations or compositions), I use a table, and additional Add- and Remove buttons. Now there are constraints on the association ends, like X must have at least a and at most b relations to Y, when committing. Thus the table needs to be validated. I went for Mike's approach, generating a hidden input field below each table and a error message above. In the bean I needed to generate an additional getXXXSize method, because I didn't know how to reference the size method of the list using EL. It works :-) Thanks everyone! Navid Volker Weber wrote: Hello, i don't understand your intention. The purpose of a validator is to validate user input. Correct me if i'm wrong, but as i know it isn't possible for the user to change the rowcount of a datatable on client side. So what did you want to validate? regards Volker Hello Everyone! I see, that custom validators are used together with EditableValueHolders. I need to test weather the number of rows in a DataTable matches a given constraint. Is there any way to add a Validator to a DataTable? Cheers, Navid
Re: x:commandLink and onClick
When you get this all figured out, could you create a MyFaces wiki entry on it? I'm sure I'm not the only one who will eventually need to do something similar, and it'd be great if we could get it documented somewhere! As you mentioned, there's a lot of attempts to provide this with mixed results, and it'd be good to have something that's known to work. On 10/25/05, James Reynolds [EMAIL PROTECTED] wrote: Oh! That's a good idea. However, that presents another problem for my page. By way of some background, I'm using a dataTable to build a list of upcoming conferences. The final column contains two links inside, Edit and Delete. The Edit navigates to a detail page, while the delete would obviously remove the record and reload the page. I also have an Add Conference button outside of the table. Using the onSubmit attribute would prompt for confirmation no matter what control is activated. Perhaps I should just use commandButtons instead of commandLinks and avoid the issue altogether. -Original Message- From: Marius Kreis [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 25, 2005 8:26 AM To: MyFaces Discussion Subject: Re: x:commandLink and onClick sorry, my mistake. i think h:form onSubmit=return confirm('text'); .. should work James Reynolds wrote: That was my first try. The confirmation box pops up properly, but the form does not submit after clicking the 'OK' button. Has anyone else had this trouble? Judging from the archives, it appears that people have had mixed results with different methods. -Original Message- From: Marius Kreis [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 25, 2005 7:32 AM To: MyFaces Discussion Subject: Re: x:commandLink and onClick This sounds like an error in your javascript. Perhaps you should try onClick=return confirm('Are you sure...?'); James Reynolds wrote: I'm trying to add some confirmation to the onClick event for my commandLink. The mail archives have good suggestions including: 1. Call a function defined on the page like this: onclick=return validate() 2. Construct the javascript as such: onclick=if (!confirm('Are you sure you want to delete this record?')) return In each case, I'm receiving Object Expected errors in Internet Explorer. What is the best way of handling this task? Thanks
JSCookMenu and CommandLink
hi, currently I'm working on a application that has a main menu page with CommandLinks from a form. What I would like to do is make it so the following CommandLink is executiable from JSCookMenu javascript. Is there a easy way to add this in the menu js for JSCookMenu? h:commandLink styleClass=graynav action=#{director.editDirectorInformation} h:outputText value=#{messages.directorConfiguration}/ /h:commandLinkbr what I was doing was yuck hack on the form generated javascript in the rendered html and putting it in the js and ecapsolating the js with a form: snipped of js with form hack entry: _cmSplit, [null, 'Lookups and Translations', '', '', 'description', [null, 'CNO Lookup', 'javascript:document.forms[_id1][_id1:_idcl].value=_id1:CnoLookup;document.forms[_id1].submit();return false;', '', 'description'], [null, 'Counterparty Lookup', 'javascript:document.forms[_id1][_id1:_idcl].value=_id1:CounterpartyLookup;document.forms[_id1].submit();return false;', '', 'description'], [null, 'Location Lookup', 'javascript:document.forms[_id1][_id1:_idcl].value=_id1:LocationLookup;document.forms[_id1].submit();return false;', '', 'description'], ], when going to nested pages i ran into complications. sorry in advance if this is a reject question. oliver
Re: Comparable validation design
@attribute name: Couldn't find anything in the 1.2 spec. Looks like it's been postponed to 2.0 for everything but the required attribute, and for the required attribute it's named requiredMessage So I'm recommending that we use message as the attribute. @validator name: compareToValidator was perfect, until Mathias's java.util.Comparator suggestion :) But I think it still works even with that suggestion, and I'm going to go with that for now. @java.util.Comparator: Excellent. I'll add this in. @operator names: I decided to go ahead and add in eq, ne, [...], ==, !=, [...] and = as operator names since there wasn't any cost to supporting multiple versions. On 10/25/05, Jesse Alexander (KBSA 21) [EMAIL PROTECTED] wrote: -Original Message- @attribute name: is there something like this in the RI 1.2? I think that yes, so maybe we should go with their name for this. -/Original Message- +1 -Original Message- @comparable: right, there is the interface name - I didn't think about that. But then the equalsValidator is named by the method it calls - so maybe we should take the method name here as well - compareToValidator or more simple compareValidator ? Forget about my suggestions if I start to enerve you - then just take the interface name ;) -/Original Message- Consider the stage for this to be some sort of brain-storming... -Original Message- define an additional attribute (comparator) which allows the user to specify a comparator instance which implements java.util.Comparator if the objects don´t implement Comparable -/Original Message- Good idea regards Alexander
Re: dataTable question (again)
Hi, again!! I have a new question now. I am using the STATE_SAVING_METHOD = 'client' and when I try to use the dataTable's preserveRows property, appears a error Error while saving state in 'client' of type RowData. My real problem is that I want to work with the dataModel adding and deleting lines in a table. In the first time works, but in the next, my dataModel variable becames null and appear a NullPointerException. Any ideas? Thanks Guedes On 10/21/05, PATRICIA GUEDES [EMAIL PROTECTED] wrote: It works Finally... Thanks very much for your time and patience . Guedes On 10/21/05, Mathias Brökelmann [EMAIL PROTECTED] wrote: sorry I forgot to answer your question. You should not initialize your RowData with a datamodel for your fields as a second parameter. Instead pass the values for each field of this row and don´t put your values into your fields: private static final Fields[] fieldsEmbque = new Fields[] { new Fields(1, Embarcador, NUMBER, true, true, , equipaments, COMBO), new Fields(2, Nº Embarque, NUMBER, true, true, , null, null), new Fields(3, Dt. Prevista, DATE, true, false, , null, null), new Fields(4, Pedido, NUMBER, true, false, , null, null), new Fields(5, Cliente, NUMBER, true, false, , null, null), new Fields(6, Local Embarque, STRING, true, false, , null, null), new Fields(7, Lote, NUMBER, true, false, , null, null)}; public List getValuesEmbque() { if(valuesEmbque == null) { valuesEmbque = new ArrayList(); valuesEmbque.add(new RowData(this, new String[] {1,2,3,4,5,6,7}); valuesEmbque.add(new RowData(this, new String[] {8,9,10,11,12,13,14}); } return valuesEmbque; } public class RowData { private RemessaBean fieldHolder; private String values; public RowData(RemessaBean fieldHolder, String[] values) { this.fieldHolder = fieldHolder; this.values = values; } public Object getValue() { return this.values[this.fieldHolder.getRowIndex()]; } } x:dataTable value=#{remessaBean.valuesEmbque} var=values x:columns value=#{remessaBean.fieldsEmbque} var=field f:facet name=header x:outputText value=#{field.nomeCampoTela}/ /f:facet x:selectOneMenu value=#{values.value} rendered='#{field.active and field.tipoHTML==COMBO}' f:selectItems value=#{field.itensHTML}/ /x:selectOneMenu h:outputText value=#{values.value} rendered='#{field.active and field.tipoHTML!=COMBO}'/ /x:columns /x:dataTable this should work. 2005/10/21, PATRICIA GUEDES [EMAIL PROTECTED]: Anyone help me, please I don't know what do Thanks Guedes On 10/20/05, PATRICIA GUEDES [EMAIL PROTECTED] wrote: Hi, (sorry for my bad english again) I am trying to create a table using dataTable, but something is wrong. When I try to show my lines using a DataModel, just the first element of each Array was showed. Ex what I want: 1 2 3 4567 8 9 10 11 12 13 14 How is been showed ... 1 1 1 1 1 1 1 8 8 8 8 8 8 8 My code : ** RemessaBean class private static final Fields[] fieldsEmbque = new Fields[] { new Fields(1, Embarcador, 1, NUMBER, true, true, , equipaments, COMBO), new Fields(2, Nº Embarque, 2, NUMBER, true, true, , null, null), new Fields(3, Dt. Prevista, 3, DATE, true, false, , null, null), new Fields(4, Pedido, 4, NUMBER, true, false, , null, null), new Fields(5, Cliente, 5, NUMBER, true, false, , null, null), new Fields(6, Local Embarque, 6, STRING, true, false, , null, null), new Fields(7, Lote, 7, NUMBER, true, false, , null, null)}; private static final Fields[] fieldsEmbque1 = new Fields[] { new Fields(1, Embarcador, 8, NUMBER, true, true, , logProviders, COMBO), new Fields(2, Nº Embarque, 9, NUMBER, true, true, , null, null), new Fields(3, Dt. Prevista, 10, DATE, true, false, , null, null), new Fields(4, Pedido, 11, NUMBER, true, false, , null, null), new Fields(5, Cliente, 12, NUMBER, true, false, , null, null), new Fields(6, Local Embarque, 13, STRING, true, false, , null, null), new Fields(7, Lote, 14, NUMBER, true, false, , null, null)}; public List getValuesEmbque() { if(valuesEmbque == null) { valuesEmbque = new ArrayList(); valuesEmbque.add(new RowData(this, new ArrayDataModel(fieldsEmbque))); valuesEmbque.add(new RowData(this, new ArrayDataModel(fieldsEmbque1))); } return valuesEmbque; } *** RowData Class public class RowData { private RemessaBean
Re: Comparable validation design
A few more questions. 1) What should happen if the compared values do not implement Comparable and no Comparable is provided? Right now, it's passively passing validation. I wonder if it should throw a FacesException (not ValidationException) instead? 2) If either the foreign component value or the parent component value are null, perform no validation? This is going to happen by default if the parent component value is null since JSF won't execute validators in that case. We can't validate if: a) value is null and foreign value is null b) value is null and foreign value is not null. We could try to validate if c) value is not null and foreign value is null d) value is not null and foreign value is not null For consistency, I'd say we'd do the same thing for the foreign key, and only try to validate for case d). On 10/25/05, Mike Kienenberger [EMAIL PROTECTED] wrote: @attribute name: Couldn't find anything in the 1.2 spec. Looks like it's been postponed to 2.0 for everything but the required attribute, and for the required attribute it's named requiredMessage So I'm recommending that we use message as the attribute. @validator name: compareToValidator was perfect, until Mathias's java.util.Comparator suggestion :) But I think it still works even with that suggestion, and I'm going to go with that for now. @java.util.Comparator: Excellent. I'll add this in. @operator names: I decided to go ahead and add in eq, ne, [...], ==, !=, [...] and = as operator names since there wasn't any cost to supporting multiple versions. On 10/25/05, Jesse Alexander (KBSA 21) [EMAIL PROTECTED] wrote: -Original Message- @attribute name: is there something like this in the RI 1.2? I think that yes, so maybe we should go with their name for this. -/Original Message- +1 -Original Message- @comparable: right, there is the interface name - I didn't think about that. But then the equalsValidator is named by the method it calls - so maybe we should take the method name here as well - compareToValidator or more simple compareValidator ? Forget about my suggestions if I start to enerve you - then just take the interface name ;) -/Original Message- Consider the stage for this to be some sort of brain-storming... -Original Message- define an additional attribute (comparator) which allows the user to specify a comparator instance which implements java.util.Comparator if the objects don´t implement Comparable -/Original Message- Good idea regards Alexander
How to handle double posting problems
Hi, I am new to jsf and just beginning to put together some pages. I am playing with a form that has an event listener on a selection list, the form refreshes depending on the selection. I discovered that if I click too fast jsf will throw the following exception: 01:07:42,794 ERROR [FacesServlet]:253 - Servlet.service() for servlet FacesServlet threw exception javax.faces.el.EvaluationException: Cannot get value for _expression_ '#{userBean.userIdsList}' What is the best way to handle this situation? Many thanks in advance. Yee
Help: JSCookMenu stop displaying
Hi,I was testing out a very simple JSCookMenu, I had it working for quite a while. Then for apparently no reasons it stop showing up in the web browser. I checked the rendered page (attached below) it seems that the menu did get rendered.Can someone tell me what could have gone wrong?May thanks in advance.Best regards,Yeehtmlhead titleMy Home/title link href=/styles/style.css rel=stylesheet type=text/css /script src=/TralevaERP/faces/myFacesExtensionResource/navmenu.jscookmenu.HtmlJSCookMenuRenderer/11288948/JSCookMenu.js type=text/_javascript_!--//--/scriptscript src=/TralevaERP/faces/myFacesExtensionResource/navmenu.jscookmenu.HtmlJSCookMenuRenderer/11288948/MyFacesHack.js type=text/_javascript_!--//--/scriptscript type=text/_javascript_!--myThemeOfficeBase='/TralevaERP/faces/myFacesExtensionResource/navmenu.jscookmenu.HtmlJSCookMenuRenderer/11288948/ThemeOffice/';//--/scriptscript src=/TralevaERP/faces/myFacesExtensionResource/navmenu.jscookmenu.HtmlJSCookMenuRenderer/11288948/ThemeOffice/theme.js type=text/_javascript_!--//--/scriptlink rel=stylesheet href=/TralevaERP/faces/myFacesExtensionResource/navmenu.jscookmenu.HtmlJSCookMenuRenderer/11288948/ThemeOffice/theme.css type=text/css //headbody table tr tdimg src=/TralevaERP/images/traleva_logo.bmp //td td table tr td colspan=2 H2Welcome to ABCDE/H2 /td /tr tr td Welcome: myuser /td td /td /tr /table /td /tr /table script type=text/_javascript_!--var id2_menu =[[null, 'Home', 'id2_menu:go_home', 'linkDummyForm', null],[null, 'Catalog', 'id2_menu:go_catalog', 'linkDummyForm', null],[null, 'Admin', null, 'linkDummyForm', null,[null, 'User Mgmt', 'id2_menu:go_userMgmt', 'linkDummyForm', null],[null, 'Lookup Table', 'id2_menu:go_lookupTable', 'linkDummyForm', null]]];//--/scriptdiv id=id2_menu/divscript type=text/_javascript_!-- cmDraw ('id2_menu', id2_menu, 'hbr', cmThemeOffice, 'ThemeOffice');//--/script H1Welcome to My JSF page/H1 form id=linkDummyForm name=linkDummyForm style=display:inline method=post action=/TralevaERP/home.jsfinput type=hidden name=autoScroll /input type=hidden name=jscook_action /script type=text/_javascript_!--function clear_linkDummyForm() { var f = document.forms['linkDummyForm']; f.elements['jscook_action'].value=''; f.target='';}clear_linkDummyForm();//--/script/formscript type=text/_javascript_!--function getScrolling() { var x = 0; var y = 0; if (self.pageXOffset) { x = self.pageXOffset; y = self.pageYOffset; } else if (document.documentElement document.documentElement.scrollLeft) { x = document.documentElement.scrollLeft; y = document.documentElement.scrollTop; } else if (document.body) { x = document.body.scrollLeft; y = document.body.scrollTop; } return x + , + y;}//--/script/body/html
RE: Help: JSCookMenu stop displaying
Yee, Can you post your JSF code for this page? Did you just recently download the latest nightly? Neal -- Neal Haggard Senior Systems Developer Knowledge Management Center SAS Institute From: Yee CN [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 25, 2005 1:30 PMTo: 'MyFaces Discussion'Subject: Help: JSCookMenu stop displaying Hi,I was testing out a very simple JSCookMenu, I had it working for quite a while. Then for apparently no reasons it stop showing up in the web browser. I checked the rendered page (attached below) it seems that the menu did get rendered.Can someone tell me what could have gone wrong?May thanks in advance.Best regards,Yeehtmlhead titleMy Home/title link href="/styles/style.css" rel="stylesheet" type="text/css" /script src="/TralevaERP/faces/myFacesExtensionResource/navmenu.jscookmenu.HtmlJSCookMenuRenderer/11288948/JSCookMenu.js" type="text/_javascript_"!--//--/scriptscript src="/TralevaERP/faces/myFacesExtensionResource/navmenu.jscookmenu.HtmlJSCookMenuRenderer/11288948/MyFacesHack.js" type="text/_javascript_"!--//--/scriptscript type="text/_javascript_"!--myThemeOfficeBase='/TralevaERP/faces/myFacesExtensionResource/navmenu.jscookmenu.HtmlJSCookMenuRenderer/11288948/ThemeOffice/';//--/scriptscript src="/TralevaERP/faces/myFacesExtensionResource/navmenu.jscookmenu.HtmlJSCookMenuRenderer/11288948/ThemeOffice/theme.js" type="text/_javascript_"!--//--/scriptlink rel="stylesheet" href="/TralevaERP/faces/myFacesExtensionResource/navmenu.jscookmenu.HtmlJSCookMenuRenderer/11288948/ThemeOffice/theme.css" type="text/css" //headbody table tr tdimg src="/TralevaERP/images/traleva_logo.bmp" //td td table tr td colspan="2" H2Welcome to ABCDE/H2 /td /tr tr td Welcome: myuser /td td /td /tr /table /td /tr /table script type="text/_javascript_"!--var id2_menu =[[null, 'Home', 'id2_menu:go_home', 'linkDummyForm', null],[null, 'Catalog', 'id2_menu:go_catalog', 'linkDummyForm', null],[null, 'Admin', null, 'linkDummyForm', null,[null, 'User Mgmt', 'id2_menu:go_userMgmt', 'linkDummyForm', null],[null, 'Lookup Table', 'id2_menu:go_lookupTable', 'linkDummyForm', null]]];//--/scriptdiv id="id2_menu"/divscript type="text/_javascript_"!-- cmDraw ('id2_menu', id2_menu, 'hbr', cmThemeOffice, 'ThemeOffice');//--/script H1Welcome to My JSF page/H1 form id="linkDummyForm" name="linkDummyForm" style="display:inline" method="post" action="/TralevaERP/home.jsf"input type="hidden" name="autoScroll" /input type="hidden" name="jscook_action" /script type="text/_javascript_"!--function clear_linkDummyForm() { var f = document.forms['linkDummyForm']; f.elements['jscook_action'].value=''; f.target='';}clear_linkDummyForm();//--/script/formscript type="text/_javascript_"!--function getScrolling() { var x = 0; var y = 0; if (self.pageXOffset) { x = self.pageXOffset; y = self.pageYOffset; } else if (document.documentElement document.documentElement.scrollLeft) { x = document.documentElement.scrollLeft; y = document.documentElement.scrollTop; } else if (document.body) { x = document.body.scrollLeft; y = document.body.scrollTop; } return x + "," + y;}//--/script/body/html
RE: [ANN] JAVAWUG / BOF XIII / Belgo Central / Friday 28th Sept 2 005 / 19:15
Just a reminder The ``JAVA Web User Group'' is pleased to announce. Please meet for the BOF XIII London meet-up at the ``Belgo Central Restaurant'' at 19:15M on Friday, 28th October, 2005. 50 Earlham Street, Covent Garden, London, WC2H 9HP United Kingdom Nearest Tube: Covent Garden Cuisine: Belgian Telephone: 020 7813 2233 For an ajax Google Map click here http://www.london-eating.co.uk/maps/248.asp For the more traditional street map try this http://www.streetmap.co.uk/newmap.srf?x=530189y=181082z=0sv=WC2H+9HPst=2pc=WC2H+9HPmapp=newmap.srfsearchp=newsearch.srf The JAVAWUG is a Java User Group and it has already has listing at http://developers.sun.com/jugs/display/europe/gbr/london ==== Also on the sameday EJB Workshop 3 presentation by Alexander Hartner at Sun's London Bridge office at lunchtime 12-14pm. More salient details on http://www.ejb3workshop.com/ -- Peter Pilgrim :: J2EE Software Development Operations/IT - Credit Suisse First Boston, Floor 15, 5 Canada Square, London E14 4QJ, United Kingdom Tel: +44-(0)207-883-4497 Organiser / Founder ( http://www.javawug.com/ ) ( ( ( ( ( ( )\( ( )\)\))( ' ( )\ ) )_)( )\ )_)( ((_)()\ ))\(()/( ((_)\ _ )\((_)((_)\ _ )\_(())\_)()_ ((_)/(_))_ _ | (_)_\(_) \ / /(_)_\(_) \((_)/ / | | (_)) __| | || |/ _ \ \ V / / _ \ \ \/\/ /| |_| | | (_ | \__//_/ \_\ \_/ /_/ \_\ \_/\_/ \___/ \___| = == Please access the attached hyperlink for an important electronic communications disclaimer: http://www.csfb.com/legal_terms/disclaimer_external_email.shtml ==
RE: [PROPOSAL] PRETTY_HTML, was [RE: JFS's html output]
+1 for that. - Brendan -Original Message- From: Strittmatter, Stephan [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 25, 2005 7:27 AM To: MyFaces Discussion Subject: RE: [PROPOSAL] PRETTY_HTML, was [RE: JFS's html output] On the other hand, when there is already such an ExtensionFilter in jtidy (I also haven't known that), why spend efford to make pretty output in myFaces? Why not removing the context parameter org.apache.myfaces.PRETTY_HTML and create instead a short section in the wiki about jtidy as ExtentionFilter? Just focusing on the main goal of MyFaces... Regards, Stephan -Original Message- From: Jesse Alexander (KBSA 21) [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 25, 2005 2:05 PM To: MyFaces Discussion Subject: RE: [PROPOSAL] PRETTY_HTML, was [RE: JFS's html output] -Original Message- I prefer to add a additional filter instead of doing this in the ExtensionFilter. jtidy has already a filter for this: http://jtidy.sourceforge.net/multiproject/jtidyservlet/filter.html -/Original Message- That's what I had hopes for (just no time to check ;-) thanks for checking it out regards Alexander
SelectOneCountry, skip validation?
I have a form, let user input address information: t:selectOneCountry maxLength="25" / Once user selects country, the state selection changes based on the country selected. The form can be incomplete when user selects country, but the validation is in the execution path on the server side when submitting the form by changing the country. How to skip the validation when users select a country? For command link, immediate="true" can be used. Thanks, Dave Yahoo! FareChase - Search multiple travel sites in one click.
SelectOneState for US?
Is there a component to select one state in US ? like selectOneState ? Thanks, Dave Yahoo! FareChase - Search multiple travel sites in one click.
RE: SelectOneCountry, skip validation?
Youve answered your own question set the immediate=true property on the submit button. I do this on our signon page where a username/password is mandatory, and yet I need a link to let the user create a signon. From: Dave [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 25, 2005 3:11 PM To: users@myfaces.apache.org Subject: SelectOneCountry, skip validation? I have a form, let user input address information: t:selectOneCountry maxLength=25 / Once user selects country, the state selection changes based on the country selected. The form can be incomplete when user selects country, but the validation is in the execution path on the server side when submitting the form by changing the country. How to skip the validation when users select a country? For command link, immediate=true can be used. Thanks, Dave Yahoo! FareChase - Search multiple travel sites in one click. This electronic message transmission contains information from the Company that may be proprietary, confidential and/or privileged. The information is intended only for the use of the individual(s) or entity named above. If you are not the intended recipient, be aware that any disclosure, copying or distribution or use of the contents of this information is prohibited. If you have received this electronic transmission in error, please notify the sender immediately by replying to the address listed in the "From:" field.
RE: SelectOneState for US?
Use a dropdown list and populate it with all the states on the server side. From: Dave [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 25, 2005 3:14 PM To: users@myfaces.apache.org Subject: SelectOneState for US? Is there a component to select one state in US ? like selectOneState ? Thanks, Dave Yahoo! FareChase - Search multiple travel sites in one click. This electronic message transmission contains information from the Company that may be proprietary, confidential and/or privileged. The information is intended only for the use of the individual(s) or entity named above. If you are not the intended recipient, be aware that any disclosure, copying or distribution or use of the contents of this information is prohibited. If you have received this electronic transmission in error, please notify the sender immediately by replying to the address listed in the "From:" field.
RE: SelectOneCountry, skip validation?
The form is not submitted by clicking a button, but using event "onchange"."Santiago, Ray" [EMAIL PROTECTED] wrote: Youve answered your own question set the immediate=true property on the submit button. I do this on our signon page where a username/password is mandatory, and yet I need a link to let the user create a signon. From: Dave [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 25, 2005 3:11 PMTo: users@myfaces.apache.orgSubject: SelectOneCountry, skip validation? I have a form, let user input address information: t:selectOneCountry maxLength="25" / Once user selects country, the state selection changes based on the country selected. The form can be incomplete when user selects country, but the validation is in the execution path on the server side when submitting the form by changing the country. How to skip the validation when users select a country? For command link, immediate="true" can be used. Thanks, Dave Yahoo! FareChase - Search multiple travel sites in one click. This electronic message transmission contains information from the Company that may be proprietary, confidential and/or privileged. The information is intended only for the use of the individual(s) or entity named above. If you are not the intended recipient, be aware that any disclosure, copying or distribution or use of the contents of this information is prohibited. If you have received this electronic transmission in error, please notify the sender immediately by replying to the address listed in the "From:" field. Yahoo! FareChase - Search multiple travel sites in one click.
Re: [tobago] using tobago on tomcat 5.5
Hi Stefan, please check out the latest version of tobago :-) Best Regards Bernd Bohmann Stefan Hedtfeld schrieb: Hi, there seems to be a problem with tobago on tomcat 5.5. When deploying my webapp I see an INFO message in the log files:
dataTable, row - valign
I have a dataTable, like all columns of a row align top vertically, default is center. for html, valign="top". what is the equivalent for CSS? Thanks. Dave Yahoo! FareChase - Search multiple travel sites in one click.
Re: SelectOneCountry, skip validation?
Dave, take a look at http://wiki.apache.org/myfaces/SubmitPageOnValueChange , you can click a hidden button with the immediate attribute set to true, Regards, Bruno 2005/10/25, Dave [EMAIL PROTECTED]: The form is not submitted by clicking a button, but using event onchange. Santiago, Ray [EMAIL PROTECTED] wrote: You've answered your own question set the immediate=true property on the submit button. I do this on our signon page where a username/password is mandatory, and yet I need a link to let the user create a signon. From: Dave [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 25, 2005 3:11 PM To: users@myfaces.apache.org Subject: SelectOneCountry, skip validation? I have a form, let user input address information: t:selectOneCountry maxLength=25 onchange=this.form.submit(); / Once user selects country, the state selection changes based on the country selected. The form can be incomplete when user selects country, but the validation is in the execution path on the server side when submitting the form by changing the country. How to skip the validation when users select a country? For command link, immediate=true can be used. Thanks, Dave Yahoo! FareChase - Search multiple travel sites in one click. This electronic message transmission contains information from the Company that may be proprietary, confidential and/or privileged. The information is intended only for the use of the individual(s) or entity named above. If you are not the intended recipient, be aware that any disclosure, copying or distribution or use of the contents of this information is prohibited. If you have received this electronic transmission in error, please notify the sender immediately by replying to the address listed in the From: field. Yahoo! FareChase - Search multiple travel sites in one click.
RE: AW: FileDownload capability?
In earlier examples, one had to call response.setContentLength() with the number of bytes being passed. I have the following questions regarding this: 1. What are the consequences if I get the length wrong? Does it have to be exact? 2. Can the setContentLength() be called after I have done all the writes, or must it be done before the writes? If I can call it beforehand, then I can compute the length as I go. Otherwise, it will be more difficult. Thanks, - Brendan -Original Message- From: CONNER, BRENDAN (SBCSI) Sent: Tuesday, October 25, 2005 12:15 PM To: 'MyFaces Discussion' Subject: RE: AW: FileDownload capability? And it's even easier if one is generating a text file (rather than a binary file), for example, when writing out a comma-separated file for use in a spreadsheet, since one can use response.getWriter().print(String s) and response.getWriter().println(String s). - Brendan -Original Message- From: Nico Krijnen [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 25, 2005 3:00 AM To: 'MyFaces Discussion' Cc: [EMAIL PROTECTED] Subject: RE: AW: FileDownload capability? It is actualy much easier in JSF. You just need to have an action method in a (managed) bean, like this: public String downloadFile() { FacesContext facesContext = FacesContext.getCurrentInstance(); if (!facesContext.getResponseComplete()) { String fileName = myfile.pdf; ServletContext servletContext = (ServletContext) facesContext.getExternalContext().getContext(); String contentType = servletContext.getMimeType(fileName); HttpServletResponse response = (HttpServletResponse) facesContext.getExternalContext().getResponse(); response.setContentType(contentType); response.setHeader(Content-Disposition, attachment;filename=\ + fileName + \); try { InputStream in = /* get your data */; ServletOutputStream out = response.getOutputStream(); byte[] buf = new byte[512]; int bytesRead; while ((bytesRead = in.read(buf, 0, bufSize)) != -1) { out.write(buf, 0, bytesRead); } out.flush(); facesContext.responseComplete(); } catch (IOException e) { throw new RuntimeException(e); } } return null; } Then you can simply call the method from a commandLink or commandButton h:commandLink action=#{yourBean.downloadFile} h:outputText value=download / /h:commandLink Nico -Oorspronkelijk bericht- Van: news [mailto:[EMAIL PROTECTED] Namens Werner Punz Verzonden: maandag 24 oktober 2005 23:34 Aan: users@myfaces.apache.org Onderwerp: Re: AW: FileDownload capability? It is rather easy, I usually have a download servlet for this which generates the appropriate html code, I do not have the code handy currently but you basically set the header mimetype to either your filetype or application/octed stream, then pass down the content length (this is important because otherwise our all beloved IE has some problems on certain filetypes) and then you basically pass the stream as content down as embedded binary data. You also can achieve that with a phaselistener if you feel uneasy to do it over a separate servlet. All you then have to do is to link to the servlet or phase listener with a linke and a target=_new Werner [EMAIL PROTECTED] wrote: I have nearly the same problem: I have the link of a sample file (pdf, doc or something else) in the database. Now the user should have the possibility to open this file via a CommandButton or CommandLink I'm not quite sure, how I can do this? Thx for help
RE: AW: FileDownload capability?
I think I have most of the answers to my own questions, after consulting the O'Reilly book Java Servlet Programming: 1. The response, if set, has to be exact. However, it does not have to be set. Using it allows Servlets to be able to take advantage of persistent connections, if available. 2. It must be set before sending the response body. So, given this, does (2) above imply that, if done, setting the length has to precede the first write? Or it just has to be done before calling responseComplete()? - Brendan P.S. I realize this is more of a Servlet question than a MyFaces question. Sorry about that. -Original Message- From: CONNER, BRENDAN (SBCSI) Sent: Tuesday, October 25, 2005 2:38 PM To: 'MyFaces Discussion' Subject: RE: AW: FileDownload capability? In earlier examples, one had to call response.setContentLength() with the number of bytes being passed. I have the following questions regarding this: 1. What are the consequences if I get the length wrong? Does it have to be exact? 2. Can the setContentLength() be called after I have done all the writes, or must it be done before the writes? If I can call it beforehand, then I can compute the length as I go. Otherwise, it will be more difficult. Thanks, - Brendan -Original Message- From: CONNER, BRENDAN (SBCSI) Sent: Tuesday, October 25, 2005 12:15 PM To: 'MyFaces Discussion' Subject: RE: AW: FileDownload capability? And it's even easier if one is generating a text file (rather than a binary file), for example, when writing out a comma-separated file for use in a spreadsheet, since one can use response.getWriter().print(String s) and response.getWriter().println(String s). - Brendan -Original Message- From: Nico Krijnen [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 25, 2005 3:00 AM To: 'MyFaces Discussion' Cc: [EMAIL PROTECTED] Subject: RE: AW: FileDownload capability? It is actualy much easier in JSF. You just need to have an action method in a (managed) bean, like this: public String downloadFile() { FacesContext facesContext = FacesContext.getCurrentInstance(); if (!facesContext.getResponseComplete()) { String fileName = myfile.pdf; ServletContext servletContext = (ServletContext) facesContext.getExternalContext().getContext(); String contentType = servletContext.getMimeType(fileName); HttpServletResponse response = (HttpServletResponse) facesContext.getExternalContext().getResponse(); response.setContentType(contentType); response.setHeader(Content-Disposition, attachment;filename=\ + fileName + \); try { InputStream in = /* get your data */; ServletOutputStream out = response.getOutputStream(); byte[] buf = new byte[512]; int bytesRead; while ((bytesRead = in.read(buf, 0, bufSize)) != -1) { out.write(buf, 0, bytesRead); } out.flush(); facesContext.responseComplete(); } catch (IOException e) { throw new RuntimeException(e); } } return null; } Then you can simply call the method from a commandLink or commandButton h:commandLink action=#{yourBean.downloadFile} h:outputText value=download / /h:commandLink Nico -Oorspronkelijk bericht- Van: news [mailto:[EMAIL PROTECTED] Namens Werner Punz Verzonden: maandag 24 oktober 2005 23:34 Aan: users@myfaces.apache.org Onderwerp: Re: AW: FileDownload capability? It is rather easy, I usually have a download servlet for this which generates the appropriate html code, I do not have the code handy currently but you basically set the header mimetype to either your filetype or application/octed stream, then pass down the content length (this is important because otherwise our all beloved IE has some problems on certain filetypes) and then you basically pass the stream as content down as embedded binary data. You also can achieve that with a phaselistener if you feel uneasy to do it over a separate servlet. All you then have to do is to link to the servlet or phase listener with a linke and a target=_new Werner [EMAIL PROTECTED] wrote: I have nearly the same problem: I have the link of a sample file (pdf, doc or something else) in the database. Now the user should have the possibility to open this file via a CommandButton or CommandLink I'm not quite sure, how I can do this? Thx for help
Re: AW: FileDownload capability?
It depends on the browser and container, but ignore it at your own risk. The safest solution is to set the content length to the exact size before writing any data to the response. If the data is being computed on the fly, then write your data to a ByteArrayOutputStream first, then use byte data[] = ByteArrayOutputStream.toByteArray() to get something to send to the response. Here's an example of what might happen if you don't. http://lists.samba.org/archive/jcifs/2003-May/002188.html On 10/25/05, CONNER, BRENDAN (SBCSI) [EMAIL PROTECTED] wrote: In earlier examples, one had to call response.setContentLength() with the number of bytes being passed. I have the following questions regarding this: 1. What are the consequences if I get the length wrong? Does it have to be exact? 2. Can the setContentLength() be called after I have done all the writes, or must it be done before the writes? If I can call it beforehand, then I can compute the length as I go. Otherwise, it will be more difficult. Thanks, - Brendan -Original Message- From: CONNER, BRENDAN (SBCSI) Sent: Tuesday, October 25, 2005 12:15 PM To: 'MyFaces Discussion' Subject: RE: AW: FileDownload capability? And it's even easier if one is generating a text file (rather than a binary file), for example, when writing out a comma-separated file for use in a spreadsheet, since one can use response.getWriter().print(String s) and response.getWriter().println(String s). - Brendan -Original Message- From: Nico Krijnen [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 25, 2005 3:00 AM To: 'MyFaces Discussion' Cc: [EMAIL PROTECTED] Subject: RE: AW: FileDownload capability? It is actualy much easier in JSF. You just need to have an action method in a (managed) bean, like this: public String downloadFile() { FacesContext facesContext = FacesContext.getCurrentInstance(); if (!facesContext.getResponseComplete()) { String fileName = myfile.pdf; ServletContext servletContext = (ServletContext) facesContext.getExternalContext().getContext(); String contentType = servletContext.getMimeType(fileName); HttpServletResponse response = (HttpServletResponse) facesContext.getExternalContext().getResponse(); response.setContentType(contentType); response.setHeader(Content-Disposition, attachment;filename=\ + fileName + \); try { InputStream in = /* get your data */; ServletOutputStream out = response.getOutputStream(); byte[] buf = new byte[512]; int bytesRead; while ((bytesRead = in.read(buf, 0, bufSize)) != -1) { out.write(buf, 0, bytesRead); } out.flush(); facesContext.responseComplete(); } catch (IOException e) { throw new RuntimeException(e); } } return null; } Then you can simply call the method from a commandLink or commandButton h:commandLink action=#{yourBean.downloadFile} h:outputText value=download / /h:commandLink Nico -Oorspronkelijk bericht- Van: news [mailto:[EMAIL PROTECTED] Namens Werner Punz Verzonden: maandag 24 oktober 2005 23:34 Aan: users@myfaces.apache.org Onderwerp: Re: AW: FileDownload capability? It is rather easy, I usually have a download servlet for this which generates the appropriate html code, I do not have the code handy currently but you basically set the header mimetype to either your filetype or application/octed stream, then pass down the content length (this is important because otherwise our all beloved IE has some problems on certain filetypes) and then you basically pass the stream as content down as embedded binary data. You also can achieve that with a phaselistener if you feel uneasy to do it over a separate servlet. All you then have to do is to link to the servlet or phase listener with a linke and a target=_new Werner [EMAIL PROTECTED] wrote: I have nearly the same problem: I have the link of a sample file (pdf, doc or something else) in the database. Now the user should have the possibility to open this file via a CommandButton or CommandLink I'm not quite sure, how I can do this? Thx for help
Re: SelectOneCountry, skip validation?
For simple situations (like only one occurrance of the above on a page), you can just set the UICommand and the UIInput components both to immediate=true Just remember that you're not skipping the validation phase. You're short-circuiting the lifecycle before validation gets executed, so it goes Restore View - Apply Values - process immediate values and actions - Render Response There's no process-validation, update-model, or invoke-app phases executed. -Mike On 10/25/05, Bruno Aranda [EMAIL PROTECTED] wrote: Dave, take a look at http://wiki.apache.org/myfaces/SubmitPageOnValueChange , you can click a hidden button with the immediate attribute set to true, Regards, Bruno 2005/10/25, Dave [EMAIL PROTECTED]: The form is not submitted by clicking a button, but using event onchange. Santiago, Ray [EMAIL PROTECTED] wrote: You've answered your own question set the immediate=true property on the submit button. I do this on our signon page where a username/password is mandatory, and yet I need a link to let the user create a signon. From: Dave [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 25, 2005 3:11 PM To: users@myfaces.apache.org Subject: SelectOneCountry, skip validation? I have a form, let user input address information: t:selectOneCountry maxLength=25 onchange=this.form.submit(); / Once user selects country, the state selection changes based on the country selected. The form can be incomplete when user selects country, but the validation is in the execution path on the server side when submitting the form by changing the country. How to skip the validation when users select a country? For command link, immediate=true can be used. Thanks, Dave Yahoo! FareChase - Search multiple travel sites in one click. This electronic message transmission contains information from the Company that may be proprietary, confidential and/or privileged. The information is intended only for the use of the individual(s) or entity named above. If you are not the intended recipient, be aware that any disclosure, copying or distribution or use of the contents of this information is prohibited. If you have received this electronic transmission in error, please notify the sender immediately by replying to the address listed in the From: field. Yahoo! FareChase - Search multiple travel sites in one click.
RE: AW: FileDownload capability?
Yes, well I can certainly understand why setting content length to zero (as was the case in in the link you sent) would be problematic. Thanks for your help! - Brendan -Original Message- From: Mike Kienenberger [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 25, 2005 2:49 PM To: MyFaces Discussion Subject: Re: AW: FileDownload capability? It depends on the browser and container, but ignore it at your own risk. The safest solution is to set the content length to the exact size before writing any data to the response. If the data is being computed on the fly, then write your data to a ByteArrayOutputStream first, then use byte data[] = ByteArrayOutputStream.toByteArray() to get something to send to the response. Here's an example of what might happen if you don't. http://lists.samba.org/archive/jcifs/2003-May/002188.html On 10/25/05, CONNER, BRENDAN (SBCSI) [EMAIL PROTECTED] wrote: In earlier examples, one had to call response.setContentLength() with the number of bytes being passed. I have the following questions regarding this: 1. What are the consequences if I get the length wrong? Does it have to be exact? 2. Can the setContentLength() be called after I have done all the writes, or must it be done before the writes? If I can call it beforehand, then I can compute the length as I go. Otherwise, it will be more difficult. Thanks, - Brendan -Original Message- From: CONNER, BRENDAN (SBCSI) Sent: Tuesday, October 25, 2005 12:15 PM To: 'MyFaces Discussion' Subject: RE: AW: FileDownload capability? And it's even easier if one is generating a text file (rather than a binary file), for example, when writing out a comma-separated file for use in a spreadsheet, since one can use response.getWriter().print(String s) and response.getWriter().println(String s). - Brendan -Original Message- From: Nico Krijnen [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 25, 2005 3:00 AM To: 'MyFaces Discussion' Cc: [EMAIL PROTECTED] Subject: RE: AW: FileDownload capability? It is actualy much easier in JSF. You just need to have an action method in a (managed) bean, like this: public String downloadFile() { FacesContext facesContext = FacesContext.getCurrentInstance(); if (!facesContext.getResponseComplete()) { String fileName = myfile.pdf; ServletContext servletContext = (ServletContext) facesContext.getExternalContext().getContext(); String contentType = servletContext.getMimeType(fileName); HttpServletResponse response = (HttpServletResponse) facesContext.getExternalContext().getResponse(); response.setContentType(contentType); response.setHeader(Content-Disposition, attachment;filename=\ + fileName + \); try { InputStream in = /* get your data */; ServletOutputStream out = response.getOutputStream(); byte[] buf = new byte[512]; int bytesRead; while ((bytesRead = in.read(buf, 0, bufSize)) != -1) { out.write(buf, 0, bytesRead); } out.flush(); facesContext.responseComplete(); } catch (IOException e) { throw new RuntimeException(e); } } return null; } Then you can simply call the method from a commandLink or commandButton h:commandLink action=#{yourBean.downloadFile} h:outputText value=download / /h:commandLink Nico -Oorspronkelijk bericht- Van: news [mailto:[EMAIL PROTECTED] Namens Werner Punz Verzonden: maandag 24 oktober 2005 23:34 Aan: users@myfaces.apache.org Onderwerp: Re: AW: FileDownload capability? It is rather easy, I usually have a download servlet for this which generates the appropriate html code, I do not have the code handy currently but you basically set the header mimetype to either your filetype or application/octed stream, then pass down the content length (this is important because otherwise our all beloved IE has some problems on certain filetypes) and then you basically pass the stream as content down as embedded binary data. You also can achieve that with a phaselistener if you feel uneasy to do it over a separate servlet. All you then have to do is to link to the servlet or phase listener with a linke and a target=_new Werner [EMAIL PROTECTED] wrote: I have nearly the same problem: I have the link of a sample file (pdf, doc or something else) in the database. Now the user should have the possibility to open this file via a CommandButton or CommandLink I'm not quite sure, how I can do this? Thx for help
Re: Comparable validation design
I've put an initial version of this validator at the following URL (manually constructed since the link isn't active yet -- may have typos). http://cvs.sourceforge.net/viewcvs.py/jsf-comp/componentsandbox/src/java/org/apache/myfaces/custom/comparetovalidator/CompareToValidator.java It'll probably take a little time for the link to become active, so you might have better luck grabbing it from jsf-comp cvs directly. Make sure to get at least Revision: 1.2 as I added the documentation in that revision. I can also email it to anyone who wants it. On 10/25/05, Jesse Alexander (KBSA 21) [EMAIL PROTECTED] wrote: -Original Message- 1) What should happen if the compared values do not implement Comparable and no Comparable is provided? Right now, it's passively passing validation. I wonder if it should throw a FacesException (not ValidationException) instead? -Original Message- FacesException. We could try to catch it already in the tag, but for safety, throw the exception during validation. -Original Message- 2) If either the foreign component value or the parent component value are null, perform no validation? This is going to happen by default if the parent component value is null since JSF won't execute validators in that case. We can't validate if: a) value is null and foreign value is null b) value is null and foreign value is not null. We could try to validate if c) value is not null and foreign value is null d) value is not null and foreign value is not null For consistency, I'd say we'd do the same thing for the foreign key, and only try to validate for case d). -Original Message- +1: only d) should be validated regards Alexander
Re: curious problem with dates
Yes, it's the same problem as the thread from a few days back with headache in the subject (which is a very fitting subject I might add). I have to deal with this same problem so I think I'll probably just end up making a component that extends the normal DateTimeConverter and acts like would be expected. Maybe a sandbox candidate if others are interested? TravisOn 10/25/05, Simon Kitching [EMAIL PROTECTED] wrote: Francesco Consumi wrote: Hi all, since I replaced myfaces-all.jar from 1.1.0 with 1.1.1rc3, I noticed a strange problem with JSF and date fields: every date printed with jsf tag is printed as day *before* . if I have a date in the bean: Date d = new java.util.date(2005, 02, 01) and I write in page: % out.print(bean.d); % I obtain Tue 01 Feb 2005, 00:00:00 CEST If I use h:outputText value=#{bean.d} / I obtain 31-jan-05 and the same result with every JSF tag ? same problem with times. every time is represented as the hour before; 12.00 instead of 13.00 . From other emails on this list I gather that in order to be compatiblewith the Sun specification for JSF, dates now default to GMT timezone.That seems to match what you are seeing. I suggest searching the email archives for further details.Regards,Simon
Re: Finding a component with a specific id
Kirchgessner, Lisa wrote: Have you tried putting the colSelector after the datatable? It sounds like the view does not yet contain the table. I thought myFaces had similar issues with the DataScroller in ealier versions (maybe still do). Maybe take a look on how they handled? Of course, just a guess. And a very good guess it was too. The old JSF/JSP problem of components being created and rendered in the same pass. Thanks! Oh how I wish we were using Facelets! Cheers, Simon
User defined message for component
Hello I would like to use my own error message I use h:message for=nickname h:inputText id=nickname value=#{Register.nickname} required=true size=10 maxlength=24/ h:message for=nickname/ This generates the error message nickname: Value is required. I would like to replace this with my own message. My recipe: 1) In faces-config.xml config file I have the entry faces-config application message-bundleorg.partneragency.web.validatormessage/message-bundle /application ... /faces-config 2) In validatormessage.properties I add the entry nickname=nickname must be set This does not work.
Re: User defined message for component
This is guesswork, but I came across message keys in the JSF 1.2 spec earlier today. I think you might be able to use this entry instead: javax.faces.component.UIInput.REQUIRED={0} must be set The original value was javax.faces.component.UIInput.REQUIRED={0}: Validation Error: Value is required Unfortunately, the ability to specify required message keys at the tag level (requiredMessage=.) isn't available until JSF 1.2. Also note that you can define h:outputLabel for=nickname h:outputText value=nickname/ /h:outputLabel and whatever the value of the outputLabel is will be used for {0} in your message key. This is probably more useful when the id can't contain the display value (ie, Last Name instead of lastname). -Mike On 10/25/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hello I would like to use my own error message I use h:message for=nickname h:inputText id=nickname value=#{Register.nickname} required=true size=10 maxlength=24/ h:message for=nickname/ This generates the error message nickname: Value is required. I would like to replace this with my own message. My recipe: 1) In faces-config.xml config file I have the entry faces-config application message-bundleorg.partneragency.web.validatormessage/message-bundle /application ... /faces-config 2) In validatormessage.properties I add the entry nickname=nickname must be set This does not work.
DataTable Problem
We're experiencing a problem using a commandLink (or commandButton) inside a dataTable. We're hoping that it's just something we're doing wrong. If we copy the commandLink outside the dataTable (just as a test), and then click on the commandLink outside the dataTable, then control goes to the desired page. However, if we click on the commandLink that is inside the table, the same page gets displayed (with an empty table). Here is the JSP code: t:commandLink action=displayHome title=Skill Id styleClass=commandLinkHomePage h:outputText value=test styleClass=link/ /t:commandLink t:dataTable value=#{maintainSkillBean.skillList} var=element headerClass=reportHeader columnClasses=reportDetailLeft cellpadding=2 cellspacing=2 t:column f:facet name=header h:outputText value=Skill Id/ /f:facet t:commandLink action=displayHome title=Skill Id styleClass=commandLinkHomePage h:outputText value=#{element.skillId} styleClass=link/ /t:commandLink /t:column /t:dataTable Any clues about why clicking the first commandLink would correctly bring us to the home page, whereas clicking the second commandLink would just redisplay the current page? We have t:messages up top, and no error messages are getting displayed. - Brendan P.S. We tried this with both 1.1.1RC2 and 1.1.1RC3, and we're getting the same result. We also tried using both t:dataTable and h:dataTable, but still no luck.
Thorsten Knoll/ITK/ZGD/Germany/Zurich ist außer Haus.
Ich werde ab 26.10.2005 nicht im Büro sein. Ich kehre zurück am 31.10.2005. Ich werde Ihre Nachricht nach meiner Rückkehr beantworten.
RE: How to handle double posting problems
I found the cause of problems. It wasnt Myfaces after all. It got something to do with hibernate auto-flushing in conjunction with the long session pattern. Once I turned it off everything works fine. Regards, Yee From: Yee CN [mailto:[EMAIL PROTECTED] Sent: Wednesday, 26 October 2005 1:19 AM To: 'MyFaces Discussion' Subject: How to handle double posting problems Hi, I am new to jsf and just beginning to put together some pages. I am playing with a form that has an event listener on a selection list, the form refreshes depending on the selection. I discovered that if I click too fast jsf will throw the following exception: 01:07:42,794 ERROR [FacesServlet]:253 - Servlet.service() for servlet FacesServlet threw exception javax.faces.el.EvaluationException: Cannot get value for _expression_ '#{userBean.userIdsList}' What is the best way to handle this situation? Many thanks in advance. Yee