[TRINIDAD] - Strange behaviour with NumberConverter
Hi, I'm facing a strange issue with NumberConverter on the client side in Apache Trinidad. On one side, using my local dev machine, everything works as expected; i.e. all the values entered by the user are converted to number/currency depending on how they're configured (for example, let's say it's currency, so the user enters 12 in the text box and it gets converted to 12,00 €). However, I just deployed the WAR file to a remote server and the behavior is really weird: when the user enters something in the same text boxes, let's say 12, the following messages appears: Cannot convert 12 of type class java.math.BigDecimal to class java.lang.Number As explained, both environments are similar (same JDK 1.6, same Tomcat, same WAR file), but locally is working fine and remotely looks like not. Even more funny is the fact that although you get the error message, the value is finally converted to currency, for example, so in the text box I end up having the proper converted value -- 12,00 € Anyone has a clue on what could be happening here? Apparently it's only working for me locally using my MacBook Pro with JDK 1.6 and Tomcat 6.0.x. BTW, this is Apache Trinidad 1.2.10. Thanks.
Re: [TRINIDAD] - Change tab in panelTabbed using a button
Thanks Matt, but finally I went the easy way using JS: tr:commandButton text=Next partialSubmit=true onclick=document.getElementById('tab2').onclick()/ On Wed, Jan 7, 2009 at 9:57 PM, Matt Cooper mcoo...@apache.org wrote: I imagine that your Java code will look something like this (do this for each showDetailItem in the panelTabbed): FacesBean facesBean = showDetailItem.getFacesBean(); FacesBean.Type type = facesBean.getType(); PropertyKey disclosedKey = type.findKey(disclosed); if (disclosedKey != null) { facesBean.setProperty(disclosedKey, newDisclosedState); } Regards, Matt On Wed, Jan 7, 2009 at 1:21 PM, Enrique Medina Montenegro e.medin...@gmail.com wrote: Thanks, I'll go for the binding approach then. On Wed, Jan 7, 2009 at 5:35 PM, Andrew Robinson andrew.rw.robin...@gmail.com wrote: Unfortunately, the best way is to use component binding of the tab component to a bean and update the disclosed properties of the children show details manually. The other way is to use JavaScript on the client to manually fire a click event of the desired anchor element (tab) from the button, but this is not the JSF way, but more of a hack. -Andrew On Wed, Jan 7, 2009 at 9:09 AM, Enrique Medina Montenegro e.medin...@gmail.com wrote: But how would I set that property from the button? Through an actionListener and then finding the component in the ViewRoot? Is there any way to mimic the exact behaviour as when you click the tab itself? Thanks. On Wed, Jan 7, 2009 at 4:41 PM, Walter Mourão walter.mou...@gmail.com wrote: You can use the disclosed property in showDetailItem to show/hide its content. Walter Mourão http://waltermourao.com.br http://arcadian.com.br http://oriens.com.br On Wed, Jan 7, 2009 at 1:22 PM, Enrique Medina Montenegro e.medin...@gmail.com wrote: Hi, I'm using a panelTabbed component, and I would like to allow the user to change between the tabs not only by clicking the tab itself, but also using a button in order to simulate a wizard, let's say. Let me put an example. Imagine we have a 3 tabs panelTabbed component, so in the content for the first tab I define a button (NEXT), then in the second tab's content I define two buttons (PRIOR and NEXT), and finally in the last tab I define another two buttons (PRIOR and SUBMIT). What would the code be to simulate clicking on the tab itself but from a button click? Thanks.
[TRINIDAD] - Change tab in panelTabbed using a button
Hi, I'm using a panelTabbed component, and I would like to allow the user to change between the tabs not only by clicking the tab itself, but also using a button in order to simulate a wizard, let's say. Let me put an example. Imagine we have a 3 tabs panelTabbed component, so in the content for the first tab I define a button (NEXT), then in the second tab's content I define two buttons (PRIOR and NEXT), and finally in the last tab I define another two buttons (PRIOR and SUBMIT). What would the code be to simulate clicking on the tab itself but from a button click? Thanks.
Re: [TRINIDAD] - Change tab in panelTabbed using a button
But how would I set that property from the button? Through an actionListener and then finding the component in the ViewRoot? Is there any way to mimic the exact behaviour as when you click the tab itself? Thanks. On Wed, Jan 7, 2009 at 4:41 PM, Walter Mourão walter.mou...@gmail.comwrote: You can use the disclosed property in showDetailItem to show/hide its content. Walter Mourão http://waltermourao.com.br http://arcadian.com.br http://oriens.com.br On Wed, Jan 7, 2009 at 1:22 PM, Enrique Medina Montenegro e.medin...@gmail.com wrote: Hi, I'm using a panelTabbed component, and I would like to allow the user to change between the tabs not only by clicking the tab itself, but also using a button in order to simulate a wizard, let's say. Let me put an example. Imagine we have a 3 tabs panelTabbed component, so in the content for the first tab I define a button (NEXT), then in the second tab's content I define two buttons (PRIOR and NEXT), and finally in the last tab I define another two buttons (PRIOR and SUBMIT). What would the code be to simulate clicking on the tab itself but from a button click? Thanks.
Re: [TRINIDAD] - Change tab in panelTabbed using a button
Thanks, I'll go for the binding approach then. On Wed, Jan 7, 2009 at 5:35 PM, Andrew Robinson andrew.rw.robin...@gmail.com wrote: Unfortunately, the best way is to use component binding of the tab component to a bean and update the disclosed properties of the children show details manually. The other way is to use JavaScript on the client to manually fire a click event of the desired anchor element (tab) from the button, but this is not the JSF way, but more of a hack. -Andrew On Wed, Jan 7, 2009 at 9:09 AM, Enrique Medina Montenegro e.medin...@gmail.com wrote: But how would I set that property from the button? Through an actionListener and then finding the component in the ViewRoot? Is there any way to mimic the exact behaviour as when you click the tab itself? Thanks. On Wed, Jan 7, 2009 at 4:41 PM, Walter Mourão walter.mou...@gmail.com wrote: You can use the disclosed property in showDetailItem to show/hide its content. Walter Mourão http://waltermourao.com.br http://arcadian.com.br http://oriens.com.br On Wed, Jan 7, 2009 at 1:22 PM, Enrique Medina Montenegro e.medin...@gmail.com wrote: Hi, I'm using a panelTabbed component, and I would like to allow the user to change between the tabs not only by clicking the tab itself, but also using a button in order to simulate a wizard, let's say. Let me put an example. Imagine we have a 3 tabs panelTabbed component, so in the content for the first tab I define a button (NEXT), then in the second tab's content I define two buttons (PRIOR and NEXT), and finally in the last tab I define another two buttons (PRIOR and SUBMIT). What would the code be to simulate clicking on the tab itself but from a button click? Thanks.
Re: Shale, Spring Tiger Annotations
Umm, I see.I found something like this in one post, but seems that for Spring 2.0 is no longer valid: bean id=newWidget class=model.Widget singleton=false jsf:scope=request/Any idea?On 7/5/06, Craig McClanahan [EMAIL PROTECTED] wrote: On 7/4/06, Enrique Medina Montenegro [EMAIL PROTECTED] wrote: Craig,So in the documentation at the web site regarding Shale-Spring integration, when you show this example:or as a Spring bean in /WEB-INF/applicationContext.xml: bean id=domainsclass=com.mycompany.mypackage.MyDomainsImplsingleton=true... configuration of managed properties ... /bean What would be the scope for that JSF bean then?The technically correct answer is none of the above :-)The more helpful answer is to understand that singleton=true in a Spring configuration file means the bean will be created only once per application ... which is similar in *effect* to storing it in application scope (you only get one copy), but it isn't actually placed into application scope. If you said singleton=false instead, this would correspond exactly to a managed bean scope of none ... meaning a new instance would be created every time you asked for it. Craig On 7/4/06, Craig McClanahan [EMAIL PROTECTED] wrote: On 7/4/06, Enrique Medina Montenegro [EMAIL PROTECTED] wrote: Hi,I'm starting a new development where I will use MyFaces together with Shale and Spring. I've been reading the documentation regarding the integration between Spring and Shale, in terms of the delegating VariableResolver. Furthermore, I've been reading the documentation regarding Tiger extensions for Shale. So the point is I want to use both the Spring integration and the Tiger extensions for the same purpose: get my JSF managed beans.And here comes the question. Is it possible to combine both the @Bean annotation and the definition of the bean in the applicationContext.xml from Spring? The reason for this question is very simple, and maybe there's a workaround for it without having to use both functionalities all together: I would like to define all my beans within Spring's applicationContext.xml, but I don't know how to indicate the scope for those beans, so I was wondering whether the use in conjunction with the @Bean(name=Bean scope=Scope.REQUEST) annotation would help to achieve the desired result. Currently this combination will not do what you want ... the @Bean annotation focuses only on replacing declarations in a faces-config.xml file (and, implicitly, replacing declarations in applicationContext.xml as well). To get what you're after, I would look at a couple of different things:* There's a spring-jsf extensions project at SourceForge that implies it can store Spring beans into a specified scope (I haven't actually tried this one). * Spring 2 is supposed to have this feature, as part of its JSF integration, out of the box.Craig Thanks.
Re: Shale, Spring Tiger Annotations
Found this thread in the Spring forum:http://forum.springframework.org/showthread.php?t=26302highlight=scope On 7/5/06, Craig McClanahan [EMAIL PROTECTED] wrote: On 7/5/06, Enrique Medina Montenegro [EMAIL PROTECTED] wrote: Umm, I see.I found something like this in one post, but seems that for Spring 2.0 is no longer valid: bean id=newWidget class=model.Widget singleton=false jsf:scope=request/Any idea?Hmm ... sounds like a good question to ask on the Spring forum. The reference manual for Spring 2 talks about using the new generalized support for scopes as being applicable here as well, but I can't seem to find any specific references with respect to web application scopes. Need to look at the Spring 2 sample apps as well (although it sounds like the kids next door *finally* ran out of fireworks, so maybe this will need to wait until tomorrow :-). Craig On 7/5/06, Craig McClanahan [EMAIL PROTECTED] wrote: On 7/4/06, Enrique Medina Montenegro [EMAIL PROTECTED] wrote: Craig,So in the documentation at the web site regarding Shale-Spring integration, when you show this example:or as a Spring bean in /WEB-INF/applicationContext.xml: bean id=domainsclass=com.mycompany.mypackage.MyDomainsImplsingleton=true... configuration of managed properties ... /bean What would be the scope for that JSF bean then?The technically correct answer is none of the above :-)The more helpful answer is to understand that singleton=true in a Spring configuration file means the bean will be created only once per application ... which is similar in *effect* to storing it in application scope (you only get one copy), but it isn't actually placed into application scope. If you said singleton=false instead, this would correspond exactly to a managed bean scope of none ... meaning a new instance would be created every time you asked for it. Craig On 7/4/06, Craig McClanahan [EMAIL PROTECTED] wrote: On 7/4/06, Enrique Medina Montenegro [EMAIL PROTECTED] wrote: Hi,I'm starting a new development where I will use MyFaces together with Shale and Spring. I've been reading the documentation regarding the integration between Spring and Shale, in terms of the delegating VariableResolver. Furthermore, I've been reading the documentation regarding Tiger extensions for Shale. So the point is I want to use both the Spring integration and the Tiger extensions for the same purpose: get my JSF managed beans.And here comes the question. Is it possible to combine both the @Bean annotation and the definition of the bean in the applicationContext.xml from Spring? The reason for this question is very simple, and maybe there's a workaround for it without having to use both functionalities all together: I would like to define all my beans within Spring's applicationContext.xml, but I don't know how to indicate the scope for those beans, so I was wondering whether the use in conjunction with the @Bean(name=Bean scope=Scope.REQUEST) annotation would help to achieve the desired result. Currently this combination will not do what you want ... the @Bean annotation focuses only on replacing declarations in a faces-config.xml file (and, implicitly, replacing declarations in applicationContext.xml as well). To get what you're after, I would look at a couple of different things:* There's a spring-jsf extensions project at SourceForge that implies it can store Spring beans into a specified scope (I haven't actually tried this one). * Spring 2 is supposed to have this feature, as part of its JSF integration, out of the box.Craig Thanks.
Re: Shale, Spring Tiger Annotations
But if I just define my beans with scope=request or scope=session, then I get an IllegalStateException :-(org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'gestorMenuBean' defined in class path resource [com/sabini/librisuite/sabiniContext.xml]: Initialization of bean failed; nested exception is java.lang.IllegalStateException: No Scope registered for scope 'session'Caused by: java.lang.IllegalStateException: No Scope registered for scope 'session' at org.springframework.beans.factory.support.AbstractBeanFactory.getBean (AbstractBeanFactory.java:285) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:168) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference (BeanDefinitionValueResolver.java:226) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:115) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues (AbstractAutowireCapableBeanFactory.java:798) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:589) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean (AbstractAutowireCapableBeanFactory.java:389) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:257) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean (AbstractBeanFactory.java:168) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:254) at org.springframework.context.support.AbstractApplicationContext.refresh (AbstractApplicationContext.java:332) at org.springframework.context.support.ClassPathXmlApplicationContext.init(ClassPathXmlApplicationContext.java:92) at org.springframework.context.support.ClassPathXmlApplicationContext .init(ClassPathXmlApplicationContext.java:77) at org.springframework.test.AbstractSpringContextTests.loadContextLocations(AbstractSpringContextTests.java:130) at org.springframework.test.AbstractDependencyInjectionSpringContextTests.loadContextLocations (AbstractDependencyInjectionSpringContextTests.java:224) at org.springframework.test.AbstractSpringContextTests.getContext(AbstractSpringContextTests.java:110) at org.springframework.test.AbstractDependencyInjectionSpringContextTests.setUp (AbstractDependencyInjectionSpringContextTests.java:192) at junit.framework.TestCase.runBare(TestCase.java:125) at org.springframework.test.ConditionalTestCase.runBare(ConditionalTestCase.java:69) at junit.framework.TestResult$1.protect(TestResult.java:106) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.framework.TestResult.run(TestResult.java:109) at junit.framework.TestCase.run (TestCase.java:118) at junit.framework.TestSuite.runTest(TestSuite.java:208) at junit.framework.TestSuite.run(TestSuite.java:203) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java :478) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196) On 7/5/06, Enrique Medina Montenegro [EMAIL PROTECTED] wrote: Found this thread in the Spring forum:http://forum.springframework.org/showthread.php?t=26302highlight=scope On 7/5/06, Craig McClanahan [EMAIL PROTECTED] wrote: On 7/5/06, Enrique Medina Montenegro [EMAIL PROTECTED] wrote: Umm, I see.I found something like this in one post, but seems that for Spring 2.0 is no longer valid: bean id=newWidget class=model.Widget singleton=false jsf:scope=request/Any idea?Hmm ... sounds like a good question to ask on the Spring forum. The reference manual for Spring 2 talks about using the new generalized support for scopes as being applicable here as well, but I can't seem to find any specific references with respect to web application scopes. Need to look at the Spring 2 sample apps as well (although it sounds like the kids next door *finally* ran out of fireworks, so maybe this will need to wait until tomorrow :-). Craig On 7/5/06, Craig McClanahan [EMAIL PROTECTED] wrote: On 7/4/06, Enrique Medina Montenegro [EMAIL PROTECTED] wrote: Craig,So in the documentation at the web site regarding Shale-Spring integration, when you show this example:or as a Spring bean in /WEB-INF/applicationContext.xml: bean id=domainsclass=com.mycompany.mypackage.MyDomainsImplsingleton=true... configuration of managed properties ... /bean What would be the scope for that JSF bean then?The technically correct answer is none of the above :-)The more helpful answer is to understand that singleton=true in a Spring configuration file means the bean will be created only once per application ... which is similar in *effect* to storing
Shale, Spring Tiger Annotations
Hi,I'm starting a new development where I will use MyFaces together with Shale and Spring. I've been reading the documentation regarding the integration between Spring and Shale, in terms of the delegating VariableResolver. Furthermore, I've been reading the documentation regarding Tiger extensions for Shale. So the point is I want to use both the Spring integration and the Tiger extensions for the same purpose: get my JSF managed beans.And here comes the question. Is it possible to combine both the @Bean annotation and the definition of the bean in the applicationContext.xml from Spring? The reason for this question is very simple, and maybe there's a workaround for it without having to use both functionalities all together: I would like to define all my beans within Spring's applicationContext.xml, but I don't know how to indicate the scope for those beans, so I was wondering whether the use in conjunction with the @Bean(name=Bean scope=Scope.REQUEST) annotation would help to achieve the desired result. Thanks.
Re: AUTO_SCROLL Kills Command Links
Me too :-(On 6/16/06, Raj Rajendran [EMAIL PROTECTED] wrote: I have also brought this issue up before, still have it with 1.1.4 Snapshot. On 6/16/06, Mike Duffy [EMAIL PROTECTED] wrote: This issue has been brought up in multiple posts to this list.I am using MyFaces Core 1.1.3 and Tomahawk 1.1.3 (latest and greatest for both).When I configure AUTO_SCROLL to true, the command links do not function. Mike__Do You Yahoo!?Tired of spam?Yahoo! Mail has the best spam protection around http://mail.yahoo.com
GetScrolling
Hi,Is anyone experiencing difficulties with the getScrolling() JS function for Tomahawk 1.1.3? I upgraded since I needed to solve the problem with the DummyForm stuff, but then got this new problem.Any clues? As a workaround, I've just disabled scrolling in the web.xmlThanks.
Partial rendering with Ajax
Hi,I'm a frustrated user of Ajaxanywhere and Ajax4Jsf projects. I managed to use Ajaxanywhere for a while, but once I've upgraded to the new official release for MyFaces and Tomahawk, it does not work anymore (and I needed to upgrade to take advantage of the new AddResource stuff and some other improvements in terms of performance). So, guys, does anyone know of a really working solution to partial page rendering using Ajax?Thanks.
Re: Partial rendering with Ajax
Matthias,I was precisely discussing the use of ADF Faces with Werner yesterday. Do you think I could integrate ADF Faces to an already finished project to give partial page rendering support? On 6/1/06, Matthias Wessendorf [EMAIL PROTECTED] wrote: You may check ADF Faces.Donated to the ASF. Currently under incubation.Regards,MatthiasOn 6/1/06, Enrique Medina [EMAIL PROTECTED] wrote: Hi, I'm a frustrated user of Ajaxanywhere and Ajax4Jsf projects. I managed to use Ajaxanywhere for a while, but once I've upgraded to the new official release for MyFaces and Tomahawk, it does not work anymore (and I needed to upgrade to take advantage of the new AddResource stuff and some other improvements in terms of performance). So, guys, does anyone know of a really working solution to partial page rendering using Ajax? Thanks.--Matthias WessendorfAechterhoek 1848282 Emsdettenblog: http://jroller.com/page/mwessendorfmail: mwessendorf-at-gmail-dot-com
Re: Partial rendering with Ajax
And most important... have you used it successfully?On 6/1/06, Matthias Wessendorf [EMAIL PROTECTED] wrote: You may check ADF Faces.Donated to the ASF. Currently under incubation.Regards, MatthiasOn 6/1/06, Enrique Medina [EMAIL PROTECTED] wrote: Hi, I'm a frustrated user of Ajaxanywhere and Ajax4Jsf projects. I managed to use Ajaxanywhere for a while, but once I've upgraded to the new official release for MyFaces and Tomahawk, it does not work anymore (and I needed to upgrade to take advantage of the new AddResource stuff and some other improvements in terms of performance). So, guys, does anyone know of a really working solution to partial page rendering using Ajax? Thanks.--Matthias Wessendorf Aechterhoek 1848282 Emsdettenblog: http://jroller.com/page/mwessendorfmail: mwessendorf-at-gmail-dot-com
Re: Partial rendering with Ajax
Well, it was just a how do you think I can do this partial ;-)Never tried; that's why I ask about your experience in successfully applying itOn 6/1/06, Matthias Wessendorf [EMAIL PROTECTED] wrote: I was precisely discussing the use of ADF Faces with Werner yesterday. Do you think I could integrate ADF Faces to an already finished project to give partial page rendering support?Would be fun, if such discussions take place at the ADF Faces list, so you can share your pro/con arguments :-)-Matthias
Re: Handling and displaying action errors
Hi Aleksei,You can do it easily and in a centralized manner using an extension of the default action listener. Here, all exceptions thrown by actions are captured, so you can plug your own exception handling logic ;-) Regards.On 5/26/06, Aleksei Valikov [EMAIL PROTECTED] wrote: Hi.In JSF, validating fields works like a sharm. A validator checks the value andqueues a message if anything's wrong. The message is the displayed by theh:message/h:messages tags/handlers within the page. My question is - what is the analogue for this for actions? Imagine I have anaction like delete document and when invoked it fails for some reason. Howcould I diagnose and handle the problem? For instance, if I get a DocumentNotExistsException, I know it's no the end of the days, I just have toqueue a documentNotExsists message which would then be displayed in the page.But how does this work programmatically? Thank you for your time.Bye./lexi
MyFaces and Axis
Hi,Don't know exactly if the root of my problem comes from MyFaces, but have you ever deployed one Axis web service together with your JSF web application? I need to do so in order to be able to use Spring objects from my WS implementation. But if I create a simple TestCase to test the WS, then I get the following stack trace:Caused by: org.apache.jasper.JasperException: ContentTypeList does not contain a supported content type: application/soap+xml, application/dime, multipart/related, text/* at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:372) 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:802) 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:704) at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java :476) at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:409) at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:312) at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch (ServletExternalContextImpl.java:415) ... 28 moreHowever, if I deploy the WS directly to the Axis web application (not to my JSF application), everything works like a charm!Any idea of what could be happening? I can't understand why that exception is being thrown, as the response is set to text/xml which should match the content text/* in the ContentTypeList... Thanks,Enrique Medina.
Re: Need to use Spring
Hi,I totally agree with Fintan. The question would be whether to use frameworks on top of JSF, rather than be worried about the business part of your application. Remember JSF is a presentation MVC framework, so it can be used in conjunction with ANY business solution (call it Spring, Hibernate, JDO, JPA, EJBs, etc.). Regarding those complementary frameworks for JSF, take a look at Shale, Facelets, ADF Components, security issues like Acegi (requires Spring), etc ;-)Hope it helps.Regards,Enrique Medina. On 5/5/06, Conway. Fintan (IT Solutions) [EMAIL PROTECTED] wrote: Hi,I use JSF, but I do not use Spring at all in my applications.I use JDOto persist my objects to the database, but can use any databasetechnology - including writing the JDBC code yourself, instead of Hibernate.The good thing about Java is that you have a wide choice as to whattechnologies to use.Spring, JPox (my choice of JDO technology),Hibernate, Ibatis and many, many more frameworks are available - if you want to use them.If you are learning one technology e.g. JSF, you mayfind it easier to not use any other frameworks until you are confidentin that technology.Then you could look at adding another framework, e.g. JDO to store/retrieve data from the database.This way you areonly looking at one new technology at a time.If you tried to startfrom scratch and learn 3 or 4 technologies at once you are bound to find yourself very confused.In short JSF does not require you to use any other technologies.HTH,Fintan-Original Message-From: 101questionjsf [mailto: [EMAIL PROTECTED]]Sent: 05 May 2006 10:21To: users@myfaces.apache.orgSubject: Need to use SpringCurrently I'm using JSF myfaces, do I need to use Spring + Hibernate? Find them quite complex to use...--View this message in context:http://www.nabble.com/Need-to-use-Spring-t1562778.html#a4244067 Sent from the MyFaces - Users forum at Nabble.com.* ** *** ** * ** *** ** * ** *** ** *This email and any files transmitted with it are confidential andintended solely for the use of the individual or entity to whom they are addressed.Any views or opinions presented are solely those of the author, and do not necessarilyrepresent those of ESB.If you have received this email in error please notify the sender.Although ESB scans e-mail and attachments for viruses, it does not guarantee that either are virus-free and accepts no liability for any damage sustainedas a result of viruses.* ** *** ** * ** *** ** * ** *** ** *
Re: Rumba - MyFaces-based application framework
Hi Alexey,What happened to your web?http://www.rumbaframework.orgOn 4/4/06, Alexey Maslov [EMAIL PROTECTED] wrote:Werner, Thanx a lot for clear and useful answer :).--- Werner Punz [EMAIL PROTECTED] wrote: Alexey Maslov schrieb: I'd add one more question - is session-per-conversation approach suitable for shopping cart scenario: ShoppingCart instance lives for the application lifespan and persistent objects (say ProductItem) are added and removed? I'm asking because we had some problems with session-per-conversation concerning objects that did not have clear conversation boundaries. I cannot clearly say, but to my knowlege you can have multiple conversations. The shopping cart szenario is somewhat different, because this is clearly a case for a session scope and not a limited conversation. So with a shopping cart you are better of with a session.merge instead of keeping the db session open. I only can talk as an outsider here, since I do not have any affiliation with Seam or the jboss guys. the way I see it the opensession in conversation is more suitable for szenarios where you load a set of objects and then do something within the same form or 1-2 subsequent forms, the typical crud szenario. That way you can gain the comfort of statefulness and not having objects out of a session during the lifetime of your use case. But I do not see any reason to have that in a shopping cart, because keeping a session open during the lifetime of a user session is a drain on resources. If you want to do that you do not have to use Seam or a dialog system simply keep an open session in your servlet session and use that one for all db access related stuff. But there is a reason why this approach is not used that often.__Do You Yahoo!?Tired of spam?Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Re: ExceptionHandling with JSF and Tiles
Hi,Why not simply give your own extension of org.apache.myfaces.application.ActionListenerImplso any exception thrown could be catched by your code and FacesMessage or FacesErrors created? Is this what you are trying to achieve?On 4/4/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: We have a rootLayout.jsp I guess this is what you mean by the outer template: Here is the code for it: [EMAIL PROTECTED] errorPage=/error/ErrorHandlerServlet?popup=false %%@ taglib uri=/WEB-INF/tags/myfaces_core.tld prefix=f% %@ taglib uri=/WEB-INF/tags/struts-tiles.tld prefix=tiles% htmlhead%@ page language=java contentType=text/html; charset=ISO-8859-1 pageEncoding=ISO-8859-1%link rel=stylesheet href='' type=text/css/script src=''/scripttitletiles:getAsString name='title' //titleMETA HTTP-EQUIV=Pragma CONTENT=no-cacheMETA HTTP-EQUIV=Expires CONTENT=-1/head f:view f:subview id=subview1tiles:insert attribute=header flush=false//f:subview f:subview id=subview2tiles:insert attribute=body flush=false//f:subview f:subview id=subview3tiles:insert attribute=footer flush=false//f:subview /f:view/html But remember: this was the approach we took almost two years ago, when we first started. What we do now is load our data in controllers, then set the data in the BB manually. Good luck. De: Michael Heinen [mailto:[EMAIL PROTECTED]] Envoyé: mardi 4 avril 2006 09:59À: MyFaces DiscussionObjet: RE: ExceptionHandling with JSF and Tiles Thanks for your answer. I tried this and your points 1) and 2) are working well. But I can't get jsp errors redirected to the error jsp. The ErrorHandlerServlet is called but the content of my error jsp is not displayed in this case. The tiles are still partially rendered and the previous ServletException (s. mail below) is not displayed anymore. Where did you define the errorPage directive ? In the outer tiles layout template or in the various included tiles definitions (e.g. in all content jsps)? Hmm, I tried both and it is not working. Thanks for your help Michael From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Montag, 3. April 2006 19:12To: users@myfaces.apache.orgSubject: RE: ExceptionHandling with JSF and Tiles We had the same problem with exceptions inBB constructors...Our solution was not pretty, but here it is: Yes, the new page was always partially rendered before we could catch the error in time. The suggestions I got from the forum was to simply set the flush directive to false in tiles...but it never worked properly. 1) We created a servlet which simply redirects to a JSP error page. 2) From an error in aBB contructor error - we mapped it to the servlet via web.xml 3) From a jsp parsing error - we used the errorPage directive and mapped it to the same servlet. %@page errorPage= /error/ErrorHandlerServlet % An alternative solution is to use a controller and have the controller execute the code which might generate an exception. (This is what we have decided to do for the future.) We are also interested in alternative solutions. De: Michael Heinen [mailto:[EMAIL PROTECTED]] Envoyé: lundi 3 avril 2006 12:44À: MyFaces DiscussionObjet: RE: ExceptionHandling with JSF and TilesHas anybody a hint? From: Michael Heinen [mailto:[EMAIL PROTECTED]] Sent: Donnerstag, 30. März 2006 09:41To: MyFaces DiscussionSubject: ExceptionHandling with JSF and Tiles Hi all, I am still confused about Exception Handling. I know that this has been discussed on many threads but I don't know how to handle exceptions outside Actions/ActionListeners. My setup is MyFaces 1.1.1 and Tiles with the JspTilesViewHandlerImpl. I can create FacesMessages and forward to any outcome page when an exception occurs in an action/actionListener. This is working fine and no problem. I don't know how to handle serious errors in BackingBean constructors or setters. I tried to catch them and re-throw them as FacesExceptions but my error pages (defined in web.xml) are not displayed. Instead of the error page the original requested tiles template is partly processed. A ServletException is displayed in place of the tiles-part that caused the error. e.g. ServletException in:/xxx.jsp] Cannot get value for _expression_ '#{ABackingBean.aValue}' How do others handle exceptions with myFaces and Tiles? Are there any best practices? Any help would be greatly appreciated. Michael
Re: ajax form
Hi,I'm currently using Ajaxanywhere in my applications, and it's pretty cool. However, the nature of JSF doesn't allow me to use it when the portion to be ajax-refreshed is from a different URL. I have to do some investigations using the FormAction component in the Sandbox, nut in the meantime, would your ajax-form solve this issue? On 3/29/06, ::SammyRulez:: [EMAIL PROTECTED] wrote: it is not in the latest sandbox relese... I'm building it from thesubversion with some pain... I admit.. .;-)2006/3/29, Gerald Müllan [EMAIL PROTECTED]: Heared yes, but never looked at it.. From the impressions i get about it due to discussions on the list, it may be too generic and consequently doesn`t meet all of our requirements for special ajax components (in particular for dojo based stuff). Is this ajax-form stuff from travis the thing you can use? cheers, Gerald On 3/29/06, ::SammyRulez:: [EMAIL PROTECTED] wrote: Thanks... I'm also finding ajaxanywhere very usefull never looked at it? 2006/3/29, Gerald Müllan [EMAIL PROTECTED] : Hi, I know that travis played around with a form post through ajax, the stuff was committed a few days ago. Have a look at the HtmlCommandButtonAjax component in the sandbox (inputAjax). There was also a discussion on the dev list recently, topic Ajax form. If you only mean doing an ajax request after triggering a _javascript_ event, you should use the conveniences of a js framework like dojo and handle the request/response in your components specific js code. cheers, Gerald On 3/29/06, ::SammyRulez:: [EMAIL PROTECTED] wrote:Hi all I'm contemplating the possibility to write an ajax form component thatinstead of posting data to the action url calls a _javascript_ toexecute the work. I'dont want to reinvent the wheel so I started looking at myfacesimplementation of hform but I can't find a good extension point to addstuff to the onSubmit attribute.. Any suggestions? thanks --::SammyRulez:: http://www.kyub.com/blojsom/ -- Gerald Müllan Schelleingasse 2/11 1040 Vienna, Austria 0043 699 11772506 [EMAIL PROTECTED] -- ::SammyRulez:: http://www.kyub.com/blojsom/ -- Gerald Müllan Schelleingasse 2/11 1040 Vienna, Austria 0043 699 11772506 [EMAIL PROTECTED]--::SammyRulez::http://www.kyub.com/blojsom/
Re: how to start jsf ajax
A good start point ;-)http://wiki.apache.org/myfaces/Integrating_AjaxanywhereOn 3/24/06, Krause, Nico [EMAIL PROTECTED] wrote: Hello, i never tried ajax but it seems many people in the list allready use it here and there. so my question is: which library or extension (etc..) i have to try and what's a good thing to start with. Do you have any good hints for me regarding to this topic? What should i learn first? Do you know cool libraries or taglibs? Thanks in advance for shortshouts. Nico Nico Krause|Software Development| TomTom WORK | [EMAIL PROTECTED] | +49 (0)1749891949 mobile | +49(0)34124495-0 office | +49(0)34124495-25 fax | www.tomtomwork.com
Re: Problem using preserveDataModel=true
Maybe a look to this Wiki may help...http://wiki.apache.org/myfaces/Working_With_DataTable_And_PreserveDataModel On 3/7/06, Randy Simon [EMAIL PROTECTED] wrote: I'm sure I am doing something wrong, but I can't figure out what it is.Ihave the following:h:formh:commandButton action="">value=New Property / p/pt:dataTable value=#{dataSourceEditor.dataModel}preserveDataModel=truevar=property border=1h:column h:inputText value=#{property.name} //h:columnh:columnh:outputText value=#{ property.type} /h:inputHidden value=#{property.type} //h:column/t:dataTable/h:formMy dataSourceEditor bean is in request scope and has the following methods. public DataModel getDataModel() {if (dataModel == null) {dataModel = new ListDataModel();}dataModel.setWrappedData(properties);return dataModel; }public void setDataModel(DataModel dm) {dataModel = dm;}public String newProperty() {DSProperty property = new DSProperty();property.setName (new property);property.setType(Property.LONG);if (dataModel != null) {properties = (List) dataModel.getWrappedData();}if (properties == null) { properties = new ArrayList();}properties.add(property);return null;}When I click the new property button I would expect my setDataModel method to be called then the newProperty method to be called where I add anew property to the list. However, when I click on the new propertybutton I get the following class cast exception. java.lang.ClassCastException: javax.faces.model.ListDataModelatorg.apache.myfaces.component.html.ext.HtmlDataTable.updateModelFromPreservedDataModel(HtmlDataTable.java:254)atorg.apache.myfaces.component.html.ext.HtmlDataTable.processUpdates (HtmlDataTable.java:240)at javax.faces.component.UIForm.processUpdates(UIForm.java:196)atjavax.faces.component.UIComponentBase.processUpdates(UIComponentBase.java:927)at javax.faces.component.UIViewRoot.processUpdates (UIViewRoot.java:363)atcom.sun.faces.lifecycle.UpdateModelValuesPhase.execute(UpdateModelValuesPhase.java:81)at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:90)at javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)atweblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run (StubSecurityHelper.java:225)atweblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:127)atweblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java :272)at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)atweblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)atorg.apache.beehive.netui.pageflow.PageFlowPageFilter.runPage (PageFlowPageFilter.java:299)atorg.apache.beehive.netui.pageflow.PageFlowPageFilter.doFilter(PageFlowPageFilter.java:214)atweblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java :42)atorg.apache.shale.faces.ShaleApplicationFilter.doFilter(ShaleApplicationFilter.java:285)atweblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)atcom.bea.p13n.servlets.PortalServletFilter.doFilter (PortalServletFilter.java:329)atweblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)atweblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java :3192)atweblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)atweblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)atweblogic.servlet.internal.WebAppServletContext.securedExecute (WebAppServletContext.java:1984)atweblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:1891)atweblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java :1318)at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)at weblogic.work.ExecuteThread.run(ExecuteThread.java:181)I am completely stumped about why this happens.Thanks in advance for your help.Randy
Re: Can I customize Validation Error Message
Hi Anthony,I think you want to have the exact keys for the messages used by Myfaces by default.If you're using myfaces-all.jar, open it with Winrar or Winzip or whatever zipping tool, and go to javax/faces. You will find several properties files. If you open the Messages.properties, you will find keys for all default messages used by JSF:# standard messages (Spec. 2.5.1.4)javax.faces.component.UIInput.CONVERSION = Conversion Error javax.faces.component.UIInput.CONVERSION_detail = {0}: Conversion error occurred.javax.faces.component.UIInput.REQUIRED = Validation Errorjavax.faces.component.UIInput.REQUIRED_detail = {0}: Value is required. javax.faces.component.UISelectOne.INVALID = Validation Errorjavax.faces.component.UISelectOne.INVALID_detail = {0}: Value is not a valid option.javax.faces.component.UISelectMany.INVALID = Validation Errorjavax.faces.component.UISelectMany.INVALID_detail = {0}: Value is not a valid option.javax.faces.validator.NOT_IN_RANGE = Validation Errorjavax.faces.validator.NOT_IN_RANGE_detail = {2}: Specified attribute is not between the expected values of {0} and {1}.etc..So you can just redefine them in your resource bundle ;-)Regards,Enrique. On 3/6/06, Anthony Hong [EMAIL PROTECTED] wrote: If I write this in this way,h:inputText id=txtDebtorLimit size=20value=#DebtorController.currentDebtor.limit}/ h:message for="" errorClass=error_message/ when error occured, it shows: txtCustomerID Value is required.But I want to change txtCustomerID to support mulit language, itshould fetch value from resource bundle at first.Can I do that?Is that means I have to rewrite all validator in My Faces implementation?--Anthony Hong
Re: Is there a solution in myfaces 1.1.1 to the browser back button problem?
Hi Costa,I managed to solve this problem using a couple of tricks:1) The redirect after post pattern -- Use a redirect/ in all your navigation rules2) Use a _javascript_ history.forward (); at the beginning of each pageRegards,Enrique Medina.On 3/4/06, Costa Basil [EMAIL PROTECTED] wrote:I meant other than saving the state to the client. Costa Basil [EMAIL PROTECTED] wrote: I have the same problem described here:We are still struggling with the back button. I think we�ll reconfigure the app to store all state on the client. Right now, when the user hits Back, none of the links on the page work on the first click. That�s because the RestoreView phase does not find the view in the Session, so it must create a new view. When it creates the new view, it does not bother to process any actions or events�it just skips straight to the rendering phase. From the customer perspective, they hit Back, then have to click twice before the app begins working again. (from http://stuffthathappens.com/blog/2006/01/22/not-fud-just-experience/ ) Enrich your life at Yahoo! Canada Finance Make free worldwide PC-to-PC calls. Try the new Yahoo! Canada Messenger with Voice
Re: JSF - Spring - OpenSessionInViewFilter
Sebastien,Note that you will also have to deal with lazy loading (if you use it) for references or collections of references. This is easier as you only have to call session.lock(object, LockMode.NONE).This is a compulsory dependency when working with Hibernate lazy loading, due to the way it handles its own sessions (so you end by never having a completely independent presentation layer, as ideal architectures claim). Regards,Quique.On 3/3/06, Sebastien Boutte [EMAIL PROTECTED] wrote: Enrique,I think that i have to redesign some part of my code, to integratecompletely with Spring. I will retest after that refactoring task.Thank youSébastienThe problem must be that you are using request-scoped beans, don't you?If you use request-scoped beans, then you have to merge on every request, using session.merge ;-)There was a discussion about this issue at the beginning of February:http://marc.theaimsgroup.com/?l=myfaces-userm=113890037426173w=2 I would recommend using either session-scoped beans, or a session statecontainer, accesible to all your beans, where the current object beingworked is available.
Re: JSF - Spring - OpenSessionInViewFilter
The problem must be that you are using request-scoped beans, don't you?If you use request-scoped beans, then you have to merge on every request, using session.merge ;-)There was a discussion about this issue at the beginning of February: http://marc.theaimsgroup.com/?l=myfaces-userm=113890037426173w=2I would recommend using either session-scoped beans, or a session state container, accesible to all your beans, where the current object being worked is available. 2006/3/1, Sebastien Boutte [EMAIL PROTECTED]: Hi Aleksei,In fact, i've just started to have the OpenSessionInFilterView to work.But now, i've to face different kind of problems.I can retrieve data from Hibernate using lazy initialisation ie i load a collection objects, select one, view it (simple master-details viewcity-zipcode relation) all tasks in a myfaces webapp.but when i update one detail and want to save the master i havea NonUniqueException that is raised. I've read in the myfaces wiki that you have to reattach all objects tothe session at the beginning of the request. Is it the solution to myproblem (An instance which is loaded in different sessions) ?How do you do it programmatically ? Do you have a registry of all hibernate objects used in your application and reattach automaticallyall objects at the beginnng of the request ?ThanksSébastien
Re: MYFACES-703 (Have to manually specify renderer type for ExtendedDataTable)
Well, I was unhappy for the frustrating situation of upgrading to a new release, and see how my application was not working anymore. Then I realized that a bug about this problem had been commented in the JIRA list, and simply warned about this issue. In other words: if the bug was detected after the release of version 1.1.1, then it is a bug and, as you comment, it has been solved. If the bug was detected prior to the release of version 1.1.1 and was not solved, then my warn was about this issue. I recognize I didn't have time to see whether the bug was prior or after to the release... Anyway, my message was not to shout about my problem, because I know that bugs have to exist, and I know how to find them and provide a patch to solve them, but to emphatize the fact of being careful with regression problems when releasing new versions (if and only if the bug was prior to the release). 2006/2/27, Martin Marinschek [EMAIL PROTECTED]: Ok, I see.this code has been fixed by me at this time - this is why I closed the bug.So you are unhappy cause the bug was introduced first, right?regards,MartinOn 2/26/06, Enrique Medina [EMAIL PROTECTED] wrote: Hi Martin, It's quite simple. If you use the tag, when the doStartTag() method is called, also the findComponent() method is, and within this one, the setProperties() method is also called. Inside this last method we find this code snip: if (getRendererType() != null) { _componentInstance.setRendererType(getRendererType()); } So if you use the ExtendedDataTable through the HtmlDataTableTag, you will get: public String getRendererType() { return org.apache.myfaces.Table ; } However, if you create the component dynamically, without the tag, then the default renderer type, javax.faces.Table is used, and you have to set it manually. This was not happening in prior releases to 1.1.1. Regards, Enrique Medina. 2006/2/26, Martin Marinschek [EMAIL PROTECTED]: Hi Enrique, hmm.. I thought I had identified the bug being that the renderer-type was not set in the constructor itself. AFAIK, it is not necessary to set the component-extension part in the faces-config.xml. Thoughts? regards, Martin On 2/25/06, Enrique Medina [EMAIL PROTECTED] wrote: Gary, I don't mind your irony, but as I comment this was a bug closed with status = CANNOT REPRODUCE, although the comment by Darren Jensen provided a clear diagnostic of the problem and the way to solve it rapidly. I've been using Myfaces since its very first release, so I know the hard work these guys are doing, but I've been frustrated by a simple-to-solve bug that was not really solved. If you understand this, you will see that this is not a matter of submitting a patch or not, but a matter of taking care of this type of things (which seem not to be so important for you, but maybe they are for Myfaces beginners, making them leave this great technology in the worst case). Anyway, I'll be delighted to continue contributing to the Myfaces project, as I've done until now ;-) Regards, Enrique Medina. 2006/2/25, Gary VanMatre [EMAIL PROTECTED]: From: Enrique Medina [EMAIL PROTECTED] http://issues.apache.org/jira/browse/MYFACES-703To my surprise, it seems this bug was ignored. I don't know exactly why, but if you let me say it, you should be careful with this type of things. It's highly dissapointing to upgrade to one new version and discover that part of your application is not working anymore. In my case, I have decided to spent all the day trying to find what happened, to finally discover that it was not my fault, but a JIRA issue apparently ignored. Maybe we are loosing Myfaces followers if we don't take care of this things (just a thought). Maybe you should submit a patch (just a thought)? Regards,Enrique Medina. -- http://www.irian.at Your JSF powerhouse - JSF Consulting, Development and Courses in English and German Professional Support for Apache MyFaces --http://www.irian.atYour JSF powerhouse -JSF Consulting, Development and Courses in English and GermanProfessional Support for Apache MyFaces
MYFACES-703 (Have to manually specify renderer type for ExtendedDataTable)
Hi,I have spent all this morning and part of the afternoon trying to guess why one of my dynamically generated ExtendedDataTable (i.e. created in code) was not working anymore (I upgraded to 1.1.1 some days ago), and finally discovered that my problem had to be with this JIRA issue: http://issues.apache.org/jira/browse/MYFACES-703To my surprise, it seems this bug was ignored. I don't know exactly why, but if you let me say it, you should be careful with this type of things. It's highly dissapointing to upgrade to one new version and discover that part of your application is not working anymore. In my case, I have decided to spent all the day trying to find what happened, to finally discover that it was not my fault, but a JIRA issue apparently ignored. Maybe we are loosing Myfaces followers if we don't take care of this things (just a thought). Regards,Enrique Medina.
Re: MYFACES-703 (Have to manually specify renderer type for ExtendedDataTable)
Gary,I don't mind your irony, but as I comment this was a bug closed with status = CANNOT REPRODUCE, although the comment by Darren Jensen provided a clear diagnostic of the problem and the way to solve it rapidly. I've been using Myfaces since its very first release, so I know the hard work these guys are doing, but I've been frustrated by a simple-to-solve bug that was not really solved. If you understand this, you will see that this is not a matter of submitting a patch or not, but a matter of taking care of this type of things (which seem not to be so important for you, but maybe they are for Myfaces beginners, making them leave this great technology in the worst case). Anyway, I'll be delighted to continue contributing to the Myfaces project, as I've done until now ;-)Regards,Enrique Medina.2006/2/25, Gary VanMatre [EMAIL PROTECTED]: From: Enrique Medina [EMAIL PROTECTED] http://issues.apache.org/jira/browse/MYFACES-703To my surprise, it seems this bug was ignored. I don't know exactly why, but if you let me say it, you should be careful with this type of things. It's highly dissapointing to upgrade to one new version and discover that part of your application is not working anymore. In my case, I have decided to spent all the day trying to find what happened, to finally discover that it was not my fault, but a JIRA issue apparently ignored. Maybe we are loosing Myfaces followers if we don't take care of this things (just a thought). Maybe you should submit a patch (just a thought)? Regards,Enrique Medina.
Re: Ajaxanywhere
Yes, I will put it during the day ;-)2006/2/23, Mike Kienenberger [EMAIL PROTECTED]: Enrique,You should consider putting that on the Wiki.On 2/23/06, Enrique Medina [EMAIL PROTECTED] wrote: Finally I solved all my problems ;-) Thinks to take into account: 1) Return null should work (see the thread) -- For me it wasn't working due to a side-effect problem. If it doesn't then use an array to define buttons that must be ajaxed (see thread) 2) VERY IMPORTANT -- Define the AAFilter as being the first filter in your chain -- This was the cause of all my problems with NULL pointer exception -- At least it MUST be the first one when another ServletResponse wrapper is in the game (as was happening with the ExtensionsFilter response wrapper) 3) If you're using Firefox, download the script debugger to see what's happening with JS behind the scenes ;-) You will find lots of interesting stuff, like preprocessors to the Ajax request, for example ;-) 4) Don't use redirect in the navigation rules, or the Ajax request will be simply bypassed Hope it helps to clarify the use of Ajaxanywhere with Myfaces. Thanks to anyone that has given me any kind of support with this issue, and thanks very much to guys like Vitaliy for giving us tools like this fantastic Ajaxanywhere :-) 2006/2/23, Enrique Medina [EMAIL PROTECTED]: Sorry, you were right... I've tried it and it works great, but there are some cases where I get a NullPointerException when clicking the ajaxed button. But then I click it again, and it works!!! Debugging through your code, I see that when the cause why the exception is thrown is due to a call to the internal writer object of your BufferedResponseWrapper class, which is null. But it is not null for the second request on the same button... I'm missing something... By the way, using your proposal, should I continue using the ajaxAnywhere.getZonesToReload? Thanks very much for your support ;-)2006/2/23, Vitaliy Shevchuk [EMAIL PROTECTED]: it IS the other way round ;) read carefuly my message ajaxAnywhere.substituteSubmitButtonsBehavior(true,[ajaxAnywhere.findForm().elements['mainForm:selectBoxBtn']]); // -- arrays of ajaxed buttons - Original Message - From: Enrique Medina To: Vitaliy Shevchuk Cc: MyFaces Discussion ; [EMAIL PROTECTED] ; [EMAIL PROTECTED] ; [EMAIL PROTECTED] ; [EMAIL PROTECTED] ; [EMAIL PROTECTED] Sent: Thursday, February 23, 2006 8:38 AM Subject: Re: Ajaxanywhere Hi Vitaliy, Then you mean that buttons that are not Ajaxed must be passed as argument to the substituteSubmitButtonsBehaviour? I though it was the other way round; i.e. arrays of ajaxed buttons... 2006/2/22, Vitaliy Shevchuk [EMAIL PROTECTED] : Hi guys, first of all, sorry for not providing a proper support on AjaxAnywhere forum. I have been doing it for over 4 months but don't have much of free time now. The first solution for your problem is to specify a list of Ajaxed buttons when calling substituteSubmitButtonsBehavior. So other buttons would stay For all2.jsf from the DEMO application it would look like this :ajaxAnywhere.substituteSubmitButtonsBehavior(true,[ajaxAnywhere.findForm().elements['mainForm:selectBoxBtn']]); then, if you add a second command buttonh:commandButton action="" value=Calc No AJAX id=selectBoxBtn_nonAJAX / it would work without Ajax. some doc is available here http://ajaxanywhere.sourceforge.net/js_docs_out/AjaxAnywhere.html#substituteSubmitButtonsBehavior Vitaliy. PS. Indeed, there are several bugs discovered here and I need to fix them. It should work when returning null from getZonesToRefresh(), next release will fix it.PPS. for the navigation to another page when submitting with AA, did you try redirect parameter in JSF config? I'm not sure but it should work, as response.sendRedirect() is interpreted as location.href="" on the client side. - Original Message -----From: Enrique Medina To: MyFaces Discussion ; [EMAIL PROTECTED] ; [EMAIL PROTECTED] ; [EMAIL PROTECTED] ; [EMAIL PROTECTED] ; [EMAIL PROTECTED] ; [EMAIL PROTECTED] ; [EMAIL PROTECTED]Sent: Tuesday, February 21, 2006 9:45 PMSubject: Re: Ajaxanywhere And more testing... I have downloaded the DEMO from the Ajaxanywhere site, and made a change on the facesFrame.jsp to make the Calculate price button non-ajaxed. And it does not work; i.e. if I quit the Calculate price from the ajaxed zones, then the action is never executed. From my experience, Ajaxanywhere does not work with a page combining ajaxed and non-ajaxed JSF actions. 2006/2/21, Enrique Medina [EMAIL PROTECTED] : Definetively, I can't make it work. I've created a simple JSF page with two buttons: one is a save for the form and the other just navigates to another page (simulating a cancel action). The save button works great, but when I press the cancel/exit button,
Wiki on Ajaxanywhere
Hi,Please find another of my contributions to this project.http://wiki.apache.org/myfaces/Integrating_AjaxanywhereHope it helps you ;-) Regards,Enrique Medina.
Re: The same .war runs fine on Windows but not works on linux...
What browser are you using in each system?2006/2/24, Eduardo Dudu Ivan Pichler [EMAIL PROTECTED]: I have a application running on a sun Application Server installed, one at windows, and another at LinuxI deployed my .war in both. On the windows it runs perfectly, but on the Linux, the when I click on the JScookMenu, nothing happen What is happening?thanks a lot!
Re: The same .war runs fine on Windows but not works on linux...
Strange, but we have to discard a problem with _javascript_...Can you see whether you get any JS error when clicking in Linux? Can you add a h:message/ tag to see whether JSF is throwing any errors? 2006/2/24, Eduardo Dudu Ivan Pichler [EMAIL PROTECTED]: At client side is the firefox, in the same machine accessing both serversOn 2/24/06, Enrique Medina [EMAIL PROTECTED] wrote:What browser are you using in each system? 2006/2/24, Eduardo Dudu Ivan Pichler [EMAIL PROTECTED]: I have a application running on a sun Application Server installed, one at windows, and another at LinuxI deployed my .war in both. On the windows it runs perfectly, but on the Linux, the when I click on the JScookMenu, nothing happen What is happening?thanks a lot! -- Dudu--GoogleTalk: eduardopichler[at]gmail[dot]comskype:eduardopichler
Re: Ajaxanywhere
Sorry, you were right...I've tried it and it works great, but there are some cases where I get a NullPointerException when clicking the ajaxed button. But then I click it again, and it works!!! Debugging through your code, I see that when the cause why the exception is thrown is due to a call to the internal writer object of your BufferedResponseWrapper class, which is null. But it is not null for the second request on the same button... I'm missing something... By the way, using your proposal, should I continue using the ajaxAnywhere.getZonesToReload? Thanks very much for your support ;-)2006/2/23, Vitaliy Shevchuk [EMAIL PROTECTED]: it IS the other way round ;) read carefuly my message ajaxAnywhere.substituteSubmitButtonsBehavior(true,[ajaxAnywhere.findForm().elements['mainForm:selectBoxBtn']]); // -- arrays of ajaxed buttons - Original Message - From: Enrique Medina To: Vitaliy Shevchuk Cc: MyFaces Discussion ; [EMAIL PROTECTED] ; [EMAIL PROTECTED] ; [EMAIL PROTECTED] ; [EMAIL PROTECTED] ; [EMAIL PROTECTED] Sent: Thursday, February 23, 2006 8:38 AM Subject: Re: Ajaxanywhere Hi Vitaliy,Then you mean that buttons that are not Ajaxed must be passed as argument to the substituteSubmitButtonsBehaviour? I though it was the other way round; i.e. arrays of ajaxed buttons... 2006/2/22, Vitaliy Shevchuk [EMAIL PROTECTED]: Hi guys, first of all, sorry for not providing a proper support on AjaxAnywhere forum. I have been doing it for over 4 months but don't have much of free time now. The first solution for your problem is to specify a list of Ajaxed buttons when calling substituteSubmitButtonsBehavior. So other buttons would stay For all2.jsf from the DEMO application it would look like this : ajaxAnywhere.substituteSubmitButtonsBehavior(true,[ajaxAnywhere.findForm().elements['mainForm:selectBoxBtn']]); then, if you add a second command button h:commandButton action="" value=Calc No AJAX id=selectBoxBtn_nonAJAX / it would work without Ajax. some doc is available here http://ajaxanywhere.sourceforge.net/js_docs_out/AjaxAnywhere.html#substituteSubmitButtonsBehavior Vitaliy. PS. Indeed, there are several bugs discovered here and I need to fix them. It should work when returning null from getZonesToRefresh(), next release will fix it. PPS. for the navigation to another page when submitting with AA, did you try redirect parameter in JSF config? I'm not sure but it should work, as response.sendRedirect() is interpreted as location.href="" on the client side. - Original Message - From: Enrique Medina To: MyFaces Discussion ; [EMAIL PROTECTED] ; [EMAIL PROTECTED] ; [EMAIL PROTECTED] ; [EMAIL PROTECTED] ; [EMAIL PROTECTED] ; [EMAIL PROTECTED] ; [EMAIL PROTECTED] Sent: Tuesday, February 21, 2006 9:45 PM Subject: Re: Ajaxanywhere And more testing...I have downloaded the DEMO from the Ajaxanywhere site, and made a change on the facesFrame.jsp to make the Calculate price button non-ajaxed. And it does not work; i.e. if I quit the Calculate price from the ajaxed zones, then the action is never executed. From my experience, Ajaxanywhere does not work with a page combining ajaxed and non-ajaxed JSF actions. 2006/2/21, Enrique Medina [EMAIL PROTECTED] : Definetively, I can't make it work. I've created a simple JSF page with two buttons: one is a save for the form and the other just navigates to another page (simulating a cancel action). The save button works great, but when I press the cancel/exit button, then nothing happens. I've been also doing some debugging, and when using Ajaxanywhere, the submit of the non-ajaxed button does not update the parameterRequestMap used after to decide whether it is an immediate request, etc.No idea of what I'm doing wrong Emmanuel can you please help? Can you provide some of your JSF pages? What version are you using? Are you working with buttons?Thanks. 2006/2/21, Enrique Medina [EMAIL PROTECTED]: Some more testing...If I remove all the JS I posted before, then the common JSF button works, and obviously my ajaxed zone is ignored and the page is completely refresehd; if I add it again, then the common JSF does not work, and obviously the ajxed zone works great. It's clear the problem comes with the JS and how does Ajaxanywhere handle the request... 2006/2/21, Enrique Medina [EMAIL PROTECTED] : Hi again,I have tried the solution you prop
Re: Ajaxanywhere
Finally I solved all my problems ;-)Thinks to take into account:1) Return null should work (see the thread) -- For me it wasn't working due to a side-effect problem. If it doesn't then use an array to define buttons that must be ajaxed (see thread) 2) VERY IMPORTANT -- Define the AAFilter as being the first filter in your chain -- This was the cause of all my problems with NULL pointer exception -- At least it MUST be the first one when another ServletResponse wrapper is in the game (as was happening with the ExtensionsFilter response wrapper) 3) If you're using Firefox, download the script debugger to see what's happening with JS behind the scenes ;-) You will find lots of interesting stuff, like preprocessors to the Ajax request, for example ;-)4) Don't use redirect in the navigation rules, or the Ajax request will be simply bypassed Hope it helps to clarify the use of Ajaxanywhere with Myfaces.Thanks to anyone that has given me any kind of support with this issue, and thanks very much to guys like Vitaliy for giving us tools like this fantastic Ajaxanywhere :-) 2006/2/23, Enrique Medina [EMAIL PROTECTED]: Sorry, you were right...I've tried it and it works great, but there are some cases where I get a NullPointerException when clicking the ajaxed button. But then I click it again, and it works!!! Debugging through your code, I see that when the cause why the exception is thrown is due to a call to the internal writer object of your BufferedResponseWrapper class, which is null. But it is not null for the second request on the same button... I'm missing something... By the way, using your proposal, should I continue using the ajaxAnywhere.getZonesToReload? Thanks very much for your support ;-)2006/2/23, Vitaliy Shevchuk [EMAIL PROTECTED]: it IS the other way round ;) read carefuly my message ajaxAnywhere.substituteSubmitButtonsBehavior(true,[ajaxAnywhere.findForm().elements['mainForm:selectBoxBtn']]); // -- arrays of ajaxed buttons - Original Message - From: Enrique Medina To: Vitaliy Shevchuk Cc: MyFaces Discussion ; [EMAIL PROTECTED] ; [EMAIL PROTECTED] ; [EMAIL PROTECTED] ; [EMAIL PROTECTED] ; [EMAIL PROTECTED] Sent: Thursday, February 23, 2006 8:38 AM Subject: Re: Ajaxanywhere Hi Vitaliy,Then you mean that buttons that are not Ajaxed must be passed as argument to the substituteSubmitButtonsBehaviour? I though it was the other way round; i.e. arrays of ajaxed buttons... 2006/2/22, Vitaliy Shevchuk [EMAIL PROTECTED]: Hi guys, first of all, sorry for not providing a proper support on AjaxAnywhere forum. I have been doing it for over 4 months but don't have much of free time now. The first solution for your problem is to specify a list of Ajaxed buttons when calling substituteSubmitButtonsBehavior. So other buttons would stay For all2.jsf from the DEMO application it would look like this : ajaxAnywhere.substituteSubmitButtonsBehavior(true,[ajaxAnywhere.findForm().elements['mainForm:selectBoxBtn']]); then, if you add a second command button h:commandButton action="" value=Calc No AJAX id=selectBoxBtn_nonAJAX / it would work without Ajax. some doc is available here http://ajaxanywhere.sourceforge.net/js_docs_out/AjaxAnywhere.html#substituteSubmitButtonsBehavior Vitaliy. PS. Indeed, there are several bugs discovered here and I need to fix them. It should work when returning null from getZonesToRefresh(), next release will fix it. PPS. for the navigation to another page when submitting with AA, did you try redirect parameter in JSF config? I'm not sure but it should work, as response.sendRedirect() is interpreted as location.href="" on the client side. - Original Message - From: Enrique Medina To: MyFaces Discussion ; [EMAIL PROTECTED] ; [EMAIL PROTECTED] ; [EMAIL PROTECTED] ; [EMAIL PROTECTED] ; [EMAIL PROTECTED] ; [EMAIL PROTECTED] ; [EMAIL PROTECTED] Sent: Tuesday, February 21, 2006 9:45 PM Subject: Re: Ajaxanywhere And more testing...I have downloaded the DEMO from the Ajaxanywhere site, and made a change on the facesFrame.jsp to make the Calculate price button non-ajaxed. And it does not work; i.e. if I quit the Calculate price from the ajaxed zones, then the action is never executed. From my experience, Ajaxanywhere does not work with a page combining ajaxed and non-ajaxed JSF actions. 2006/2/21, Enrique Medina [EMAIL PROTECTED] : Definetively, I can't make it work. I've created a simple JSF page with two buttons: one is a save for the form and the other just navigates to another page (simulating a cancel action). The save button works great, but w
Re: Ajaxanywhere
You mean to add it to the ajaxed-button instead of the JS?2006/2/22, Emmanuel Jay [EMAIL PROTECTED]: maybe try to add: > (also try it with getAjax()) to your button(you shouldn't really have to as your JS includes ajaxAnywhere.substituteSubmitButtonsBehavior(true);but I am running out of options) On 2/22/06, Enrique Medina [EMAIL PROTECTED] wrote: Well, the fact is that the Ajaxanywhere example does not work either, because I modified it to add non-ajaxed request, and happens like in my application, nothing... 2006/2/21, Emmanuel Jay [EMAIL PROTECTED]: No I am working mostly with commandLink and it works fine, i.e. combining ajaxed and non ajaxed actions is fine for me. Have you tried your test case with a link rather than a button (that might be a good test to make sure it is not an issue), are you sure that your js picks up the correct button id, i.e that the correct zones are returned. Looks to me that the id might be wrong, try to add some js alert to make sure that the correct zones are returned (or null if the AA filter should be bypassed). (I am actually using a build of AA that I have built from their CVS source. This is because I had found a bug that was causing dynamically generated UI (and bindings) not to work with the version of MyFaces I was using.) On 2/21/06, Enrique Medina [EMAIL PROTECTED] wrote: And more testing...I have downloaded the DEMO from the Ajaxanywhere site, and made a change on the facesFrame.jsp to make the Calculate price button non-ajaxed. And it does not work; i.e. if I quit the Calculate price from the ajaxed zones, then the action is never executed. From my experience, Ajaxanywhere does not work with a page combining ajaxed and non-ajaxed JSF actions. 2006/2/21, Enrique Medina [EMAIL PROTECTED] : Definetively, I can't make it work. I've created a simple JSF page with two buttons: one is a save for the form and the other just navigates to another page (simulating a cancel action). The save button works great, but when I press the cancel/exit button, then nothing happens. I've been also doing some debugging, and when using Ajaxanywhere, the submit of the non-ajaxed button does not update the parameterRequestMap used after to decide whether it is an immediate request, etc.No idea of what I'm doing wrong Emmanuel can you please help? Can you provide some of your JSF pages? What version are you using? Are you working with buttons?Thanks. 2006/2/21, Enrique Medina [EMAIL PROTECTED]: Some more testing...If I remove all the JS I posted before, then the common JSF button works, and obviously my ajaxed zone is ignored and the page is completely refresehd; if I add it again, then the common JSF does not work, and obviously the ajxed zone works great. It's clear the problem comes with the JS and how does Ajaxanywhere handle the request... 2006/2/21, Enrique Medina [EMAIL PROTECTED] : Hi again,I have tried the solution you proposed about returning null for non-ajaxed requests, but I can't get it to work :-( Here is my JS code:ajaxAnywhere.getZonesToReload = function(url, submitButton) { if (typeof submitButton != 'undefined') { if (submitButton.type == 'submit') { if ( submitButton.id.search('botonAjax') != -1) {return 'variablesSalidaList'; } } } return null;}ajaxAnywhere.formName = 'bodySubview:mainForm'; ajaxAnywhere.substituteFormSubmitFunction ();ajaxAnywhere.substituteSubmitButtonsBehavior(true);As you can see, I evaluate the ID of the submitButton to be something like *botonAjax*, so I can differentiate from the other buttons. And in any other case, I always return null. But when I press a button out of the ajaxed zone, it simply does nothing (well, the request is made, and the page is refreshed, but no navigation to the new page). Any ideas of what could I be doing wrong? I'm convinced that maybe my problem has something to be with the JS code... or maybe not... 2006/2/21, Emmanuel Jay [EMAIL PROTECTED]: Yes our app has ajaxed and non ajaxed part. For example some parts can't be ajaxed at all, such as the part using the fileUpload component (as well as any get operation for that matter). Yes i use the link id to determine whether it is an Ajax request or not. Basically for a link it is: var linkFrom = this.findForm().elements[mainForm:_link_hidden_].value;P.S. I have my own problem with AA, seems that the dataScroller doesn't work well with AA (if you ever come accross that case I'll be glad to hear if you manage to solve it!) On 2/21/06, Enrique Medina [EMAIL PROTECTED] wrote: Umm, I see. So your application has JSF pages with parts ajaxed and other parts, as usual JSF requests, don't you? I'll try it and let you know whether it finally works or not. By the way, just for the sake of confirmation, is your JS code similar to mine? I mean, do you use the button or link ID to determine whether it's an ajaxed request or not? Thanks very m
Re: Ajaxanywhere
I finally solved it :-)The trick was to indicate the exact buttons that had to be ajaxed in the JS code:ajaxAnywhere.getZonesToReload = function(url, submitButton) { if (typeof submitButton != 'undefined') { if (submitButton.type == 'submit') { if (submitButton.id.search('botonAjax') != -1) { return 'variablesSalidaList'; } } }}var elements = new Array(); elements.push(getElmById('botonAjaxNuevaVariable'));elements.push(getElmById('botonAjaxQuitarVariable'));ajaxAnywhere.formName = 'bodySubview:mainForm'; ajaxAnywhere.substituteFormSubmitFunction();ajaxAnywhere.substituteSubmitButtonsBehavior(true, elements);Simple, but very hard to find ;-) 2006/2/22, Emmanuel Jay [EMAIL PROTECTED]: yes to make sure that your action is triggered through AA and for the buttons you wantOn 2/22/06, Enrique Medina [EMAIL PROTECTED] wrote:You mean to add it to the ajaxed-button instead of the JS? 2006/2/22, Emmanuel Jay [EMAIL PROTECTED]: maybe try to add: > (also try it with getAjax()) to your button(you shouldn't really have to as your JS includes ajaxAnywhere.substituteSubmitButtonsBehavior(true);but I am running out of options) On 2/22/06, Enrique Medina [EMAIL PROTECTED] wrote: Well, the fact is that the Ajaxanywhere example does not work either, because I modified it to add non-ajaxed request, and happens like in my application, nothing... 2006/2/21, Emmanuel Jay [EMAIL PROTECTED]: No I am working mostly with commandLink and it works fine, i.e. combining ajaxed and non ajaxed actions is fine for me. Have you tried your test case with a link rather than a button (that might be a good test to make sure it is not an issue), are you sure that your js picks up the correct button id, i.e that the correct zones are returned. Looks to me that the id might be wrong, try to add some js alert to make sure that the correct zones are returned (or null if the AA filter should be bypassed). (I am actually using a build of AA that I have built from their CVS source. This is because I had found a bug that was causing dynamically generated UI (and bindings) not to work with the version of MyFaces I was using.) On 2/21/06, Enrique Medina [EMAIL PROTECTED] wrote: And more testing...I have downloaded the DEMO from the Ajaxanywhere site, and made a change on the facesFrame.jsp to make the Calculate price button non-ajaxed. And it does not work; i.e. if I quit the Calculate price from the ajaxed zones, then the action is never executed. From my experience, Ajaxanywhere does not work with a page combining ajaxed and non-ajaxed JSF actions. 2006/2/21, Enrique Medina [EMAIL PROTECTED] : Definetively, I can't make it work. I've created a simple JSF page with two buttons: one is a save for the form and the other just navigates to another page (simulating a cancel action). The save button works great, but when I press the cancel/exit button, then nothing happens. I've been also doing some debugging, and when using Ajaxanywhere, the submit of the non-ajaxed button does not update the parameterRequestMap used after to decide whether it is an immediate request, etc.No idea of what I'm doing wrong Emmanuel can you please help? Can you provide some of your JSF pages? What version are you using? Are you working with buttons?Thanks. 2006/2/21, Enrique Medina [EMAIL PROTECTED]: Some more testing...If I remove all the JS I posted before, then the common JSF button works, and obviously my ajaxed zone is ignored and the page is completely refresehd; if I add it again, then the common JSF does not work, and obviously the ajxed zone works great. It's clear the problem comes with the JS and how does Ajaxanywhere handle the request... 2006/2/21, Enrique Medina [EMAIL PROTECTED] : Hi again,I have tried the solution you proposed about returning null for non-ajaxed requests, but I can't get it to work :-( Here is my JS code:ajaxAnywhere.getZonesToReload = function(url, submitButton) { if (typeof submitButton != 'undefined') { if (submitButton.type == 'submit') { if ( submitButton.id.search('botonAjax') != -1) {return 'variablesSalidaList'; } } } return null;}ajaxAnywhere.formName = 'bodySubview:mainForm'; ajaxAnywhere.substituteFormSubmitFunction ();ajaxAnywhere.substituteSubmitButtonsBehavior(true);As you can see, I evaluate the ID of the submitButton to be something like *botonAjax*, so I can differentiate from the other buttons. And in any other case, I always return null. But when I press a button out of the ajaxed zone, it simply does nothing (well, the request is made, and the page is refreshed, but no navigation to the new page). Any ideas of what could I be doing wrong? I'm convinced that maybe my problem has something to be with the JS code... or maybe not... 2006/2/21, Emmanuel Jay [EMAIL PROTECTED]: Yes our app has ajaxed and
Ajaxanywhere
Hi,Has anyone successfully used Ajaxanywhere inside a JSF page with a piece of the page being ajaxed and the other piece not? Let me give an example: imagine a JSF page where the selection of a combo box must force the refresh of another combo box. This zone is ajaxed using aa:zoneJSF. But buttons to save or go to another page in the navigation are not ajaxed. My problem is that the ajaxed zone works great, but then I have a button to save, and another one to navigate to another page, and those buttons don't seem to work. When I click them a request is sended, but none of their respective actions are executed, no error messages are shown (I have a global tag in the page). It seems like a request with an action returning simply null (not doing anything). My _javascript_ for Ajaxanywhere looks like this: ajaxAnywhere.getZonesToReload = function(url,submitButton) { if (submitButton.id.equals('myAjaxButton') return dataZone; } ajaxAnywhere.formName = mainForm; ajaxAnywhere.substituteFormSubmitFunction(); ajaxAnywhere.substituteSubmitButtonsBehavior(true); What am I doing wrong? How do you have to indicate non-ajaxed buttons in the getZonesToReload _javascript_ callback?
Re: Ajaxanywhere
Null? I remember some tests returning '' and getting a NullPointerException. What should be the reason why returning NULL should work?2006/2/21, Emmanuel Jay [EMAIL PROTECTED]:Hi Enrique,If you want you button or link action not to go through AA you have to return null for those in getZonesToReload. Hope that helps,EmmanuelOn 2/21/06, Enrique Medina [EMAIL PROTECTED] wrote: Hi,Has anyone successfully used Ajaxanywhere inside a JSF page with a piece of the page being ajaxed and the other piece not? Let me give an example: imagine a JSF page where the selection of a combo box must force the refresh of another combo box. This zone is ajaxed using aa:zoneJSF. But buttons to save or go to another page in the navigation are not ajaxed. My problem is that the ajaxed zone works great, but then I have a button to save, and another one to navigate to another page, and those buttons don't seem to work. When I click them a request is sended, but none of their respective actions are executed, no error messages are shown (I have a global tag in the page). It seems like a request with an action returning simply null (not doing anything). My _javascript_ for Ajaxanywhere looks like this: ajaxAnywhere.getZonesToReload = function(url,submitButton) { if (submitButton.id.equals('myAjaxButton') return dataZone; } ajaxAnywhere.formName = mainForm; ajaxAnywhere.substituteFormSubmitFunction(); ajaxAnywhere.substituteSubmitButtonsBehavior(true); What am I doing wrong? How do you have to indicate non-ajaxed buttons in the getZonesToReload _javascript_ callback?
Re: Ajaxanywhere
Umm, I see. So your application has JSF pages with parts ajaxed and other parts, as usual JSF requests, don't you? I'll try it and let you know whether it finally works or not.By the way, just for the sake of confirmation, is your JS code similar to mine? I mean, do you use the button or link ID to determine whether it's an ajaxed request or not? Thanks very much for your support.2006/2/21, Emmanuel Jay [EMAIL PROTECTED]: I think the AA filter is totally by passed if the list of zones to reload is null (getZonesToReload returns null). In our app we mostly have links and returning null works fine. On 2/21/06, Enrique Medina [EMAIL PROTECTED] wrote: Null? I remember some tests returning '' and getting a NullPointerException. What should be the reason why returning NULL should work?2006/2/21, Emmanuel Jay [EMAIL PROTECTED]:Hi Enrique, If you want you button or link action not to go through AA you have to return null for those in getZonesToReload. Hope that helps,EmmanuelOn 2/21/06, Enrique Medina [EMAIL PROTECTED] wrote: Hi,Has anyone successfully used Ajaxanywhere inside a JSF page with a piece of the page being ajaxed and the other piece not? Let me give an example: imagine a JSF page where the selection of a combo box must force the refresh of another combo box. This zone is ajaxed using aa:zoneJSF. But buttons to save or go to another page in the navigation are not ajaxed. My problem is that the ajaxed zone works great, but then I have a button to save, and another one to navigate to another page, and those buttons don't seem to work. When I click them a request is sended, but none of their respective actions are executed, no error messages are shown (I have a global tag in the page). It seems like a request with an action returning simply null (not doing anything). My _javascript_ for Ajaxanywhere looks like this: ajaxAnywhere.getZonesToReload = function(url,submitButton) { if (submitButton.id.equals('myAjaxButton') return dataZone; } ajaxAnywhere.formName = mainForm; ajaxAnywhere.substituteFormSubmitFunction(); ajaxAnywhere.substituteSubmitButtonsBehavior(true); What am I doing wrong? How do you have to indicate non-ajaxed buttons in the getZonesToReload _javascript_ callback?
Re: Ajaxanywhere
Hi again,I have tried the solution you proposed about returning null for non-ajaxed requests, but I can't get it to work :-(Here is my JS code:ajaxAnywhere.getZonesToReload = function(url, submitButton) { if (typeof submitButton != 'undefined') { if (submitButton.type == 'submit') { if ( submitButton.id.search('botonAjax') != -1) {return 'variablesSalidaList'; } } } return null;}ajaxAnywhere.formName = 'bodySubview:mainForm';ajaxAnywhere.substituteFormSubmitFunction(); ajaxAnywhere.substituteSubmitButtonsBehavior(true);As you can see, I evaluate the ID of the submitButton to be something like *botonAjax*, so I can differentiate from the other buttons. And in any other case, I always return null. But when I press a button out of the ajaxed zone, it simply does nothing (well, the request is made, and the page is refreshed, but no navigation to the new page). Any ideas of what could I be doing wrong? I'm convinced that maybe my problem has something to be with the JS code... or maybe not...2006/2/21, Emmanuel Jay [EMAIL PROTECTED]:Yes our app has ajaxed and non ajaxed part. For example some parts can't be ajaxed at all, such as the part using the fileUpload component (as well as any get operation for that matter). Yes i use the link id to determine whether it is an Ajax request or not. Basically for a link it is: var linkFrom = this.findForm().elements[mainForm:_link_hidden_].value;P.S. I have my own problem with AA, seems that the dataScroller doesn't work well with AA (if you ever come accross that case I'll be glad to hear if you manage to solve it!) On 2/21/06, Enrique Medina [EMAIL PROTECTED] wrote: Umm, I see. So your application has JSF pages with parts ajaxed and other parts, as usual JSF requests, don't you? I'll try it and let you know whether it finally works or not.By the way, just for the sake of confirmation, is your JS code similar to mine? I mean, do you use the button or link ID to determine whether it's an ajaxed request or not? Thanks very much for your support.2006/2/21, Emmanuel Jay [EMAIL PROTECTED]: I think the AA filter is totally by passed if the list of zones to reload is null (getZonesToReload returns null). In our app we mostly have links and returning null works fine. On 2/21/06, Enrique Medina [EMAIL PROTECTED] wrote: Null? I remember some tests returning '' and getting a NullPointerException. What should be the reason why returning NULL should work?2006/2/21, Emmanuel Jay [EMAIL PROTECTED]:Hi Enrique, If you want you button or link action not to go through AA you have to return null for those in getZonesToReload. Hope that helps,EmmanuelOn 2/21/06, Enrique Medina [EMAIL PROTECTED] wrote: Hi,Has anyone successfully used Ajaxanywhere inside a JSF page with a piece of the page being ajaxed and the other piece not? Let me give an example: imagine a JSF page where the selection of a combo box must force the refresh of another combo box. This zone is ajaxed using aa:zoneJSF. But buttons to save or go to another page in the navigation are not ajaxed. My problem is that the ajaxed zone works great, but then I have a button to save, and another one to navigate to another page, and those buttons don't seem to work. When I click them a request is sended, but none of their respective actions are executed, no error messages are shown (I have a global tag in the page). It seems like a request with an action returning simply null (not doing anything). My _javascript_ for Ajaxanywhere looks like this: ajaxAnywhere.getZonesToReload = function(url,submitButton) { if (submitButton.id.equals('myAjaxButton') return dataZone; } ajaxAnywhere.formName = mainForm; ajaxAnywhere.substituteFormSubmitFunction(); ajaxAnywhere.substituteSubmitButtonsBehavior(true); What am I doing wrong? How do you have to indicate non-ajaxed buttons in the getZonesToReload _javascript_ callback?
Re: Ajaxanywhere
Some more testing...If I remove all the JS I posted before, then the common JSF button works, and obviously my ajaxed zone is ignored and the page is completely refresehd; if I add it again, then the common JSF does not work, and obviously the ajxed zone works great. It's clear the problem comes with the JS and how does Ajaxanywhere handle the request...2006/2/21, Enrique Medina [EMAIL PROTECTED] :Hi again,I have tried the solution you proposed about returning null for non-ajaxed requests, but I can't get it to work :-( Here is my JS code:ajaxAnywhere.getZonesToReload = function(url, submitButton) { if (typeof submitButton != 'undefined') { if (submitButton.type == 'submit') { if ( submitButton.id.search('botonAjax') != -1) {return 'variablesSalidaList'; } } } return null;}ajaxAnywhere.formName = 'bodySubview:mainForm';ajaxAnywhere.substituteFormSubmitFunction (); ajaxAnywhere.substituteSubmitButtonsBehavior(true);As you can see, I evaluate the ID of the submitButton to be something like *botonAjax*, so I can differentiate from the other buttons. And in any other case, I always return null. But when I press a button out of the ajaxed zone, it simply does nothing (well, the request is made, and the page is refreshed, but no navigation to the new page). Any ideas of what could I be doing wrong? I'm convinced that maybe my problem has something to be with the JS code... or maybe not... 2006/2/21, Emmanuel Jay [EMAIL PROTECTED]:Yes our app has ajaxed and non ajaxed part. For example some parts can't be ajaxed at all, such as the part using the fileUpload component (as well as any get operation for that matter). Yes i use the link id to determine whether it is an Ajax request or not. Basically for a link it is: var linkFrom = this.findForm().elements[mainForm:_link_hidden_].value;P.S. I have my own problem with AA, seems that the dataScroller doesn't work well with AA (if you ever come accross that case I'll be glad to hear if you manage to solve it!) On 2/21/06, Enrique Medina [EMAIL PROTECTED] wrote: Umm, I see. So your application has JSF pages with parts ajaxed and other parts, as usual JSF requests, don't you? I'll try it and let you know whether it finally works or not.By the way, just for the sake of confirmation, is your JS code similar to mine? I mean, do you use the button or link ID to determine whether it's an ajaxed request or not? Thanks very much for your support.2006/2/21, Emmanuel Jay [EMAIL PROTECTED]: I think the AA filter is totally by passed if the list of zones to reload is null (getZonesToReload returns null). In our app we mostly have links and returning null works fine. On 2/21/06, Enrique Medina [EMAIL PROTECTED] wrote: Null? I remember some tests returning '' and getting a NullPointerException. What should be the reason why returning NULL should work?2006/2/21, Emmanuel Jay [EMAIL PROTECTED]:Hi Enrique, If you want you button or link action not to go through AA you have to return null for those in getZonesToReload. Hope that helps,EmmanuelOn 2/21/06, Enrique Medina [EMAIL PROTECTED] wrote: Hi,Has anyone successfully used Ajaxanywhere inside a JSF page with a piece of the page being ajaxed and the other piece not? Let me give an example: imagine a JSF page where the selection of a combo box must force the refresh of another combo box. This zone is ajaxed using aa:zoneJSF. But buttons to save or go to another page in the navigation are not ajaxed. My problem is that the ajaxed zone works great, but then I have a button to save, and another one to navigate to another page, and those buttons don't seem to work. When I click them a request is sended, but none of their respective actions are executed, no error messages are shown (I have a global tag in the page). It seems like a request with an action returning simply null (not doing anything). My _javascript_ for Ajaxanywhere looks like this: ajaxAnywhere.getZonesToReload = function(url,submitButton) { if (submitButton.id.equals('myAjaxButton') return dataZone; } ajaxAnywhere.formName = mainForm; ajaxAnywhere.substituteFormSubmitFunction(); ajaxAnywhere.substituteSubmitButtonsBehavior(true); What am I doing wrong? How do you have to indicate non-ajaxed buttons in the getZonesToReload _javascript_ callback?
Re: Ajaxanywhere
Definetively, I can't make it work. I've created a simple JSF page with two buttons: one is a save for the form and the other just navigates to another page (simulating a cancel action). The save button works great, but when I press the cancel/exit button, then nothing happens. I've been also doing some debugging, and when using Ajaxanywhere, the submit of the non-ajaxed button does not update the parameterRequestMap used after to decide whether it is an immediate request, etc.No idea of what I'm doing wrong Emmanuel can you please help? Can you provide some of your JSF pages? What version are you using? Are you working with buttons?Thanks.2006/2/21, Enrique Medina [EMAIL PROTECTED]:Some more testing...If I remove all the JS I posted before, then the common JSF button works, and obviously my ajaxed zone is ignored and the page is completely refresehd; if I add it again, then the common JSF does not work, and obviously the ajxed zone works great. It's clear the problem comes with the JS and how does Ajaxanywhere handle the request...2006/2/21, Enrique Medina [EMAIL PROTECTED] :Hi again,I have tried the solution you proposed about returning null for non-ajaxed requests, but I can't get it to work :-( Here is my JS code:ajaxAnywhere.getZonesToReload = function(url, submitButton) { if (typeof submitButton != 'undefined') { if (submitButton.type == 'submit') { if ( submitButton.id.search('botonAjax') != -1) {return 'variablesSalidaList'; } } } return null;}ajaxAnywhere.formName = 'bodySubview:mainForm';ajaxAnywhere.substituteFormSubmitFunction (); ajaxAnywhere.substituteSubmitButtonsBehavior(true);As you can see, I evaluate the ID of the submitButton to be something like *botonAjax*, so I can differentiate from the other buttons. And in any other case, I always return null. But when I press a button out of the ajaxed zone, it simply does nothing (well, the request is made, and the page is refreshed, but no navigation to the new page). Any ideas of what could I be doing wrong? I'm convinced that maybe my problem has something to be with the JS code... or maybe not... 2006/2/21, Emmanuel Jay [EMAIL PROTECTED]:Yes our app has ajaxed and non ajaxed part. For example some parts can't be ajaxed at all, such as the part using the fileUpload component (as well as any get operation for that matter). Yes i use the link id to determine whether it is an Ajax request or not. Basically for a link it is: var linkFrom = this.findForm().elements[mainForm:_link_hidden_].value;P.S. I have my own problem with AA, seems that the dataScroller doesn't work well with AA (if you ever come accross that case I'll be glad to hear if you manage to solve it!) On 2/21/06, Enrique Medina [EMAIL PROTECTED] wrote: Umm, I see. So your application has JSF pages with parts ajaxed and other parts, as usual JSF requests, don't you? I'll try it and let you know whether it finally works or not.By the way, just for the sake of confirmation, is your JS code similar to mine? I mean, do you use the button or link ID to determine whether it's an ajaxed request or not? Thanks very much for your support.2006/2/21, Emmanuel Jay [EMAIL PROTECTED]: I think the AA filter is totally by passed if the list of zones to reload is null (getZonesToReload returns null). In our app we mostly have links and returning null works fine. On 2/21/06, Enrique Medina [EMAIL PROTECTED] wrote: Null? I remember some tests returning '' and getting a NullPointerException. What should be the reason why returning NULL should work?2006/2/21, Emmanuel Jay [EMAIL PROTECTED]:Hi Enrique, If you want you button or link action not to go through AA you have to return null for those in getZonesToReload. Hope that helps,EmmanuelOn 2/21/06, Enrique Medina [EMAIL PROTECTED] wrote: Hi,Has anyone successfully used Ajaxanywhere inside a JSF page with a piece of the page being ajaxed and the other piece not? Let me give an example: imagine a JSF page where the selection of a combo box must force the refresh of another combo box. This zone is ajaxed using aa:zoneJSF. But buttons to save or go to another page in the navigation are not ajaxed. My problem is that the ajaxed zone works great, but then I have a button to save, and another one to navigate to another page, and those buttons don't seem to work. When I click them a request is sended, but none of their respective actions are executed, no error messages are shown (I have a global tag in the page). It seems like a request with an action returning simply null (not doing anything). My _javascript_ for Ajaxanywhere looks like this: ajaxAnywhere.getZonesToReload = function(url,submitButton) { if (submitButton.id.equals('myAjaxButton') return dataZone; } ajaxAnywhere.formName = mainForm; ajaxAnywhere.substituteFormSubmitFunction(); ajaxAnywhere.substituteSubmitButtonsBehavior(true); What am I doing wrong? How do you have
Re: Ajaxanywhere
And more testing...I have downloaded the DEMO from the Ajaxanywhere site, and made a change on the facesFrame.jsp to make the Calculate price button non-ajaxed. And it does not work; i.e. if I quit the Calculate price from the ajaxed zones, then the action is never executed. From my experience, Ajaxanywhere does not work with a page combining ajaxed and non-ajaxed JSF actions.2006/2/21, Enrique Medina [EMAIL PROTECTED] :Definetively, I can't make it work. I've created a simple JSF page with two buttons: one is a save for the form and the other just navigates to another page (simulating a cancel action). The save button works great, but when I press the cancel/exit button, then nothing happens. I've been also doing some debugging, and when using Ajaxanywhere, the submit of the non-ajaxed button does not update the parameterRequestMap used after to decide whether it is an immediate request, etc.No idea of what I'm doing wrong Emmanuel can you please help? Can you provide some of your JSF pages? What version are you using? Are you working with buttons?Thanks. 2006/2/21, Enrique Medina [EMAIL PROTECTED]:Some more testing...If I remove all the JS I posted before, then the common JSF button works, and obviously my ajaxed zone is ignored and the page is completely refresehd; if I add it again, then the common JSF does not work, and obviously the ajxed zone works great. It's clear the problem comes with the JS and how does Ajaxanywhere handle the request...2006/2/21, Enrique Medina [EMAIL PROTECTED] :Hi again,I have tried the solution you proposed about returning null for non-ajaxed requests, but I can't get it to work :-( Here is my JS code:ajaxAnywhere.getZonesToReload = function(url, submitButton) { if (typeof submitButton != 'undefined') { if (submitButton.type == 'submit') { if ( submitButton.id.search('botonAjax') != -1) {return 'variablesSalidaList'; } } } return null;}ajaxAnywhere.formName = 'bodySubview:mainForm';ajaxAnywhere.substituteFormSubmitFunction (); ajaxAnywhere.substituteSubmitButtonsBehavior(true);As you can see, I evaluate the ID of the submitButton to be something like *botonAjax*, so I can differentiate from the other buttons. And in any other case, I always return null. But when I press a button out of the ajaxed zone, it simply does nothing (well, the request is made, and the page is refreshed, but no navigation to the new page). Any ideas of what could I be doing wrong? I'm convinced that maybe my problem has something to be with the JS code... or maybe not... 2006/2/21, Emmanuel Jay [EMAIL PROTECTED]:Yes our app has ajaxed and non ajaxed part. For example some parts can't be ajaxed at all, such as the part using the fileUpload component (as well as any get operation for that matter). Yes i use the link id to determine whether it is an Ajax request or not. Basically for a link it is: var linkFrom = this.findForm().elements[mainForm:_link_hidden_].value;P.S. I have my own problem with AA, seems that the dataScroller doesn't work well with AA (if you ever come accross that case I'll be glad to hear if you manage to solve it!) On 2/21/06, Enrique Medina [EMAIL PROTECTED] wrote: Umm, I see. So your application has JSF pages with parts ajaxed and other parts, as usual JSF requests, don't you? I'll try it and let you know whether it finally works or not.By the way, just for the sake of confirmation, is your JS code similar to mine? I mean, do you use the button or link ID to determine whether it's an ajaxed request or not? Thanks very much for your support.2006/2/21, Emmanuel Jay [EMAIL PROTECTED]: I think the AA filter is totally by passed if the list of zones to reload is null (getZonesToReload returns null). In our app we mostly have links and returning null works fine. On 2/21/06, Enrique Medina [EMAIL PROTECTED] wrote: Null? I remember some tests returning '' and getting a NullPointerException. What should be the reason why returning NULL should work?2006/2/21, Emmanuel Jay [EMAIL PROTECTED]:Hi Enrique, If you want you button or link action not to go through AA you have to return null for those in getZonesToReload. Hope that helps,EmmanuelOn 2/21/06, Enrique Medina [EMAIL PROTECTED] wrote: Hi,Has anyone successfully used Ajaxanywhere inside a JSF page with a piece of the page being ajaxed and the other piece not? Let me give an example: imagine a JSF page where the selection of a combo box must force the refresh of another combo box. This zone is ajaxed using aa:zoneJSF. But buttons to save or go to another page in the navigation are not ajaxed. My problem is that the ajaxed zone works great, but then I have a button to save, and another one to navigate to another page, and those buttons don't seem to work. When I click them a request is sended, but none of their respective actions are executed, no error messages are shown (I have a global tag in the page). It seems
Re: Ajaxanywhere
Well, the fact is that the Ajaxanywhere example does not work either, because I modified it to add non-ajaxed request, and happens like in my application, nothing...2006/2/21, Emmanuel Jay [EMAIL PROTECTED]:No I am working mostly with commandLink and it works fine, i.e. combining ajaxed and non ajaxed actions is fine for me. Have you tried your test case with a link rather than a button (that might be a good test to make sure it is not an issue), are you sure that your js picks up the correct button id, i.e that the correct zones are returned. Looks to me that the id might be wrong, try to add some js alert to make sure that the correct zones are returned (or null if the AA filter should be bypassed). (I am actually using a build of AA that I have built from their CVS source. This is because I had found a bug that was causing dynamically generated UI (and bindings) not to work with the version of MyFaces I was using.) On 2/21/06, Enrique Medina [EMAIL PROTECTED] wrote: And more testing...I have downloaded the DEMO from the Ajaxanywhere site, and made a change on the facesFrame.jsp to make the Calculate price button non-ajaxed. And it does not work; i.e. if I quit the Calculate price from the ajaxed zones, then the action is never executed. From my experience, Ajaxanywhere does not work with a page combining ajaxed and non-ajaxed JSF actions. 2006/2/21, Enrique Medina [EMAIL PROTECTED] : Definetively, I can't make it work. I've created a simple JSF page with two buttons: one is a save for the form and the other just navigates to another page (simulating a cancel action). The save button works great, but when I press the cancel/exit button, then nothing happens. I've been also doing some debugging, and when using Ajaxanywhere, the submit of the non-ajaxed button does not update the parameterRequestMap used after to decide whether it is an immediate request, etc.No idea of what I'm doing wrong Emmanuel can you please help? Can you provide some of your JSF pages? What version are you using? Are you working with buttons?Thanks. 2006/2/21, Enrique Medina [EMAIL PROTECTED]: Some more testing...If I remove all the JS I posted before, then the common JSF button works, and obviously my ajaxed zone is ignored and the page is completely refresehd; if I add it again, then the common JSF does not work, and obviously the ajxed zone works great. It's clear the problem comes with the JS and how does Ajaxanywhere handle the request... 2006/2/21, Enrique Medina [EMAIL PROTECTED] : Hi again,I have tried the solution you proposed about returning null for non-ajaxed requests, but I can't get it to work :-( Here is my JS code:ajaxAnywhere.getZonesToReload = function(url, submitButton) { if (typeof submitButton != 'undefined') { if (submitButton.type == 'submit') { if ( submitButton.id.search('botonAjax') != -1) {return 'variablesSalidaList'; } } } return null;}ajaxAnywhere.formName = 'bodySubview:mainForm'; ajaxAnywhere.substituteFormSubmitFunction ();ajaxAnywhere.substituteSubmitButtonsBehavior(true);As you can see, I evaluate the ID of the submitButton to be something like *botonAjax*, so I can differentiate from the other buttons. And in any other case, I always return null. But when I press a button out of the ajaxed zone, it simply does nothing (well, the request is made, and the page is refreshed, but no navigation to the new page). Any ideas of what could I be doing wrong? I'm convinced that maybe my problem has something to be with the JS code... or maybe not... 2006/2/21, Emmanuel Jay [EMAIL PROTECTED]: Yes our app has ajaxed and non ajaxed part. For example some parts can't be ajaxed at all, such as the part using the fileUpload component (as well as any get operation for that matter). Yes i use the link id to determine whether it is an Ajax request or not. Basically for a link it is: var linkFrom = this.findForm().elements[mainForm:_link_hidden_].value;P.S. I have my own problem with AA, seems that the dataScroller doesn't work well with AA (if you ever come accross that case I'll be glad to hear if you manage to solve it!) On 2/21/06, Enrique Medina [EMAIL PROTECTED] wrote: Umm, I see. So your application has JSF pages with parts ajaxed and other parts, as usual JSF requests, don't you? I'll try it and let you know whether it finally works or not. By the way, just for the sake of confirmation, is your JS code similar to mine? I mean, do you use the button or link ID to determine whether it's an ajaxed request or not? Thanks very much for your support. 2006/2/21, Emmanuel Jay [EMAIL PROTECTED]: I think the AA filter is totally by passed if the list of zones to reload is null (getZonesToReload returns null) . In our app we mostly have links and returning null works fine. On 2/21/06, Enrique Medina [EMAIL PROTECTED] wrote: Null? I remember some tests returning '' and getting
Re: expand tree2
Hi Eve,Could you please share the code with us?Thanks.2006/2/19, eve [EMAIL PROTECTED]: is it possible to display tree2 initially all expanded?thanksevei solved the problem:)
Re: expand tree2
Hi,Could you please paste here how you solved it programmatically?Thanks.2006/2/19, eve [EMAIL PROTECTED]: is it possible to display tree2 initially all expanded?thankseve i solved the problem:)
Dynamic multiple selection list with Javascript breaks JSF
Hi,I'm trying to do a simple multiple selection list where the user can add String values. The operation for adding these values is through a simple _javascript_ method, using the new Option mechanism.However, when the form is submitted, I always get a Validation error. Going through the code, I see that at some point the component expects the value to be a SelectItem object, but obviously it isn't, as it has been added dynamically using _javascript_. I was wondering whether this is the correct bahaviour or I am missing something, because I can't make a simple selection list work :-(Regards,Enrique Medina.
Re: Dynamic multiple selection list with Javascript breaks JSF
Hi Emily,You're right. Obviously the better way to accomplish it would be to make a request on each addition, in order to update the SelectItems list for the component. I'm going to try this, but with Ajaxanywhere, just to save the user from the page refresh each time she adds an item. Regards,Enrique Medina.2006/2/18, Emily Gu [EMAIL PROTECTED]: Since you have used _javascript_ to add options into the selection list, it only knows by the client not the server. You will have to put those added values in a hidden field, then getthem after the form submission instead of getting it from the selection list directly. That's one of workaround I used. I don't know whether there is any other way to do it. Good luck, Emily On 2/18/06, Enrique Medina [EMAIL PROTECTED] wrote: Hi,I'm trying to do a simple multiple selection list where the user can add String values. The operation for adding these values is through a simple _javascript_ method, using the new Option mechanism. However, when the form is submitted, I always get a Validation error. Going through the code, I see that at some point the component expects the value to be a SelectItem object, but obviously it isn't, as it has been added dynamically using _javascript_. I was wondering whether this is the correct bahaviour or I am missing something, because I can't make a simple selection list work :-(Regards,Enrique Medina.
Re: HttpSessionListener --How to react, when Session is not valid anymore
Just for curiosityWhy are those 2 ThreadLocal variables defined? What are they used for?2006/2/14, Frank Felix Debatin [EMAIL PROTECTED]: Hi Andy,we solved this using a Servlet filter. See below for implementation. It assumes that there is a userId set in the session mapping. If you don'tneed that, you need to do a httpRequest.getSession(false) and simply testwhether ist null or not.HTHFrank Felix public class SessionTracker implements Filter{private static final Log log =LogFactory.getLog(SessionTracker.class);private static ThreadLocalHttpSession _httpSession = new ThreadLocalHttpSession();private static ThreadLocalHttpServletRequest _httpRequest = newThreadLocalHttpServletRequest();/** * Initialize. */ public void init(FilterConfig config){log.debug(initializing);}/** * Finish. */public void destroy(){ log.debug(destroy);}/** * Remember http session in current thread and * check authentification. */public void doFilter(ServletRequest request, ServletResponse response,FilterChain chain)throws IOException, ServletException{// determine http sessionHttpSession httpSession = null;if (request!=null (request instanceof HttpServletRequest)) {HttpServletRequest httpRequest =(HttpServletRequest)request;httpSession = httpRequest.getSession(true);_httpRequest.set(httpRequest);_httpSession.set(httpSession); // check whether we need authentication, if yes, check if// authenticated (could also be the other way round...)if (isProtected(httpRequest.getRequestURI())) {Object object = (httpSession.getAttribute( userId));if (object==null){// not logged in, redirect redirectToLoginPage(response);return;}}}chain.doFilter(request, response); _httpRequest.set(null);_httpSession.set(null);}/** * Returns true if this path requires a login. */private boolean isProtected(String path) {// add your code here}/** * Does a redirect to the login page. */private void redirectToLoginPage(ServletResponse response){if (log.isDebugEnabled ()){log.debug(trying a redirect to the login page);}try{HttpServletResponsehttpResponse =(HttpServletResponse)response; httpResponse.reset();httpResponse.sendRedirect(httpResponse.encodeRedirectURL(// add your URL here)); }catch (Exception exc){log.warn(could not redirect to login page, exc);}}/** * Current http session. * * @return the current session */public static HttpSession getHttpSession(){return _httpSession.get();}/** * Current http request. * * @return the current request */public static HttpServletRequest getHttpRequest(){return _httpRequest.get();}}-Original Message-From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]Sent: Tuesday, February 14, 2006 2:45 PMTo: users@myfaces.apache.org Subject: AW: HttpSessionListener --How to react, when Session is not validanymoreSo what can I do in my case?Is there another possibility to react on a session Timeput and redirectionof the user? Regards,Andy-Ursprüngliche Nachricht-Von: Matthias Wessendorf [mailto:[EMAIL PROTECTED]]Gesendet: Dienstag, 14. Februar 2006 14:41An: MyFaces Discussion Betreff: Re: HttpSessionListener --How to react, when Session is not validanymoreHi Andreas,for each request there is one FacesContext obj, so it is not associated tothe user's (http) session. -MatthiasOn 2/14/06, [EMAIL PROTECTED] [EMAIL PROTECTED]wrote: Hi! I have just implemented a HttpSessionListener to react on the event, when the session is not valid anymore. Now I want to redirect the user to my login page again, when the session is timed out... The Problem is, that the FacesContext is also null, when the session is timed out... So how can I do a redirect, if I don't have a FacesContext? So my listener looks like this: public final class MyContextListener implements HttpSessionListener { public void sessionCreated(HttpSessionEvent arg0) { // TODO Auto-generated method stub } public void sessionDestroyed(HttpSessionEvent arg0) { System.out.println(SESSION ABGELAUFEN); HttpServletRequest req = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest(); HttpServletResponse res =(HttpServletResponse)FacesContext.getCurrentInstance().getExternalCon text().getResponse(); try { req.getRequestDispatcher(/logout.jsp).forward(req, res); }catch (ServletException e2) { e2.printStackTrace(); } catch (IOException e2) { e2.printStackTrace();} } } __ Diese Nachricht ist fuer die MAGNA STEYR Fahrzeugtechnik AG Co KG rechtsunverbindlich! - This message is not legally binding upon MAGNA STEYR Fahrzeugtechnik AG Co KG! This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify your system manager. This footnote also confirms that this email message has been swept for the presence ofcomputer viruses. __--Matthias Wessendorf Zülpicher Wall 12,
Re: Using HtmlPanelGrid with an odd amount of children?
Well, you can always complete the missing childs with:t:panelGroup/2006/2/2, Matthias Kahlau [EMAIL PROTECTED]: Hi!Is it legal to use HtmlPanelGrid with an odd amount of children? I canrecall some warnings shown in the logging output when not all possible cellsare used, but it's only a warning - the rendered grid looks correct. Will the warning behaviour change to legal in the future, or shouldn't I usean odd number, but use invisible fillers?Regards,Matthias
Re: JSF+Hibernate
Some questions:1) Do you use the Open Session in View filter pattern?2) Is your backing bean request-scoped or session-scoped or application-scoped?2006/2/2, ::SammyRulez:: [EMAIL PROTECTED]:Hi allI have a form for some data entry and a data table displaying the rows already entered in the same view.Everything works great except update. Since the restore view phaseoccurs data is loaded and is I try to update I have an Hibernateexception since there is another object in the session with the same type and ID.(witch is correct.)Is there any good approach to this problem without scrolling the listupdate the values and flushing the session?BTW form validation is required :-(--::SammyRulez:: http://sammyprojectz.blogspot.com
Re: JSF+Hibernate
Ok. Then the problem is clear. As the pattern creates for you a new session in each request, the object you are trying to update is DETACHED, so unless you associate to a PERSISTENT instance in the current session, you will get the error. But as I can imagine this is not possible, you will have just to reattach the object to the current session, by using: session.lock(object, LockMode.NONE)in your backing bean.But I would suggest to make your backing bean session-scoped, and also to enable the second-level cache ;-) 2006/2/2, ::SammyRulez:: [EMAIL PROTECTED]: 1) yes2) request-scoped2006/2/2, Enrique Medina [EMAIL PROTECTED]: Some questions: 1) Do you use the Open Session in View filter pattern? 2) Is your backing bean request-scoped or session-scoped or application-scoped? 2006/2/2, ::SammyRulez:: [EMAIL PROTECTED]: Hi all I have a form for some data entry and a data table displaying the rows already entered in the same view. Everything works great except update. Since the restore view phase occurs data is loaded and is I try to update I have an Hibernate exception since there is another object in the session with the same type and ID.(witch is correct.) Is there any good approach to this problem without scrolling the list update the values and flushing the session? BTW form validation is required :-( -- ::SammyRulez:: http://sammyprojectz.blogspot.com --::SammyRulez:: http://sammyprojectz.blogspot.com
Re: How to do Javascript Alert when pressing a button in ADF/JSF
Take a look at:http://wiki.apache.org/myfaces/_javascript_WithJavaServceFaces2006/1/26, Debatin, Frank Felix [EMAIL PROTECTED]:Hello,we're a (very happy) user of ADF faces. There is one thing that we didn't find a solution for:User presses a button, let's say delete. We want a message box topopup (_javascript_ alert?), that says something like Are you sure todelete? Y/N, and then continue standard processing if the user answers yes (invoking the action).Any ideas? Did we maybe overlook something simple and straightforward?Is there the same problem in standard JSF? We are aware of the popupdialog features in ADF, but would like to avoid them for well-known reasons.RegardsFrank Felix
Re: Dynamically refer to a component from another component
Hi Simon,Yes, that was exactly the point. It's as easy as adding all the children, and at the end of the tree component creation, call to getClientId().Thanks a lot for your support. 2006/1/19, Simon Kitching [EMAIL PROTECTED]: I believe Volker's answer is exactly what you're looking for. UnlessI've misunderstood your question, method getClientId is what you want;you just need to make sure the component is attached to the view treebefore calling that method. ie:UIOutput texto4 = createComponent(..);texto4.setId(texto4);// parent is expected to already be attached to the view tree.parent.getChildren().add(texto4);// do this only after adding to view tree. You'll then get the // full final id of the component, eg form1:subview1:table3:texto4String texto4ClientId = texto4.getClientId(facesContext);// use texto4ClientId in _javascript_ emitted for some other component If you need to find the texto4 client from some other renderer, youcan search for it:UIOutput text05 = createComponent(..);// find a component with the specified name within the same // naming container as the component the find is invoked onUIOutput targetComponent = parent.findComponent(texto4);String targetClientId = targetComponent.getClientId();// use targetClientId in _javascript_ emitted for texto5 component Note also that component ids starting with underscores are reserved forthe use of the JSF framework; any id you assign explicitly should *not*start with an underscore.Regards,Simon On Thu, 2006-01-19 at 16:49 +0100, Enrique Medina wrote: See what is generated at runtime: input id=bodySubview:_id23:tablaEdicionPuntuaciones0_1:_id24_4_0:_input name=bodySubview:_id23:tablaEdicionPuntuaciones0_1:_id24_4_0:_input type= text value=12 > class=txt / And obviously, a component with _input ID does not exist, because as being contained, the ID generated for the input component is different... 2006/1/19, Volker Weber [EMAIL PROTECTED] : Hi, you can get the rendered 'htmlId' of a component by component.getCientId(facesContext); so you can do : UIOutput texto5 = (HtmlOutputText) FacesUtils.getApplication().createComponent( HtmlOutputText.COMPONENT_TYPE); texto5.getAttributes().put(onclick, validate(' + texto4.getClientId(facesContext) + ')); Regards, Volker Enrique Medina wrote: Also I forgot to say, that if I wanted to use the onclick method on the same UIInput component, I could define it easily by: texto4.getAttributes().put(onclick, validate( this.value)); As you can see, I know that 'this' refers to my component. But what happens if I need to refer to texto4 component value from another component. Imagine: UIOutput texto5 = (HtmlOutputText) FacesUtils.getApplication() .createComponent( HtmlOutputText.COMPONENT_TYPE); texto5.getAttributes().put(onclick, validate(XX)); where XX is a _javascript_ reference to the value of texto4.2006/1/19, Enrique Medina [EMAIL PROTECTED] mailto: [EMAIL PROTECTED]: Let me give a more detailed explanation of what I am trying to achieve.. In my application I need to work with data in a spreadsheet form, so I decided to use a PanelTabbed component, where each tab would contain a HtmlDataTable. All these would simulate an Excel page, where I can change the actual tab, make some modifications to the elements in the table, go to another tab, modify, etc, so at the end I would press the save button, and all the changes would be persisted to the DB. The big problem I had with defining this page was the fact that all the data that was used to populate the tables in each tab was not known at compile time, as it depended on the values entered by the user during the normal use of the application. So I had to create all the components dynamically through Java code. To accomplish this objective, I created a JSP file with simply a PanelTabbed tag that I binded to a property in my backing bean, so whenever JSF called my setBindedTabbedPane method, I could create all the tabs, tables, labels, inputs, etc, in code. Once done, everything was perfect, in the sense that my application was implemented to dynamically create all the components needed to simulate an Excel worksheet; i.e. dynamic number of columns and rows, dynamic number of tabs, etc. On the other hand, I have also added DWR to my application in order to use Ajax for particular purposes, like showing child data in a datatable, or simply validate some specific fields without having to make a JSF request. So I decided to add a DWR Ajax validate process to my recently created Excel worksheet. But the problem comes because when using DWR Ajax, I need to define a callback function in _javascript_ where I have to pass as a parameter the value that I want to be validated. As you already know, I am generating all the components dynamically in code, within a loop that reuses temporal variable names for the sake of performance and clearness. This means that I
Re: Dynamically refer to a component from another component
I have been implementing the dynamic creation of my tree component as you mentioned, i.e. adding all the components to their parents before calling getClientId().But it seems that there is something more to do, looking at the generated code: input id=tablaEdicionPuntuaciones0_0:_id30_0:_input name=tablaEdicionPuntuaciones0_0:_id30_0:_input type=text value=x+2 class=txt / nbsp;a href='#'img src= /DeltaR/images/check.gif alt=Validar height= 11 width=12 onclick=PuntuacionesAjax.validarFormula (respuestaValidacion, getElmById('tablaEdicionPuntuaciones0:_id30:_input').value); return true /Can you see that the input ID is tablaEdicionPuntuaciones0_0:_id30_0:_input , but the ID obtained from getClientId in the onclick method is tablaEdicionPuntuaciones0:_id30:_input , where there is a _0 missing? Any ideas?I assert that the call to getClientId within my code is the last call, but as I use an HtmlDataTable, maybe there is another part of the ID I'm missing... 2006/1/19, Simon Kitching [EMAIL PROTECTED]: I believe Volker's answer is exactly what you're looking for. UnlessI've misunderstood your question, method getClientId is what you want;you just need to make sure the component is attached to the view treebefore calling that method. ie:UIOutput texto4 = createComponent(..);texto4.setId(texto4);// parent is expected to already be attached to the view tree.parent.getChildren().add(texto4);// do this only after adding to view tree. You'll then get the // full final id of the component, eg form1:subview1:table3:texto4String texto4ClientId = texto4.getClientId(facesContext);// use texto4ClientId in _javascript_ emitted for some other component If you need to find the texto4 client from some other renderer, youcan search for it:UIOutput text05 = createComponent(..);// find a component with the specified name within the same // naming container as the component the find is invoked onUIOutput targetComponent = parent.findComponent(texto4);String targetClientId = targetComponent.getClientId();// use targetClientId in _javascript_ emitted for texto5 component Note also that component ids starting with underscores are reserved forthe use of the JSF framework; any id you assign explicitly should *not*start with an underscore.Regards,Simon On Thu, 2006-01-19 at 16:49 +0100, Enrique Medina wrote: See what is generated at runtime: input id=bodySubview:_id23:tablaEdicionPuntuaciones0_1:_id24_4_0:_input name=bodySubview:_id23:tablaEdicionPuntuaciones0_1:_id24_4_0:_input type= text value=12 > class=txt / And obviously, a component with _input ID does not exist, because as being contained, the ID generated for the input component is different... 2006/1/19, Volker Weber [EMAIL PROTECTED] : Hi, you can get the rendered 'htmlId' of a component by component.getCientId(facesContext); so you can do : UIOutput texto5 = (HtmlOutputText) FacesUtils.getApplication().createComponent( HtmlOutputText.COMPONENT_TYPE); texto5.getAttributes().put(onclick, validate(' + texto4.getClientId(facesContext) + ')); Regards, Volker Enrique Medina wrote: Also I forgot to say, that if I wanted to use the onclick method on the same UIInput component, I could define it easily by: texto4.getAttributes().put(onclick, validate( this.value)); As you can see, I know that 'this' refers to my component. But what happens if I need to refer to texto4 component value from another component. Imagine: UIOutput texto5 = (HtmlOutputText) FacesUtils.getApplication() .createComponent( HtmlOutputText.COMPONENT_TYPE); texto5.getAttributes().put(onclick, validate(XX)); where XX is a _javascript_ reference to the value of texto4.2006/1/19, Enrique Medina [EMAIL PROTECTED] mailto: [EMAIL PROTECTED]: Let me give a more detailed explanation of what I am trying to achieve.. In my application I need to work with data in a spreadsheet form, so I decided to use a PanelTabbed component, where each tab would contain a HtmlDataTable. All these would simulate an Excel page, where I can change the actual tab, make some modifications to the elements in the table, go to another tab, modify, etc, so at the end I would press the save button, and all the changes would be persisted to the DB. The big problem I had with defining this page was the fact that all the data that was used to populate the tables in each tab was not known at compile time, as it depended on the values entered by the user during the normal use of the application. So I had to create all the components dynamically through Java code. To accomplish this objective, I created a JSP file with simply a PanelTabbed tag that I binded to a property in my backing bean, so whenever JSF called my setBindedTabbedPane method, I could create all the tabs, tables, labels, inputs, etc, in code. Once done, everything was perfect, in the sense that my application was implemented to dynamically create all the components needed to simulate an Excel worksheet; i.e. dyna
Re: Dynamically refer to a component from another component
Well, the problem is that I'm creating the table in code using a DataModel for columns and a DataModel for rows, so at that time the row index is not known, is it?And as I assign the client ID at code, how can I know the row? 2006/1/20, Simon Kitching [EMAIL PROTECTED]: On Fri, 2006-01-20 at 11:22 +0100, Enrique Medina wrote: I have been implementing the dynamic creation of my tree component as you mentioned, i.e. adding all the components to their parents before calling getClientId(). But it seems that there is something more to do, looking at the generated code: input id=tablaEdicionPuntuaciones0_0:_id30_0:_inputThe extra _0 is because this input component is in the 0th row of a table. A table is also a naming container.In order to get the id for a component in a particular row of a table,call tableComponent.setRowIndex(index); someChildComponentOfTable.getClientId(facesContext); Normally the above is not necessary, as it's done implicitly by theframework; the renderer for some component in a table is called once foreach row of the table, and the component's clientId is set at that time. That's the normal JSF way of rendering: let the framework make callsinto the renderer with everything configured correctly. If you'resomehow driving rendering while bypassing the normal flow you'll need to ensure the rowIndex is set correctly.If you're not getting the _0 row bit, then clearly your rendering codeis not being called in the normal rendering flow.Regards,Simon
Re: Dynamically refer to a component from another component
Simon,The problem is that I don't know how many rows I will have, as it depens on the data the user enters in the normal use of the application.And I need to manipulate the value of the input object using _javascript_, but the value itself must be indicated in code the way you told me in your previous email. See what I mean? 2006/1/20, Simon Kitching [EMAIL PROTECTED]: If your component is a column in a table, and the table has 5 rows thenthere will be 5 HTML tags generated for that component. Each needs adistinct id according to the rules for HTML.If you're planning on manipulating those objects in _javascript_, your _javascript_ needs to handle the fact that there are 5 of those HTMLelements around. That's not JSF-specific, that's the nature of theproblem.On Fri, 2006-01-20 at 11:49 +0100, Enrique Medina wrote: Well, the problem is that I'm creating the table in code using a DataModel for columns and a DataModel for rows, so at that time the rowindex is not known, is it? And as I assign the client ID at code, how can I know the row? 2006/1/20, Simon Kitching [EMAIL PROTECTED]: On Fri, 2006-01-20 at 11:22 +0100, Enrique Medina wrote: I have been implementing the dynamic creation of my tree component as you mentioned, i.e. adding all the components to their parents before calling getClientId(). But it seems that there is something more to do, looking at the generated code: input id=tablaEdicionPuntuaciones0_0:_id30_0:_input The extra _0 is because this input component is in the 0th row of a table. A table is also a naming container. In order to get the id for a component in a particular row of a table, call tableComponent.setRowIndex(index);someChildComponentOfTable.getClientId(facesContext); Normally the above is not necessary, as it's done implicitly by the framework; the renderer for some component in a table is called once for each row of the table, and the component's clientId is set at that time. That's the normal JSF way of rendering: let the framework make calls into the renderer with everything configured correctly. If you're somehow driving rendering while bypassing the normal flow you'll need to ensure the rowIndex is set correctly. If you're not getting the _0 row bit, then clearly your rendering code is not being called in the normal rendering flow. Regards, Simon
Re: Dynamically refer to a component from another component
I see. But it's not that exactly. Suppose I have a button associated to each INPUT object, that when clicked must perform a particular action for the value of the INPUT associated, not another... 2006/1/20, Simon Kitching [EMAIL PROTECTED]: On Fri, 2006-01-20 at 12:04 +0100, Enrique Medina wrote: Simon, The problem is that I don't know how many rows I will have, as it depens on the data the user enters in the normal use of the application. And I need to manipulate the value of the input object using _javascript_, but the value itself must be indicated in code the way you told me in your previous email. See what I mean? So you have some component (eg a button) that when clicked needs toperform some operation on each row of column N in a table?Then how about having each of your (custom) components in a table emitscript like: scriptregister_name_field('client-id-goes-here');/scriptYou provide a _javascript_ function register_name_field that adds theparameter to a list variable in the page. Result: as the html page is processed, each such component adds its id to a list that can beaccessed later.Regards,Simon
Re: Dynamically refer to a component from another component
For those who might be interested...FInally I solved my problem. When the dataTable is being rendered, then it uses both the row number and the col number to generate the IDs, so I made use of the rowIndexVar and var properties of DataTable and UIColumns respectively to be able to access this information at runtime through EL. Then I created a simple _javascript_ function that replaced the ID I had at my code, with the extra information of rows and cols. Works like a charmThanks very much again for those who have given me help and tips ;-)2006/1/20, Enrique Medina [EMAIL PROTECTED] :I see. But it's not that exactly. Suppose I have a button associated to each INPUT object, that when clicked must perform a particular action for the value of the INPUT associated, not another... 2006/1/20, Simon Kitching [EMAIL PROTECTED]: On Fri, 2006-01-20 at 12:04 +0100, Enrique Medina wrote: Simon, The problem is that I don't know how many rows I will have, as it depens on the data the user enters in the normal use of the application. And I need to manipulate the value of the input object using _javascript_, but the value itself must be indicated in code the way you told me in your previous email. See what I mean? So you have some component (eg a button) that when clicked needs toperform some operation on each row of column N in a table?Then how about having each of your (custom) components in a table emitscript like: scriptregister_name_field('client-id-goes-here');/scriptYou provide a _javascript_ function register_name_field that adds theparameter to a list variable in the page. Result: as the html page is processed, each such component adds its id to a list that can beaccessed later.Regards,Simon
Re: unencode # encodings in javascript
Hi Mario,I have just implemented your workaround and it also works great for me.But shouldn't it be a more generic and straightforward mechanism to solve this problem? To the best of my knowledge, the problem is with the class HTMLEncoder, and particularly with this method: public static String encode (String string,boolean encodeNewline,boolean encodeSubsequentBlanksToNbsp,boolean encodeNonLatin) where this code is executed: default : if (((int)c) = 0x80) { //encode all non basic latin characters app = # + ((int)c) + ;; } break;So my tildes in spanish are always encoded too. 2006/1/19, Mario Ivankovits [EMAIL PROTECTED]: Hi! What I need now is a _javascript_ function to unencode this string - is there already something in myfaces of do one know a library for this.Thanks for your tips.*) \u - you cant convert a # to \u (even if its the same code what I don't know now) - however \u will be evaluated at parsing time, so youcant do something like alert(string.replace(#, \u)) nor \\u*) I have absolutely no clue why the \ stuff works, and here I had no luck with it.So here is what I do now.There are only a handful places in our _javascript_ where we alertsomething to the user, I'll replace alert( by something like myAlert().In there, before passing the string to alert() I will convert the string using the following simple script:/** * decodes all #nnn; in the given text to its corresponding character */function decodeHexEntity(text){var entitySearch = /#[0-9]+;/g; var entity;while (entity = entitySearch.exec(text)){var charCode = entity[0].substring(2, entity[0].length -1);text = text.substring(0, entity.index)+ String.fromCharCode (charCode)+ text.substring(entity.index + entity[0].length);}return text;}Maybe not the most performant solution, but easily done and it wont beused in time critical _javascript_ code ;-) So maybe someone else might find it useful too.Ciao,Mario
Re: unencode # encodings in javascript
Looking forward to hearing your investigations then... ;-)2006/1/19, Mario Ivankovits [EMAIL PROTECTED]: Hi Enrique! But shouldn't it be a more generic and straightforward mechanism to solve this problem? To the best of my knowledge, the problem is with the class HTMLEncoder, and particularly with this method: Thanks for begging me - not sure if this is the correct word ;-) . Itforced me to dig a little bit deeper into the problem.It looks like I found the real problem now. By design, if you use UTF-8 NO encoding at all should be done.It has something to do with the ExtensionsFilter, in more detail withAddResource.writeWithFullHeader.There a ResponseWriter WITHOUT ENCODING will be instantiated and thus it will use ISO-8859-1 by default - WOHA!!!I'll try to fix this Ciao,Mario
Re: Dynamically refer to a component from another component
Hi Simon,I mean accesing one component to another from inside the same bean2006/1/19, Simon Kitching [EMAIL PROTECTED]: http://wiki.apache.org/myfaces/AccessingOneManagedBeanFromAnother On Thu, 2006-01-19 at 12:57 +0100, Enrique Medina wrote: Anyone can give me some hints on how to refer from one component to another using EL, or maybe when creating the components dynamically through code?
Re: JSF Components For Acegi Security Framework
Hi,First of all, I really like that logo from Barça in your page ;-)Second, how did you manage to inject the Acegi framework into JSF at the first login page?2006/1/19, Cagatay Civici [EMAIL PROTECTED]:Hi, I've implemented custom jsf components that can be used to integrate Acegi into JSF. Acegi has built-in JSP tags for securing components but no support for JSF, my aim is to do the same thing for the JSF environment. Related information can be found at my blog;http://www.jroller.com/page/cagataycivici?entry=acegi_jsf_components_hit_the I've released the component in sourceforge jsf-comp. The component is under Apache License. http://sourceforge.net/projects/jsf-comp/If you are planning to use JSF-Spring-Acegi together in your applications, this component could be a possible solution. Regards,Cagatay Civici
Re: Dynamically refer to a component from another component
But I don't want to inject another bean. When I talk about components I mean view components in the model component; e.g. refer to an HtmlInputText from another HtmlOutputText.The problem I have is that I need to refer to the value of one component from another one in code, and both of them are dynamically created in the same backing bean. 2006/1/19, Mario Ivankovits [EMAIL PROTECTED]: Hi Enrique!But this is what Simon tries to show you.Its possible to inject the other bean instance or to look it up throughthe context.Ciao,Mario Hi Simon, I mean accesing one component to another from inside the same bean 2006/1/19, Simon Kitching [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]: http://wiki.apache.org/myfaces/AccessingOneManagedBeanFromAnother http://wiki.apache.org/myfaces/AccessingOneManagedBeanFromAnother On Thu, 2006-01-19 at 12:57 +0100, Enrique Medina wrote: Anyone can give me some hints on how to refer from one component to another using EL, or maybe when creating the components dynamically through code?--Mario
Re: Dynamically refer to a component from another component
Hi Jesse,The problem is I don't know the HTML ID until the page is rendered, and that ID is the one I want to refer in code, as it will be the input to a _javascript_ method.2006/1/19, Jesse Alexander (KBSA 21) [EMAIL PROTECTED]: Do you know the parent bean? Do you know the id of the othercomponent? findComponent(java.lang.Stringexpr) Search for and return the UIComponent with an id that matches the specified search _expression_ (if any), according to the algorithm described below. This method exists in UIComponent Could this be a ticket to ride? Alexander From: Enrique Medina [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 19, 2006 2:48 PMTo: MyFaces DiscussionSubject: Re: Dynamically refer to a component from another component But I don't want to inject another bean. When I talk about components I mean view components in the model component; e.g. refer to an HtmlInputText from another HtmlOutputText.The problem I have is that I need to refer to the value of one component from another one in code, and both of them are dynamically created in the same backing bean. 2006/1/19, Mario Ivankovits [EMAIL PROTECTED]: Hi Enrique!But this is what Simon tries to show you.Its possible to inject the other bean instance or to look it up throughthe context.Ciao,Mario Hi Simon, I mean accesing one component to another from inside the same bean 2006/1/19, Simon Kitching [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]: http://wiki.apache.org/myfaces/AccessingOneManagedBeanFromAnother http://wiki.apache.org/myfaces/AccessingOneManagedBeanFromAnother On Thu, 2006-01-19 at 12:57 +0100, Enrique Medina wrote: Anyone can give me some hints on how to refer from one component to another using EL, or maybe when creating the components dynamically through code?--Mario
Re: Dynamically refer to a component from another component
Let me give a more detailed explanation of what I am trying to achieve..In my application I need to work with data in a spreadsheet form, so I decided to use a PanelTabbed component, where each tab would contain a HtmlDataTable. All these would simulate an Excel page, where I can change the actual tab, make some modifications to the elements in the table, go to another tab, modify, etc, so at the end I would press the save button, and all the changes would be persisted to the DB. The big problem I had with defining this page was the fact that all the data that was used to populate the tables in each tab was not known at compile time, as it depended on the values entered by the user during the normal use of the application. So I had to create all the components dynamically through Java code. To accomplish this objective, I created a JSP file with simply a PanelTabbed tag that I binded to a property in my backing bean, so whenever JSF called my setBindedTabbedPane method, I could create all the tabs, tables, labels, inputs, etc, in code. Once done, everything was perfect, in the sense that my application was implemented to dynamically create all the components needed to simulate an Excel worksheet; i.e. dynamic number of columns and rows, dynamic number of tabs, etc. On the other hand, I have also added DWR to my application in order to use Ajax for particular purposes, like showing child data in a datatable, or simply validate some specific fields without having to make a JSF request. So I decided to add a DWR Ajax validate process to my recently created Excel worksheet. But the problem comes because when using DWR Ajax, I need to define a callback function in _javascript_ where I have to pass as a parameter the value that I want to be validated. As you already know, I am generating all the components dynamically in code, within a loop that reuses temporal variable names for the sake of performance and clearness. This means that I use the FacesContext.getApplication().createComponent() to create every component, but reusing the same variable in the loop, as I don't know how many components will I have to create (i.e. how many inputs or datatables or tabs). To better clarify, imagine that I want to add a _javascript_ call in the onclick method of an input text box. When creating the component dynamically, I could do: UIInput texto4 = (HtmlInputText) FacesUtils.getApplication() .createComponent(HtmlInputText.COMPONENT_TYPE); texto4.getAttributes().put(styleClass, txt); texto4 .setValueBinding( rendered, FacesUtils .getValueBinding(#{puntuacionesBean.mapaScoreboardPuntuaciones[' + codigoGrupo + '].puntuacionColumna != null})); texto4 .setValueBinding( value, FacesUtils .getValueBinding(#{puntuacionesBean.mapaScoreboardPuntuaciones[' + codigoGrupo + '].puntuacionColumna})); Please notice that this piece of code will be executed for each input text box that is needed. If I set the Id with: texto4.setId(_input);Then this ID will be used as the last part of the HTML generated ID when rendering the page, so there is no way to know it when writing this code in the backing bean. So in the end, my question was about how could I know that ID at runtime. I mean, I can use EL to bind values with my objects' properties, but could I also do something similar with component attributes? 2006/1/19, Volker Weber [EMAIL PROTECTED]: Hi,Enrique Medina wrote: But I don't want to inject another bean. When I talk about components I mean view components in the model component; e.g. refer to an HtmlInputText from another HtmlOutputText. The problem I have is that I need to refer to the value of one component from another one in code, and both of them are dynamically created in the same backing bean.If you create the components you can store references to them in your bean. Ohterwise you need to walk through the component tree, or try to fetchthem via findComponent(id) method.Regards,Volker--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 byconcatenating my forename to my senders domain.
Re: Dynamically refer to a component from another component
Also I forgot to say, that if I wanted to use the onclick method on the same UIInput component, I could define it easily by: texto4.getAttributes().put(onclick, validate(this.value)); As you can see, I know that 'this' refers to my component. But what happens if I need to refer to texto4 component value from another component. Imagine: UIOutput texto5 = (HtmlOutputText) FacesUtils.getApplication() .createComponent(HtmlOutputText.COMPONENT_TYPE); texto5.getAttributes().put(onclick, validate(XX));where XX is a _javascript_ reference to the value of texto4. 2006/1/19, Enrique Medina [EMAIL PROTECTED]: Let me give a more detailed explanation of what I am trying to achieve..In my application I need to work with data in a spreadsheet form, so I decided to use a PanelTabbed component, where each tab would contain a HtmlDataTable. All these would simulate an Excel page, where I can change the actual tab, make some modifications to the elements in the table, go to another tab, modify, etc, so at the end I would press the save button, and all the changes would be persisted to the DB. The big problem I had with defining this page was the fact that all the data that was used to populate the tables in each tab was not known at compile time, as it depended on the values entered by the user during the normal use of the application. So I had to create all the components dynamically through Java code. To accomplish this objective, I created a JSP file with simply a PanelTabbed tag that I binded to a property in my backing bean, so whenever JSF called my setBindedTabbedPane method, I could create all the tabs, tables, labels, inputs, etc, in code. Once done, everything was perfect, in the sense that my application was implemented to dynamically create all the components needed to simulate an Excel worksheet; i.e. dynamic number of columns and rows, dynamic number of tabs, etc. On the other hand, I have also added DWR to my application in order to use Ajax for particular purposes, like showing child data in a datatable, or simply validate some specific fields without having to make a JSF request. So I decided to add a DWR Ajax validate process to my recently created Excel worksheet. But the problem comes because when using DWR Ajax, I need to define a callback function in _javascript_ where I have to pass as a parameter the value that I want to be validated. As you already know, I am generating all the components dynamically in code, within a loop that reuses temporal variable names for the sake of performance and clearness. This means that I use the FacesContext.getApplication().createComponent() to create every component, but reusing the same variable in the loop, as I don't know how many components will I have to create (i.e. how many inputs or datatables or tabs). To better clarify, imagine that I want to add a _javascript_ call in the onclick method of an input text box. When creating the component dynamically, I could do: UIInput texto4 = (HtmlInputText) FacesUtils.getApplication() .createComponent(HtmlInputText.COMPONENT_TYPE); texto4.getAttributes().put(styleClass, txt); texto4 .setValueBinding( rendered, FacesUtils .getValueBinding(#{puntuacionesBean.mapaScoreboardPuntuaciones[' + codigoGrupo + '].puntuacionColumna != null})); texto4 .setValueBinding( value, FacesUtils .getValueBinding(#{puntuacionesBean.mapaScoreboardPuntuaciones[' + codigoGrupo + '].puntuacionColumna})); Please notice that this piece of code will be executed for each input text box that is needed. If I set the Id with: texto4.setId(_input);Then this ID will be used as the last part of the HTML generated ID when rendering the page, so there is no way to know it when writing this code in the backing bean. So in the end, my question was about how could I know that ID at runtime. I mean, I can use EL to bind values with my objects' properties, but could I also do something similar with component attributes? 2006/1/19, Volker Weber [EMAIL PROTECTED]: Hi,Enrique Medina wrote: But I don't want to inject another bean. When I talk about components I mean view components in the model component; e.g. refer to an HtmlInputText from another HtmlOutputText. The problem I have is that I need to refer to the value of one component from another one in code, and both of them are dynamically created in the same backing bean.If you create the components you can store references to them in your bean. Ohterwise you need to walk through the component tree, or try to fetchthem via findComponent(id) method.Regards,Volker--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 byconcatenating my forename to my senders domain.
Re: Dynamically refer to a component from another component
I tried that, but at the time of creating the component in code, texto4.getClientId(facesContext) returns exactly the same used before when texto4.setId(_input), so it doesn't help at all 2006/1/19, Volker Weber [EMAIL PROTECTED]: Hi,you can get the rendered 'htmlId' of a component bycomponent.getCientId(facesContext);so you can do :UIOutput texto5 = (HtmlOutputText) FacesUtils.getApplication() .createComponent( HtmlOutputText.COMPONENT_TYPE);texto5.getAttributes().put(onclick,validate(' + texto4.getClientId(facesContext) + '));Regards,VolkerEnrique Medina wrote: Also I forgot to say, that if I wanted to use the onclick method on the same UIInput component, I could define it easily by:texto4.getAttributes().put(onclick, validate( this.value)); As you can see, I know that 'this' refers to my component. But what happens if I need to refer to texto4 component value from another component. Imagine: UIOutput texto5 = (HtmlOutputText) FacesUtils.getApplication() .createComponent(HtmlOutputText.COMPONENT_TYPE); texto5.getAttributes().put(onclick, validate(XX)); where XX is a _javascript_ reference to the value of texto4. 2006/1/19, Enrique Medina [EMAIL PROTECTED] mailto: [EMAIL PROTECTED]: Let me give a more detailed explanation of what I am trying to achieve.. In my application I need to work with data in a spreadsheet form, so I decided to use a PanelTabbed component, where each tab would contain a HtmlDataTable. All these would simulate an Excel page, where I can change the actual tab, make some modifications to the elements in the table, go to another tab, modify, etc, so at the end I would press the save button, and all the changes would be persisted to the DB. The big problem I had with defining this page was the fact that all the data that was used to populate the tables in each tab was not known at compile time, as it depended on the values entered by the user during the normal use of the application. So I had to create all the components dynamically through Java code. To accomplish this objective, I created a JSP file with simply a PanelTabbed tag that I binded to a property in my backing bean, so whenever JSF called my setBindedTabbedPane method, I could create all the tabs, tables, labels, inputs, etc, in code. Once done, everything was perfect, in the sense that my application was implemented to dynamically create all the components needed to simulate an Excel worksheet; i.e. dynamic number of columns and rows, dynamic number of tabs, etc. On the other hand, I have also added DWR to my application in order to use Ajax for particular purposes, like showing child data in a datatable, or simply validate some specific fields without having to make a JSF request. So I decided to add a DWR Ajax validate process to my recently created Excel worksheet. But the problem comes because when using DWR Ajax, I need to define a callback function in _javascript_ where I have to pass as a parameter the value that I want to be validated. As you already know, I am generating all the components dynamically in code, within a loop that reuses temporal variable names for the sake of performance and clearness. This means that I use the FacesContext.getApplication().createComponent() to create every component, but reusing the same variable in the loop, as I don't know how many components will I have to create (i.e. how many inputs or datatables or tabs). To better clarify, imagine that I want to add a _javascript_ call in the onclick method of an input text box. When creating the component dynamically, I could do: UIInput texto4 = (HtmlInputText) FacesUtils.getApplication() .createComponent(HtmlInputText.COMPONENT_TYPE); texto4.getAttributes ().put(styleClass, txt); texto4 .setValueBinding( rendered, FacesUtils .getValueBinding(#{puntuacionesBean.mapaScoreboardPuntuaciones[' + codigoGrupo + '].puntuacionColumna != null})); texto4 .setValueBinding( value, FacesUtils .getValueBinding(#{puntuacionesBean.mapaScoreboardPuntuaciones[' + codigoGrupo + '].puntuacionColumna})); Please notice that this piece of code will be executed for each input text box that is needed. If I set the Id with: texto4.setId(_input); Then this ID will be used as the last part of the HTML generated ID when rendering the page, so there is no way to know it when writing this code in the backing bean. So in the end, my question was about how could I know that ID at runtime. I mean, I can use EL to bind values with my objects' properties, but could I also do something similar with component attributes? 2006/1/19, Volker Weber [EMAIL PROTECTED] mailto: [EMAIL PROTECTED]: Hi, Enrique Medina wrote: But I don't want to inject another bean. When I talk about components I mean view components in the model component; e.g. refer to an HtmlInputText from another HtmlOutputText. The problem I have is that I need to refer to the value of one component from another one in code, and both of them are dynamically created in the same backing
Re: Dynamically refer to a component from another component
See what is generated at runtime:input id=bodySubview:_id23:tablaEdicionPuntuaciones0_1:_id24_4_0:_input name=bodySubview:_id23:tablaEdicionPuntuaciones0_1:_id24_4_0:_input type= text value=12 onclick=myAlert(_input.value) class=txt /And obviously, a component with _input ID does not exist, because as being contained, the ID generated for the input component is different... 2006/1/19, Volker Weber [EMAIL PROTECTED]: Hi,you can get the rendered 'htmlId' of a component bycomponent.getCientId(facesContext);so you can do :UIOutput texto5 = (HtmlOutputText) FacesUtils.getApplication() .createComponent( HtmlOutputText.COMPONENT_TYPE);texto5.getAttributes().put(onclick,validate(' + texto4.getClientId(facesContext) + '));Regards,VolkerEnrique Medina wrote: Also I forgot to say, that if I wanted to use the onclick method on the same UIInput component, I could define it easily by:texto4.getAttributes().put(onclick, validate( this.value)); As you can see, I know that 'this' refers to my component. But what happens if I need to refer to texto4 component value from another component. Imagine: UIOutput texto5 = (HtmlOutputText) FacesUtils.getApplication() .createComponent(HtmlOutputText.COMPONENT_TYPE); texto5.getAttributes().put(onclick, validate(XX)); where XX is a _javascript_ reference to the value of texto4. 2006/1/19, Enrique Medina [EMAIL PROTECTED] mailto: [EMAIL PROTECTED]: Let me give a more detailed explanation of what I am trying to achieve.. In my application I need to work with data in a spreadsheet form, so I decided to use a PanelTabbed component, where each tab would contain a HtmlDataTable. All these would simulate an Excel page, where I can change the actual tab, make some modifications to the elements in the table, go to another tab, modify, etc, so at the end I would press the save button, and all the changes would be persisted to the DB. The big problem I had with defining this page was the fact that all the data that was used to populate the tables in each tab was not known at compile time, as it depended on the values entered by the user during the normal use of the application. So I had to create all the components dynamically through Java code. To accomplish this objective, I created a JSP file with simply a PanelTabbed tag that I binded to a property in my backing bean, so whenever JSF called my setBindedTabbedPane method, I could create all the tabs, tables, labels, inputs, etc, in code. Once done, everything was perfect, in the sense that my application was implemented to dynamically create all the components needed to simulate an Excel worksheet; i.e. dynamic number of columns and rows, dynamic number of tabs, etc. On the other hand, I have also added DWR to my application in order to use Ajax for particular purposes, like showing child data in a datatable, or simply validate some specific fields without having to make a JSF request. So I decided to add a DWR Ajax validate process to my recently created Excel worksheet. But the problem comes because when using DWR Ajax, I need to define a callback function in _javascript_ where I have to pass as a parameter the value that I want to be validated. As you already know, I am generating all the components dynamically in code, within a loop that reuses temporal variable names for the sake of performance and clearness. This means that I use the FacesContext.getApplication().createComponent() to create every component, but reusing the same variable in the loop, as I don't know how many components will I have to create (i.e. how many inputs or datatables or tabs). To better clarify, imagine that I want to add a _javascript_ call in the onclick method of an input text box. When creating the component dynamically, I could do: UIInput texto4 = (HtmlInputText) FacesUtils.getApplication() .createComponent(HtmlInputText.COMPONENT_TYPE); texto4.getAttributes ().put(styleClass, txt); texto4 .setValueBinding( rendered, FacesUtils .getValueBinding(#{puntuacionesBean.mapaScoreboardPuntuaciones[' + codigoGrupo + '].puntuacionColumna != null})); texto4 .setValueBinding( value, FacesUtils .getValueBinding(#{puntuacionesBean.mapaScoreboardPuntuaciones[' + codigoGrupo + '].puntuacionColumna})); Please notice that this piece of code will be executed for each input text box that is needed. If I set the Id with: texto4.setId(_input); Then this ID will be used as the last part of the HTML generated ID when rendering the page, so there is no way to know it when writing this code in the backing bean. So in the end, my question was about how could I know that ID at runtime. I mean, I can use EL to bind values with my objects' properties, but could I also do something similar with component attributes? 2006/1/19, Volker Weber [EMAIL PROTECTED] mailto: [EMAIL PROTECTED]: Hi, Enrique Medina wrote: But I don't want to inject another bean. When I talk about components I mean view components in the model component; e.g. refer
Re: Dynamically refer to a component from another component
So your answer means that there is no way to accomplish what I am trying, isn't it?Maybe using some kind of events, when the component is created to advise another one or so?2006/1/19, Volker Weber [EMAIL PROTECTED]: After adding the component to the component tree the full id shouldreturned. The structure of the tree is needed to create this id.This is what is done when rendering the 'htlmId' in the renderer.Without the tree structue there is no way to find the resulting clientId. Regards,VolkerEnrique Medina wrote: I tried that, but at the time of creating the component in code, texto4.getClientId(facesContext) returns exactly the same used before when texto4.setId(_input), so it doesn't help at all 2006/1/19, Volker Weber [EMAIL PROTECTED] mailto: [EMAIL PROTECTED]: Hi, you can get the rendered 'htmlId' of a component by component.getCientId(facesContext); so you can do : UIOutput texto5 = (HtmlOutputText) FacesUtils.getApplication().createComponent( HtmlOutputText.COMPONENT_TYPE); texto5.getAttributes().put(onclick, validate(' + texto4.getClientId(facesContext) + ')); Regards, Volker Enrique Medina wrote: Also I forgot to say, that if I wanted to use the onclick method on the same UIInput component, I could define it easily by: texto4.getAttributes().put(onclick, validate( this.value)); As you can see, I know that 'this' refers to my component. But what happens if I need to refer to texto4 component value from another component. Imagine: UIOutput texto5 = (HtmlOutputText) FacesUtils.getApplication() .createComponent(HtmlOutputText.COMPONENT_TYPE); texto5.getAttributes().put(onclick, validate(XX)); where XX is a _javascript_ reference to the value of texto4. 2006/1/19, Enrique Medina [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] mailto: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]: Let me give a more detailed explanation of what I am trying to achieve.. In my application I need to work with data in a spreadsheet form, so I decided to use a PanelTabbed component, where each tab would contain a HtmlDataTable. All these would simulate an Excel page, where I can change the actual tab, make some modifications to the elements in the table, go to another tab, modify, etc, so at the end I would press the save button, and all the changes would be persisted to the DB. The big problem I had with defining this page was the fact that all the data that was used to populate the tables in each tab was not known at compile time, as it depended on the values entered by the user during the normal use of the application. So I had to create all the components dynamically through Java code. To accomplish this objective, I created a JSP file with simply a PanelTabbed tag that I binded to a property in my backing bean, so whenever JSF called my setBindedTabbedPane method, I could create all the tabs, tables, labels, inputs, etc, in code. Once done, everything was perfect, in the sense that my application was implemented to dynamically create all the components needed to simulate an Excel worksheet; i.e. dynamic number of columns and rows, dynamic number of tabs, etc. On the other hand, I have also added DWR to my application in order to use Ajax for particular purposes, like showing child data in a datatable, or simply validate some specific fields without having to make a JSF request. So I decided to add a DWR Ajax validate process to my recently created Excel worksheet. But the problem comes because when using DWR Ajax, I need to define a callback function in _javascript_ where I have to pass as a parameter the value that I want to be validated. As you already know, I am generating all the components dynamically in code, within a loop that reuses temporal variable names for the sake of performance and clearness. This means that I use the FacesContext.getApplication ().createComponent() to create every component, but reusing the same variable in the loop, as I don't know how many components will I have to create (i.e. how many inputs or datatables or tabs). To better clarify, imagine that I want to add a _javascript_ call in the onclick method of an input text box. When creating the component dynamically, I could do: UIInput texto4 = (HtmlInputText) FacesUtils.getApplication() .createComponent( HtmlInputText.COMPONENT_TYPE); texto4.getAttributes ().put(styleClass, txt); texto4 .setValueBinding( rendered, FacesUtils .getValueBinding(#{puntuacionesBean.mapaScoreboardPuntuaciones [' + codigoGrupo + '].puntuacionColumna != null})); texto4 .setValueBinding( value, FacesUtils .getValueBinding(#{puntuacionesBean.mapaScoreboardPuntuaciones[' + codigoGrupo + '].puntuacionColumna})); Please notice that this piece of code will be executed for each input text box that is needed. If I set the Id with: texto4.setId(_input); Then this ID will be used as the last part of the HTML generated ID when rendering the page
Re: JSF Components For Acegi Security Framework
Hi Richard,That's what I meant in my previous email. Now I use a JSF page, doing some hooks to be able to call my bean and also login with Acegi, so I was wondering how did they solved it... 2006/1/19, Richard Wallace [EMAIL PROTECTED]: Very cool!What about a component for handling user logins?Or do you use aregular jsp/html page for submitting a form to thej_acegi_security_check url (or whatever your filter processing url mightbe)? Cagatay Civici wrote: Hi, I've implemented custom jsf components that can be used to integrate Acegi into JSF. Acegi has built-in JSP tags for securing components but no support for JSF, my aim is to do the same thing for the JSF environment. Related information can be found at my blog; http://www.jroller.com/page/cagataycivici?entry=acegi_jsf_components_hit_the I've released the component in sourceforge jsf-comp. The component is under Apache License. http://sourceforge.net/projects/jsf-comp/ If you are planning to use JSF-Spring-Acegi together in your applications, this component could be a possible solution. Regards, Cagatay Civici
Re: unencode # encodings in javascript
Hi,I face the same situation. The problem is that MyFaces encodes all HTML and all messages from the ResourceBundle, so the _javascript_ alert shows those annoying nnn; characters 2006/1/18, Werner Punz [EMAIL PROTECTED]:I do not know if there is a function but the \unnn notation works definitely with alerts:http://www.zid.tugraz.at/peter/_javascript_/unicode.htmlI am not sure but the #nnn notation might be unicode numbers so they might be the same numbers as in the \unnn notationMario Ivankovits schrieb: Hi! We merged our JSP project with JSF so we can slowly migrate to JSF at all. This has been done by heavily using the verbatim tag - and even if its butt ugly ;-) it works. Though, there is still one problem left. Now that the whole page renderes through the HtmlResponseWriter all the umlauts are converted to the #nnn; form. Normally this is not a problem as the browser successfully handles it - normally - but not when using the _javascript_ function alert() to print such a string. What I need now is a _javascript_ function to unencode this string - is there already something in myfaces of do one know a library for this. I can create one myself, but I thought I'll ask before. Thanks! Mario
Dynamically refer to a component from another component
Hi,I have a JSF page that is created dynamically in code. I want to use Ajax to validate that the value entered in some text box is correct, so for each input text component I create an HTML link that I want to refer to the value of the input text it refers to, so I can pass that value to the Ajax mechanism and validate it. Don't know if I have explained my problem well, but in the end, I would like to know if I can use EL to refer from one component to another, so in runtime one component can know the value of another one.Thanks.
Re: How to make Client Side JS validation working on form submission?
Take a look at:http://wiki.apache.org/myfaces/_javascript_WithJavaServceFaces2006/1/13, Emily Gu [EMAIL PROTECTED]:Hi, None of my client side form validation is working.I have apage with form and CommandLink as the button. I have tried to do h:form id=myForm validate(). or h:commandLink immediate=false action="" styleClass=formButtonLink > > value=Create / None of JS got invoked. How to make such JS client side validation working? Thanks for your help!! Emily
Re: What is wrong with this code
Try not to create the components through the new mechanism, but using FacesContext.getApplication.createComponent...2005/12/8, Onur Tokan [EMAIL PROTECTED]:Hi,I have a problem about creating dynamic HtmlDataTable component. The following code renders only the column's facets. NOT the CONTENTS...Thanks...HtmlDataTable dataTable = new HtmlDataTable();for (int i = 1; i = 10 i++){UIColumn column = new UIColumn(); HtmlOutputText header = new HtmlOutputText();header.setValue(Column Header+i);column.setHeader(header);for (int j = 1; j = 100 j++){HtmlOutputText rowText = new HtmlOutputText(); rowText.setValue(Row:+j+Column:+i);column.getChildren().add(rowText);}dataTable.getChildren().add(column);}return dataTable;
Re: website down
For me too (sitting in Spain)2005/11/28, Matthias Wessendorf [EMAIL PROTECTED]: For me too (sitting in Germany)-MatthiasOn 11/28/05, Dennis Byrne [EMAIL PROTECTED] wrote: http://myfaces.apache.org/ and http://apache.org/ appear to be down for me. Can someone confirm this?If anyone knows who to notify, please do. Dennis Byrne --Matthias WessendorfZülpicher Wall 12, 23950674 Kölnhttp://www.wessendorf.netmwessendorf-at-gmail-dot-com
Re: Alt attribute taken out of HtmlGraphicImageTag
Ok. I'll wait for tonight's build then :-)2005/11/27, Simon Kitching [EMAIL PROTECTED]: Enrique Medina wrote: Hi, Why has the alt atrribute been taken out of the HtmlGraphicImageTag? I have just upgraded to the last nightly build, and my JSPs are not working at all! This has now been fixed; the next nightly build should include this fix.The TLD docs have received a major rework recently; the alt attributefor graphicImage just got lost in the shuffle.There *may* be a few other cases where attributes have gone missing. If anyone notices one, please send an email to this list.Regards,Simon
Re: dataTable inefficiencies - hit db twice on each request
You can simply set your backing bean as session-scoped. Also take a look at: http://wiki.apache.org/myfaces/Working_With_DataTable_And_PreserveDataModel2005/11/22, Yee CN [EMAIL PROTECTED]: Hi, I noticed that if preserveDataModel=false, then JSF will attempt to fetch the table data twice – once during the apply request values phase, and once during the render response phase. It doesn't do that if preserveDataModel=true, but then I don't get proper sorting in the table. Hitting the database twice on every request is not acceptable – so is there a way around this? Thanks Yee
Re: HTTP re-post - another question.
Hi Jeffrey, I'm finally using a workaround based on the redirect after post pattern that consists of: 1) Always navigating using redirects in my navigation rules -- This solves the problem with refreshing and shows the correct URL on the browser (if not used, you always get the previous URL) 2) The problem with using redirect is that information is lost within the redirect process, like Faces messages (amongst maybe others). I posted a listener to avoid this problem. 3) In order to solve the problem with the back button, and always in combination with the redirect navigation, you can always include an script in the very first beginning of your page that does this simple function: script history.forward(); /script Hope it helps ;-) 2005/11/22, Jeffrey Porter [EMAIL PROTECTED]: Anyone? -Original Message- From: Jeffrey Porter [mailto:[EMAIL PROTECTED]] Sent: 21 November 2005 12:06 To: MyFaces Discussion Subject: HTTP re-post - another question. Hello all, I know similar things have been asked before, but I've not seen a conclusive conclusion. Problem: I have a page with a bean on, when the page is submitted; the back end saves the bean binds a new instance of the bean to the page. So that the fields are re-displayed as empty. BUT When I press F5 at this point, my page is re-submitted I get a Bean with the original values in, not an empty bean. I've seen people talk about the "redirect after post" pattern. Is this the correct path to follow? Or can I just make a call to removed the data when I redirect back to my original page? Jeff.
HtmlPanelTabbedPane Update Model
Hi, Is there a justification why the broadcast method of the HtmlPanelTabbedPane calls getFacesContext().renderResponse(), so the model doesn't get updated? I mean, how can I preserve data from tab changing? Some time ago someone proposed to extend the component commenting that line and also the subsequent call to super.broadcast()... Does it make sense? Why can't the change of a tab update the model? Is it something that I'm misunderstanding? Thanks for your support ;-)
Re: Datasheet with different number of columns per row
Any comments about my last email regarding this issue? I'm still busy with it... Thanks.2005/11/7, Enrique Medina [EMAIL PROTECTED]: But what should I use in my example as value in the t:columns tag? I mean, how can I ensure that for each row each of the child objects will be called? How does JSF knows it?2005/11/7, Mike Kienenberger [EMAIL PROTECTED]: My suggestion would be to adjust your column model so it always has 8(or MAX) values for each row, and simply return empty (whatever thatmeans in your component) data for the remaining values. Alternatively, you could try: t:columnsh:panelgroupUIInput rendered=#{!column.empty}h:outputText value= rendered=#{column.empty}/h:panelgroup /t:columnsOn 11/7/05, Enrique Medina [EMAIL PROTECTED] wrote: Just to clarify with a concrete example: Imagine in your example of users and privileges that you want to show as rows the users' names, and as columns simply each user's privileges, but the first user (row) has 3 privileges, the second one has 5, the third one has 8 and the fourth one has 2. The maximum columns will be 8 (as of the max number of privileges per user), but not all the columns in all the rows will be printed... 2005/11/7, Enrique Medina [EMAIL PROTECTED]: Great approach! Just one comment: while your dynamic number of columns (allPrivilegeList) is known, mine is not known, and depends as commented before on the maximum size of the collections of the parent objects. For example, in your example, instead of showing all the possible values of the privileges as column headers and then showing whether the user has the privilege or not, imagine my approach: you need to have as many columns as the maximum elements in any of the collections of the parent objects that populate the data table. Do you know what I mean? 2005/11/7, Mike Kienenberger [EMAIL PROTECTED]: I always point out this example code I made as an example of creating a composite component, but it also has a good example of using a combined rowcolumn data model. Take a look at RowAndColumnRelationshipsBackingBean which provides the row model and the column model. I then implement the interface in RowAndColumnRelationshipsDataModel and can plug any number of models into my page. I no longer use any of the other classes since I've switched over to facelets. Instead, I now just use this page code.I've removed some of the decorations (like the dataScrollers), but these three files (RowAndColumnRelationshipsBackingBean, RowAndColumnRelationshipsDataModel, and the code below) should demonstrate it sufficiently. This level of indirection might be overkill for what you're doing, so you might simply rewrite how RowAndColumnRelationshipsBackingBean works internally. backingBean is a RowAndColumnRelationshipsBackingBean configured with another bean that implements a RowAndColumnRelationshipsDataModel. x:dataTable id=datatable value=#{backingBean.rowDataModel} var=row preserveDataModel=falsef:facet name=footer h:panelGroup h:commandButton value=Update actionListener=#{backingBean.update}/ /h:panelGroup /f:facet h:column h:outputText value=#{row.rowName}/ /h:column x:columns value=#{backingBean.columnDataModel} var=column f:facet name=header h:outputText value=#{column.columnName}/ /f:facet h:selectBooleanCheckbox value=#{backingBean.relationshipValue }/ /x:columns /x:dataTable On 11/7/05, Enrique Medina [EMAIL PROTECTED] wrote:I understand Mike :-) So if I have a collection of parent objects, which in turn each parentobject has a collection of other child objects, then I can show a tablewhere the first column is fixed and contains vertically the list of theparent objects, but for each row, the columns are dynamic and can show the collection of child objects for each parent. Is that right? What should I use for each data model, I mean, the collection of parentobjects to populate the main data table and the child collection of eachparent object to populate the columns component? Would that make sense? If Iedit all the child objects, would the getRowData from the main table return me a parent object with its colllection modified so I could rapidly persistit? Thanks for your support ;-) 2005/11/7, Mike Kienenberger [EMAIL PROTECTED]: t:columns does exactly that -- it takes a collection of data and makes as many columns as items in the collection. In fact, you can think of t:columns as a data table rotated 90 degrees. The t:columns component, like dataTable is a subclass of UIData. The trick is that when t:columns renders a row it uses td instead of tr. It's not quite that simple, but from the perspective of an end-user, it can be treated as such. In fact, t:columns API is a little bit confusing since getRowData() really means getColumnData and getRowIndex() really means
Re: Datasheet with different number of columns per row
I understand, but there is still something I cannot see... You use a data model as value to the t:columns tag, and then that data model is used to identify the column selected. So my question is: what kind of data model should I use so later any of my child objects can be identified? 2005/11/8, Mike Kienenberger [EMAIL PROTECTED]: In my example, the columns were independent of the rows.In your case, you'll have to first compute the maximum size.Using my code, I'd do it something like this:==private columnList = null; public List getColumnList(){if (null == columnList) {List rowList = getRowList();// iterate over the row list and determine the value formaxColumnCountcolumnList = createColumnListOfSize(maxColumnCount); }return columnList;}public boolean getValueFor(Object rowObject, Object columnObject) {int columnIndex = columnObject.findIndex();if (columnIndex = rowObject.getColumnList.size ())return emptyObject;else return rowObject.getColumnList(columnIndex);}==Obviously, my model isn't a direct fit to what you're doing, but thebasic logic is still the same. The first time you need it, compute the max-size column list. Then each time a row/column item isaccessed, return the column in the row if the row has that manyelements, or return an empty object if it doesn't.-MikeOn 11/7/05, Enrique Medina [EMAIL PROTECTED] wrote: But what should I use in my example as value in the t:columns tag? I mean, how can I ensure that for each row each of the child objects will be called? How does JSF knows it? 2005/11/7, Mike Kienenberger [EMAIL PROTECTED]: My suggestion would be to adjust your column model so it always has 8 (or MAX) values for each row, and simply return empty (whatever that means in your component) data for the remaining values. Alternatively, you could try: t:columns h:panelgroup UIInput rendered=#{!column.empty} h:outputText value= rendered=#{column.empty } /h:panelgroup /t:columns On 11/7/05, Enrique Medina [EMAIL PROTECTED] wrote: Just to clarify with a concrete example: Imagine in your example of users and privileges that you want to show as rows the users' names, and as columns simply each user's privileges, but the first user (row) has 3 privileges, the second one has 5, the third one has 8 and the fourth one has 2. The maximum columns will be 8 (as of the max number of privileges per user), but not all the columns in all the rows will be printed... 2005/11/7, Enrique Medina [EMAIL PROTECTED]:Great approach! Just one comment: while your dynamic number of columns (allPrivilegeList) is known, mine is not known, and depends as commented before on the maximum size of the collections of the parent objects. For example, in your example, instead of showing all the possible values of the privileges as column headers and then showing whether the user has the privilege or not, imagine my approach: you need to have as many columns as the maximum elements in any of the collections of the parent objects that populate the data table. Do you know what I mean? 2005/11/7, Mike Kienenberger [EMAIL PROTECTED] : I always point out this example code I made as an example of creating a composite component, but it also has a good example of using a combined rowcolumn data model. Take a look at RowAndColumnRelationshipsBackingBean which provides the row model and the column model. I then implement the interface in RowAndColumnRelationshipsDataModel and can plug any number of models into my page. I no longer use any of the other classes since I've switched over to facelets. Instead, I now just use this page code.I've removed some of the decorations (like the dataScrollers), but these three files (RowAndColumnRelationshipsBackingBean, RowAndColumnRelationshipsDataModel, and the code below) should demonstrate it sufficiently. This level of indirection might be overkill for what you're doing, so you might simply rewrite how RowAndColumnRelationshipsBackingBean works internally. backingBean is a RowAndColumnRelationshipsBackingBean configured with another bean that implements a RowAndColumnRelationshipsDataModel. x:dataTable id=datatable value=#{backingBean.rowDataModel} var=row preserveDataModel=false f:facet name=footer h:panelGroup h:commandButton value=Update actionListener=#{backingBean.update}/ /h:panelGroup /f:facet h:column h:outputText value=#{row.rowName}/ /h:column x:columns value=#{backingBean.columnDataModel} var=column f:facet name=header h:outputText value=#{column.columnName}/ /f:facet h:selectBooleanCheckbox value=#{backingBean.relationshipValue }/ /x:columns /x:dataTable On 11/7/05, Enrique Medina [EMAIL PROTECTED] wrote: I understand Mike :-) So if I have
Re: Datasheet with different number of columns per row
The problem here is that my collection is a set, but as I can only specify once in the value of the t:columns tag the data model, I can't see how can I get the exact identifier of the child object being modified. I mean, I only have one data model to populate the t:columns, but elements in each child collection of each row have distinct identifiers...2005/11/8, Mike Kienenberger [EMAIL PROTECTED]: There's no right answer; there are many solutions.It just has to besomething that you can use to look up the column value for the rowobject.From what you've said before, one possibility is to use a column data model that contains the Integers 0 to 7 (or MaxPrivs-1).Then you can useObject row = rowDataModel.getRowData()Number indexNumber = (Number)columnDataModel.getRowData()Object row.columnValueAtIndex (indexNumber);On 11/8/05, Enrique Medina [EMAIL PROTECTED] wrote: I understand, but there is still something I cannot see...You use a data model as value to the t:columns tag, and then that data model is used to identify the column selected. So my question is: what kind of data model should I use so later any of my child objects can be identified? 2005/11/8, Mike Kienenberger [EMAIL PROTECTED]: In my example, the columns were independent of the rows. In your case, you'll have to first compute the maximum size. Using my code, I'd do it something like this: == private columnList = null; public List getColumnList(){ if (null == columnList) { List rowList = getRowList(); // iterate over the row list and determine the value for maxColumnCount columnList = createColumnListOfSize(maxColumnCount); } return columnList; } public boolean getValueFor(Object rowObject, Object columnObject) { int columnIndex = columnObject.findIndex (); if (columnIndex = rowObject.getColumnList.size ())return emptyObject; else return rowObject.getColumnList(columnIndex); } == Obviously, my model isn't a direct fit to what you're doing, but the basic logic is still the same. The first time you need it, compute the max-size column list. Then each time a row/column item is accessed, return the column in the row if the row has that many elements, or return an empty object if it doesn't. -Mike On 11/7/05, Enrique Medina [EMAIL PROTECTED] wrote: But what should I use in my example as value in the t:columns tag? I mean, how can I ensure that for each row each of the child objects will be called? How does JSF knows it? 2005/11/7, Mike Kienenberger [EMAIL PROTECTED]:My suggestion would be to adjust your column model so it always has 8 (or MAX) values for each row, and simply return empty (whatever thatmeans in your component) data for the remaining values. Alternatively, you could try: t:columnsh:panelgroupUIInput rendered=#{!column.empty}h:outputText value= rendered=#{ column.empty }/h:panelgroup/t:columns On 11/7/05, Enrique Medina [EMAIL PROTECTED] wrote: Just to clarify with a concrete example:Imagine in your example of users and privileges that you want to show as rows the users' names, and as columns simply each user's privileges, but the first user (row) has 3 privileges, the second one has 5, the third one has 8 and the fourth one has 2. The maximum columns will be 8 (as of the max number of privileges per user), but not all the columns in all the rows will be printed... 2005/11/7, Enrique Medina [EMAIL PROTECTED] : Great approach! Just one comment: while your dynamic number of columns (allPrivilegeList) is known, mine is not known, and depends as commented before on the maximum size of the collections of the parent objects. For example, in your example, instead of showing all the possible values of the privileges as column headers and then showing whether the user has the privilege or not, imagine my approach: you need to have as many columns as the maximum elements in any of the collections of the parent objects that populate the data table. Do you know what I mean? 2005/11/7, Mike Kienenberger [EMAIL PROTECTED] : I always point out this example code I made as an example of creating a composite component, but it also has a good example of using a combined rowcolumn data model. Take a look at RowAndColumnRelationshipsBackingBean which provides the row model and the column model. I then implement the interface in RowAndColumnRelationshipsDataModel and can plug any number of models into my page. I no longer use any of the other classes since I've switched over to facelets. Instead, I now just use this page code.I've removed some of the decorations (like the dataScrollers), but these three files (RowAndColumnRelationshipsBackingBean, RowAndColumnRelationshipsDataModel
Re: Datasheet with different number of columns per row
Put it another way... It would be nice to be able to put a data model for the t:columns tag for each row, but as only it can be set once, how can I define an id reference to any of the child objects?2005/11/8, Enrique Medina [EMAIL PROTECTED]: The problem here is that my collection is a set, but as I can only specify once in the value of the t:columns tag the data model, I can't see how can I get the exact identifier of the child object being modified. I mean, I only have one data model to populate the t:columns, but elements in each child collection of each row have distinct identifiers...2005/11/8, Mike Kienenberger [EMAIL PROTECTED]: There's no right answer; there are many solutions.It just has to besomething that you can use to look up the column value for the rowobject.From what you've said before, one possibility is to use a column data model that contains the Integers 0 to 7 (or MaxPrivs-1).Then you can useObject row = rowDataModel.getRowData()Number indexNumber = (Number)columnDataModel.getRowData()Object row.columnValueAtIndex (indexNumber);On 11/8/05, Enrique Medina [EMAIL PROTECTED] wrote: I understand, but there is still something I cannot see... You use a data model as value to the t:columns tag, and then that data model is used to identify the column selected. So my question is: what kind of data model should I use so later any of my child objects can be identified? 2005/11/8, Mike Kienenberger [EMAIL PROTECTED]: In my example, the columns were independent of the rows. In your case, you'll have to first compute the maximum size. Using my code, I'd do it something like this: == private columnList = null; public List getColumnList(){ if (null == columnList) { List rowList = getRowList(); // iterate over the row list and determine the value for maxColumnCount columnList = createColumnListOfSize(maxColumnCount); } return columnList; } public boolean getValueFor(Object rowObject, Object columnObject) { int columnIndex = columnObject.findIndex (); if (columnIndex = rowObject.getColumnList.size ())return emptyObject; else return rowObject.getColumnList(columnIndex); } == Obviously, my model isn't a direct fit to what you're doing, but the basic logic is still the same. The first time you need it, compute the max-size column list. Then each time a row/column item is accessed, return the column in the row if the row has that many elements, or return an empty object if it doesn't. -Mike On 11/7/05, Enrique Medina [EMAIL PROTECTED] wrote: But what should I use in my example as value in the t:columns tag? I mean, how can I ensure that for each row each of the child objects will be called? How does JSF knows it? 2005/11/7, Mike Kienenberger [EMAIL PROTECTED]:My suggestion would be to adjust your column model so it always has 8 (or MAX) values for each row, and simply return empty (whatever thatmeans in your component) data for the remaining values. Alternatively, you could try: t:columnsh:panelgroupUIInput rendered=#{!column.empty}h:outputText value= rendered=#{ column.empty }/h:panelgroup/t:columns On 11/7/05, Enrique Medina [EMAIL PROTECTED] wrote: Just to clarify with a concrete example:Imagine in your example of users and privileges that you want to show as rows the users' names, and as columns simply each user's privileges, but the first user (row) has 3 privileges, the second one has 5, the third one has 8 and the fourth one has 2. The maximum columns will be 8 (as of the max number of privileges per user), but not all the columns in all the rows will be printed... 2005/11/7, Enrique Medina [EMAIL PROTECTED] : Great approach! Just one comment: while your dynamic number of columns (allPrivilegeList) is known, mine is not known, and depends as commented before on the maximum size of the collections of the parent objects. For example, in your example, instead of showing all the possible values of the privileges as column headers and then showing whether the user has the privilege or not, imagine my approach: you need to have as many columns as the maximum elements in any of the collections of the parent objects that populate the data table. Do you know what I mean? 2005/11/7, Mike Kienenberger [EMAIL PROTECTED] : I always point out this example code I made as an example of creating a composite component, but it also has a good example of using a combined rowcolumn data model. Take a look at RowAndColumnRelationshipsBackingBean which provides the row model and the column model. I then implement the interface in RowAndColumnRelationshipsDataModel and can plug any number of models into my page. I no longer use any of the other classes since I've switched
Datasheet with different number of columns per row
Hi, I want to create a special data table where the number of columns is variable in each row depending of the value of the object being painted. I've been looking at the HtmlColumns component, but although being dynamic, I can't see how I can define different number of columns for each row. Any idea of how to accomplish this kind of data sheet?
Re: dynamic number of panelTabs in panelTabbedPane
Well, I have used the approach of creating the components in the setter of the property. This approach has the advantage that the component you are binding to is created by JSF and then passed as a parameter to your setter, so you can use that reference to create all the hierarchy of components.2005/11/7, Don Tam [EMAIL PROTECTED]: Hi,Thanks.I'm quite new to faces and i've never used the componentbindings before, actually.What is the best practice for organizing this?Should I have something like this in faces-config.xml: managed-beanmanaged-bean-nameBean/managed-bean-namemanaged-bean-classcom.web.Bean/managed-bean-classmanaged-bean-scopesession/managed-bean-scope managed-propertyproperty-nametabs/property-nameproperty-classorg.apache.myfaces.custom.tabbedpane.HtmlPanelTabbedPane/property-classvalue#{ Bean.initTabs}/value/managed-property/managed-beanand then havepublic HtmlPanelTabbedPane initTabs();public HtmlPanelTabbedPane getTabs();public void setTabs(HtmlPanelTabbedPane hptp); ?Thanks,Enrique Medina wrote: Yes, thats the idea! And always add childs using getChildren() instead of setParent() ;-) 2005/11/7, Don Tam [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]: Hi Enrique, Thank you for your response.Does this mean I would have to generate whatever is in the tabs through code as well? So basically my jsp would just look like: panelTabbedPane binding=#{Bean.stuff} /panelTabbedPane Thanks, Enrique Medina wrote: Just bind your panelTabbedPane to a property in your backing bean, and create the tabs dynamically from code, adding them to your property using getChildren(). 2005/11/7, Don Tam [EMAIL PROTECTED] mailto: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] : Hi, Could anyone tell me how I could generate a tab for each item in a list? Thanks, -- Don Tam Manager, Software Development (416)493-6111x143 [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] mailto: [EMAIL PROTECTED] -- Don Tam Manager, Software Development (416)493-6111x143 [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]--Don TamManager, Software Development(416)493-6111x143 [EMAIL PROTECTED]
Re: Datasheet with different number of columns per row
Well, maybe I have explained myself badly, but obviously the number of rows, although dynamic, would be fixed (i.e. the maximum of all). The main problem I have is that the data for the columns is a collection rather than a fixed number of properties in a class; i.e. it represents an object with a collection of objects inside it, and each element of the collection is the data I want to show for every column.2005/11/7, Mike Kienenberger [EMAIL PROTECTED]: I don't know of a component that generates a different number ofcolumns for each row. Columns allows a dynamic number of columns,but the number is still the same for every row.What kind of html would you expect it to generate, since a standard html table expects a set number of columns?Probably, your best bet is to go with a t:dataList which operates onrow data, but doesn't render any particular output. Then, for eachrow, you can output whatever kind of html that you need. On 11/7/05, Enrique Medina [EMAIL PROTECTED] wrote: Hi,I want to create a special data table where the number of columns is variable in each row depending of the value of the object being painted. I've been looking at the HtmlColumns component, but although being dynamic, I can't see how I can define different number of columns for each row.Any idea of how to accomplish this kind of data sheet?
Re: Datasheet with different number of columns per row
I understand Mike :-) So if I have a collection of parent objects, which in turn each parent object has a collection of other child objects, then I can show a table where the first column is fixed and contains vertically the list of the parent objects, but for each row, the columns are dynamic and can show the collection of child objects for each parent. Is that right? What should I use for each data model, I mean, the collection of parent objects to populate the main data table and the child collection of each parent object to populate the columns component? Would that make sense? If I edit all the child objects, would the getRowData from the main table return me a parent object with its colllection modified so I could rapidly persist it? Thanks for your support ;-)2005/11/7, Mike Kienenberger [EMAIL PROTECTED]: t:columns does exactly that -- it takes a collection of data and makesas many columns as items in the collection.In fact, you can think of t:columns as a data table rotated 90 degrees.The t:columns component, like dataTable is a subclass of UIData. The trick is that when t:columns renders a row it uses td instead oftr. It's not quite that simple, but from the perspective of anend-user, it can be treated as such. In fact, t:columns API is a little bit confusing since getRowData()really means getColumnData and getRowIndex() really meansgetColumnIndex(). Again, that's because it's effectively a nesteddataTable that renders td tags instead of tr tags. I hope that helps!On 11/7/05, Enrique Medina [EMAIL PROTECTED] wrote: Well, maybe I have explained myself badly, but obviously the number of rows, although dynamic, would be fixed (i.e. the maximum of all).The main problem I have is that the data for the columns is a collection rather than a fixed number of properties in a class; i.e . it represents an object with a collection of objects inside it, and each element of the collection is the data I want to show for every column. 2005/11/7, Mike Kienenberger [EMAIL PROTECTED]: I don't know of a component that generates a different number of columns for each row. Columns allows a dynamic number of columns, but the number is still the same for every row. What kind of html would you expect it to generate, since a standard html table expects a set number of columns? Probably, your best bet is to go with a t:dataList which operates on row data, but doesn't render any particular output. Then, for each row, you can output whatever kind of html that you need. On 11/7/05, Enrique Medina [EMAIL PROTECTED] wrote: Hi,I want to create a special data table where the number of columns is variable in each row depending of the value of the object being painted. I've been looking at the HtmlColumns component, but although being dynamic, I can't see how I can define different number of columns for each row. Any idea of how to accomplish this kind of data sheet?
Re: Datasheet with different number of columns per row
Great approach! Just one comment: while your dynamic number of columns (allPrivilegeList) is known, mine is not known, and depends as commented before on the maximum size of the collections of the parent objects. For example, in your example, instead of showing all the possible values of the privileges as column headers and then showing whether the user has the privilege or not, imagine my approach: you need to have as many columns as the maximum elements in any of the collections of the parent objects that populate the data table. Do you know what I mean?2005/11/7, Mike Kienenberger [EMAIL PROTECTED]: I always point out this example code I made as an example of creatinga composite component, but it also has a good example of using acombined rowcolumn data model.Take a look at RowAndColumnRelationshipsBackingBean which provides the row model and the column model. I then implement the interface inRowAndColumnRelationshipsDataModel and can plug any number of modelsinto my page.I no longer use any of the other classes since I've switched over to facelets. Instead, I now just use this page code.I've removed some of thedecorations (like the dataScrollers), but these three files(RowAndColumnRelationshipsBackingBean,RowAndColumnRelationshipsDataModel, and the code below) should demonstrate it sufficiently.This level of indirection might be overkill for what you're doing, soyou might simply rewrite how RowAndColumnRelationshipsBackingBeanworks internally.backingBean is a RowAndColumnRelationshipsBackingBean configured with another bean that implements aRowAndColumnRelationshipsDataModel.x:dataTable id=datatable value=#{backingBean.rowDataModel} var=row preserveDataModel=falsef:facet name=footerh:panelGrouph:commandButton value=UpdateactionListener=#{backingBean.update}//h:panelGroup/f:faceth:columnh:outputText value=#{row.rowName}//h:columnx:columnsvalue=#{backingBean.columnDataModel}var=columnf:facet name=header h:outputText value=#{column.columnName}//f:faceth:selectBooleanCheckboxvalue=#{backingBean.relationshipValue}//x:columns/x:dataTable On 11/7/05, Enrique Medina [EMAIL PROTECTED] wrote: I understand Mike :-)So if I have a collection of parent objects, which in turn each parent object has a collection of other child objects, then I can show a table where the first column is fixed and contains vertically the list of the parent objects, but for each row, the columns are dynamic and can show the collection of child objects for each parent. Is that right?What should I use for each data model, I mean, the collection of parent objects to populate the main data table and the child collection of each parent object to populate the columns component? Would that make sense? If I edit all the child objects, would the getRowData from the main table return me a parent object with its colllection modified so I could rapidly persist it?Thanks for your support ;-) 2005/11/7, Mike Kienenberger [EMAIL PROTECTED]: t:columns does exactly that -- it takes a collection of data and makes as many columns as items in the collection. In fact, you can think of t:columns as a data table rotated 90 degrees. The t:columns component, like dataTable is a subclass of UIData. The trick is that when t:columns renders a row it uses td instead of tr. It's not quite that simple, but from the perspective of an end-user, it can be treated as such. In fact, t:columns API is a little bit confusing since getRowData() really means getColumnData and getRowIndex() really means getColumnIndex(). Again, that's because it's effectively a nested dataTable that renders td tags instead of tr tags. I hope that helps! On 11/7/05, Enrique Medina [EMAIL PROTECTED] wrote: Well, maybe I have explained myself badly, but obviously the number of rows, although dynamic, would be fixed (i.e. the maximum of all).The main problem I have is that the data for the columns is a collection rather than a fixed number of properties in a class; i.e . it represents an object with a collection of objects inside it, and each element of the collection is the data I want to show for every column. 2005/11/7, Mike Kienenberger [EMAIL PROTECTED]:I don't know of a component that generates a different number of columns for each row. Columns allows a dynamic number of columns,but the number is still the same for every row. What kind of html would you expect it to generate, since a standard html table expects a set number of columns? Probably, your best bet is to go with a t:dataList which operates onrow data, but doesn't render any particular output. Then, for each row, you can output whatever kind of html that you need. On 11/7/05, Enrique Medina [EMAIL PROTECTED] wrote: Hi,I want to create a special data table where the number of columns is variable in each row depending of the value of the object being painted.I've been looking at the HtmlColumns component, but although
Re: Datasheet with different number of columns per row
Just to clarify with a concrete example: Imagine in your example of users and privileges that you want to show as rows the users' names, and as columns simply each user's privileges, but the first user (row) has 3 privileges, the second one has 5, the third one has 8 and the fourth one has 2. The maximum columns will be 8 (as of the max number of privileges per user), but not all the columns in all the rows will be printed...2005/11/7, Enrique Medina [EMAIL PROTECTED]: Great approach! Just one comment: while your dynamic number of columns (allPrivilegeList) is known, mine is not known, and depends as commented before on the maximum size of the collections of the parent objects. For example, in your example, instead of showing all the possible values of the privileges as column headers and then showing whether the user has the privilege or not, imagine my approach: you need to have as many columns as the maximum elements in any of the collections of the parent objects that populate the data table. Do you know what I mean?2005/11/7, Mike Kienenberger [EMAIL PROTECTED]: I always point out this example code I made as an example of creatinga composite component, but it also has a good example of using acombined rowcolumn data model.Take a look at RowAndColumnRelationshipsBackingBean which provides the row model and the column model. I then implement the interface inRowAndColumnRelationshipsDataModel and can plug any number of modelsinto my page.I no longer use any of the other classes since I've switched over to facelets. Instead, I now just use this page code.I've removed some of thedecorations (like the dataScrollers), but these three files(RowAndColumnRelationshipsBackingBean,RowAndColumnRelationshipsDataModel, and the code below) should demonstrate it sufficiently.This level of indirection might be overkill for what you're doing, soyou might simply rewrite how RowAndColumnRelationshipsBackingBeanworks internally.backingBean is a RowAndColumnRelationshipsBackingBean configured with another bean that implements aRowAndColumnRelationshipsDataModel.x:dataTable id=datatable value=#{backingBean.rowDataModel} var=row preserveDataModel=falsef:facet name=footerh:panelGrouph:commandButton value=UpdateactionListener=#{backingBean.update}//h:panelGroup/f:faceth:columnh:outputText value=#{row.rowName}//h:columnx:columnsvalue=#{backingBean.columnDataModel}var=columnf:facet name=header h:outputText value=#{column.columnName}//f:faceth:selectBooleanCheckboxvalue=#{backingBean.relationshipValue}//x:columns/x:dataTable On 11/7/05, Enrique Medina [EMAIL PROTECTED] wrote: I understand Mike :-) So if I have a collection of parent objects, which in turn each parent object has a collection of other child objects, then I can show a table where the first column is fixed and contains vertically the list of the parent objects, but for each row, the columns are dynamic and can show the collection of child objects for each parent. Is that right?What should I use for each data model, I mean, the collection of parent objects to populate the main data table and the child collection of each parent object to populate the columns component? Would that make sense? If I edit all the child objects, would the getRowData from the main table return me a parent object with its colllection modified so I could rapidly persist it?Thanks for your support ;-) 2005/11/7, Mike Kienenberger [EMAIL PROTECTED]: t:columns does exactly that -- it takes a collection of data and makes as many columns as items in the collection. In fact, you can think of t:columns as a data table rotated 90 degrees. The t:columns component, like dataTable is a subclass of UIData. The trick is that when t:columns renders a row it uses td instead of tr. It's not quite that simple, but from the perspective of an end-user, it can be treated as such. In fact, t:columns API is a little bit confusing since getRowData() really means getColumnData and getRowIndex() really means getColumnIndex(). Again, that's because it's effectively a nested dataTable that renders td tags instead of tr tags. I hope that helps! On 11/7/05, Enrique Medina [EMAIL PROTECTED] wrote: Well, maybe I have explained myself badly, but obviously the number of rows, although dynamic, would be fixed (i.e. the maximum of all).The main problem I have is that the data for the columns is a collection rather than a fixed number of properties in a class; i.e . it represents an object with a collection of objects inside it, and each element of the collection is the data I want to show for every column. 2005/11/7, Mike Kienenberger [EMAIL PROTECTED]:I don't know of a component that generates a different number of columns for each row. Columns allows a dynamic number of columns,but the number is still the same for every row. What kind of html would you expect it to generate, since a standard html table expects a set number of columns? Probably
Re: Datasheet with different number of columns per row
But what should I use in my example as value in the t:columns tag? I mean, how can I ensure that for each row each of the child objects will be called? How does JSF knows it?2005/11/7, Mike Kienenberger [EMAIL PROTECTED]: My suggestion would be to adjust your column model so it always has 8(or MAX) values for each row, and simply return empty (whatever thatmeans in your component) data for the remaining values.Alternatively, you could try: t:columnsh:panelgroupUIInput rendered=#{!column.empty}h:outputText value= rendered=#{column.empty}/h:panelgroup /t:columnsOn 11/7/05, Enrique Medina [EMAIL PROTECTED] wrote: Just to clarify with a concrete example:Imagine in your example of users and privileges that you want to show as rows the users' names, and as columns simply each user's privileges, but the first user (row) has 3 privileges, the second one has 5, the third one has 8 and the fourth one has 2. The maximum columns will be 8 (as of the max number of privileges per user), but not all the columns in all the rows will be printed... 2005/11/7, Enrique Medina [EMAIL PROTECTED]: Great approach! Just one comment: while your dynamic number of columns (allPrivilegeList) is known, mine is not known, and depends as commented before on the maximum size of the collections of the parent objects. For example, in your example, instead of showing all the possible values of the privileges as column headers and then showing whether the user has the privilege or not, imagine my approach: you need to have as many columns as the maximum elements in any of the collections of the parent objects that populate the data table. Do you know what I mean? 2005/11/7, Mike Kienenberger [EMAIL PROTECTED]: I always point out this example code I made as an example of creating a composite component, but it also has a good example of using a combined rowcolumn data model. Take a look at RowAndColumnRelationshipsBackingBean which provides the row model and the column model. I then implement the interface in RowAndColumnRelationshipsDataModel and can plug any number of models into my page. I no longer use any of the other classes since I've switched over to facelets. Instead, I now just use this page code.I've removed some of the decorations (like the dataScrollers), but these three files (RowAndColumnRelationshipsBackingBean, RowAndColumnRelationshipsDataModel, and the code below) should demonstrate it sufficiently. This level of indirection might be overkill for what you're doing, so you might simply rewrite how RowAndColumnRelationshipsBackingBean works internally. backingBean is a RowAndColumnRelationshipsBackingBean configured with another bean that implements a RowAndColumnRelationshipsDataModel. x:dataTable id=datatable value=#{backingBean.rowDataModel} var=row preserveDataModel=falsef:facet name=footer h:panelGroup h:commandButton value=Update actionListener=#{backingBean.update}/ /h:panelGroup /f:facet h:column h:outputText value=#{row.rowName}/ /h:column x:columns value=#{backingBean.columnDataModel} var=column f:facet name=header h:outputText value=#{column.columnName}/ /f:facet h:selectBooleanCheckbox value=#{backingBean.relationshipValue }/ /x:columns /x:dataTable On 11/7/05, Enrique Medina [EMAIL PROTECTED] wrote:I understand Mike :-) So if I have a collection of parent objects, which in turn each parentobject has a collection of other child objects, then I can show a tablewhere the first column is fixed and contains vertically the list of theparent objects, but for each row, the columns are dynamic and can show the collection of child objects for each parent. Is that right? What should I use for each data model, I mean, the collection of parentobjects to populate the main data table and the child collection of eachparent object to populate the columns component? Would that make sense? If Iedit all the child objects, would the getRowData from the main table return me a parent object with its colllection modified so I could rapidly persistit? Thanks for your support ;-) 2005/11/7, Mike Kienenberger [EMAIL PROTECTED]: t:columns does exactly that -- it takes a collection of data and makes as many columns as items in the collection. In fact, you can think of t:columns as a data table rotated 90 degrees. The t:columns component, like dataTable is a subclass of UIData. The trick is that when t:columns renders a row it uses td instead of tr. It's not quite that simple, but from the perspective of an end-user, it can be treated as such. In fact, t:columns API is a little bit confusing since getRowData() really means getColumnData and getRowIndex() really means getColumnIndex(). Again, that's because it's effectively a nested dataTable that renders td tags instead of tr tags. I hope
Re: How to create component without binding?
Hi, Recently I posted a similar question and got the answer from Mike Kienenberger about not using the getter of the binded property to create it, as I can have it already created from the JSF engine in my setter method. Now I see that Martin proposes to create it in the getter. But should be the best approach then? 2005/11/4, Martin Marinschek [EMAIL PROTECTED]: What you want to do is do a binding for panelGroupand then add children to this panelGroup - with this you can createextra components.code snippet (not compiled except in my head ;):public UIComponent getPanelGroup() {HtmlPanelGroup panelGroup = new HtmlPanelGroup();panelGroup.getChildren().add(new HtmlInputText());panelGroup.getChildren().add(new HtmlOutputText());...return panelGroup;}regards, MartinOn 11/4/05, Nikita Koselev [EMAIL PROTECTED] wrote: Can you explain your task better, please. Nikita On 04/11/05, Rene Ott [EMAIL PROTECTED] wrote: Hello @all, I would like to create dynamically inside a backing bean some components. Looking around in the net I found only solutions that create a binding to a component, for example: h:panelGroup binding=#{my.backingbean} ... This means that I always need an existing component like panelGroup for creating with a binding some components. How can I create dynamically components without using a binding (and in the end an extra component)? Thanks and best regards, René Ott --http://www.irian.atYour JSF powerhouse -JSF Trainings in English and German
Re: How to create component without binding?
Yes, I've tried so. A simple text works. Then the tab also works, as the result I'm getting now is the tab, but totally empty. I have checked once and again my code, but don't see anything wrong with it. Maybe other eyes can see what I don't see...2005/11/4, Bruno Aranda [EMAIL PROTECTED]: Have you try to simplify your code to see if the binding works ok?Just put an HtmlOutputText in the panel, for instance... and if thatworks, add more logic...Regards,Bruno2005/11/4, Enrique Medina [EMAIL PROTECTED]: Yes, that's what I am doing. But the thing is I cannot make it work.See my code (but nothing appears in my JSP page): public void setPanelTabuladores(UIPanel panelTabuladores){if (this.panelTabuladores == null){this.panelTabuladores = panelTabuladores;UIPanel tab0 = (HtmlPanelTab) FacesUtils.getApplication().createComponent(HtmlPanelTab.COMPONENT_TYPE);tab0.setId(panelTab0);tab0.getAttributes ().put(label, Variable0);UIData tabla0 = (HtmlDataTable) FacesUtils.getApplication().createComponent(HtmlDataTable.COMPONENT_TYPE);tabla0.setId(tablaEdicionPuntuaciones0); tabla0.setVar(puntuacion0);tabla0.getAttributes().put(width, 100%);tabla0.getAttributes().put(cellspacing, 1);tabla0.getAttributes().put(cellpadding, 2);tabla0.getAttributes().put(renderedIfEmpty, Boolean.FALSE);tabla0.getAttributes().put(preserveDataModel, Boolean.FALSE);tabla0.setValueBinding(value, FacesUtils .getValueBinding(#{puntuaciones.listasPuntuaciones[0]}));tabla0.setRows(10);tabla0.getAttributes().put(rowClasses, impar,par);tabla0.getAttributes().put(headerClass, apptblhdr);tabla0.getAttributes().put(rowIndexVar, numFila0);tabla0.getAttributes().put(rowOnMouseOver, tblOver(this));tabla0.getAttributes().put(rowOnMouseOut,tblOut(this, #{numFila0%2}));UIColumn col1 = (HtmlSimpleColumn) FacesUtils.getApplication().createComponent(HtmlSimpleColumn.COMPONENT_TYPE);col1.getAttributes().put(style, text-align: center;);UIOutput texto1 = (HtmlOutputText) FacesUtils.getApplication().createComponent(HtmlOutputText.COMPONENT_TYPE);texto1.setValueBinding(value, FacesUtils.getValueBinding(#{mensajes.puntuaciones_Tramos}));col1.setHeader(texto1);UIOutput texto2 = (HtmlOutputText) FacesUtils.getApplication().createComponent(HtmlOutputText.COMPONENT_TYPE);texto2.setValueBinding(value, FacesUtils .getValueBinding(#{puntuacion0.valor.minimo} - #{puntuacion0.valor.maximo}));col1.getChildren().add(texto2); UIColumn col2 = (HtmlSimpleColumn) FacesUtils.getApplication().createComponent(HtmlSimpleColumn.COMPONENT_TYPE);col2.getAttributes().put(style, text-align: center;);UIInput texto3 = (HtmlInputText) FacesUtils.getApplication().createComponent(HtmlInputText.COMPONENT_TYPE);texto3.setValueBinding(value, FacesUtils.getValueBinding(#{puntuacion0.puntuacion}));col2.getChildren().add(texto3);tabla0.getChildren().add(col1); tabla0.getChildren().add(col2);tab0.getChildren().add(tabla0);this.panelTabuladores.getChildren().add(tab0);}} 2005/11/4, Martin Marinschek [EMAIL PROTECTED]: Well, for very easy situations, it is ok to create it in the getter, when it is sure that your component will not change during the life-time of a view. For all other things, it is much better to provide a setter and initialize the component somewhere else so that you can dynamically change the component and what it binds to. regards, MartinOn 11/4/05, Enrique Medina [EMAIL PROTECTED] wrote: Hi,Recently I posted a similar question and got the answer from Mike Kienenberger about not using the getter of the binded property to create it, as I can have it already created from the JSF engine in my setter method.Now I see that Martin proposes to create it in the getter. But should be the best approach then? 2005/11/4, Martin Marinschek [EMAIL PROTECTED] :What you want to do is do a binding for panelGroup and then add children to this panelGroup - with this you can createextra components. code snippet (not compiled except in my head ;): public UIComponent getPanelGroup(){HtmlPanelGroup panelGroup = new HtmlPanelGroup(); panelGroup.getChildren().add(new HtmlInputText());panelGroup.getChildren().add(new HtmlOutputText());... return panelGroup; } regards, Martin On 11/4/05, Nikita Koselev [EMAIL PROTECTED] wrote: Can you explain your task better, please. Nikita On 04/11/05, Rene Ott [EMAIL PROTECTED] wrote: Hello @all, I would like to create dynamically inside a backing bean some components. Looking around in the net I found only solutions that create a binding to a component, for example: h:panelGroup binding=#{my.backingbean} ... This means that I always need an existing component like panelGroup for creating with a binding some components. How can I create dynamically components without using a binding (and in the end an extra component)? Thanks and best
Re: How to create component without binding?
The debug shows that: 1) The getter is only called every time the page is rendered coming from another different page. If it is re-rendered (for example, because you click on the tab), the getter is not called 2) The setter is called: 2.1) Just after the only time the getter is invoked (I think this is the perfect point to create all the components) 2.2) Every time I click on the tab (simply return the parameter passed by JSF) 2.3) Sometimes when I navigate to another page (simply return the parameter passed by JSF - ignore it) I also noticed then that I should always return null from the getter, so every time this page is called, the components must be recreated, as it is probably that the data has changed2005/11/4, Martin Marinschek [EMAIL PROTECTED]: This won't work - on every request, your setter will be called by theJSF implementation. And on every request, you will get passed a newcomponent reference (except you do server side state saving, then thismight actually be the same) as it is serialized/deserialized from the saved state.Can you debug in what happens with your get/set pair? You shouldeasily find out what is going out then...regards,MartinOn 11/4/05, Enrique Medina [EMAIL PROTECTED] wrote: Yes, that's what I am doing. But the thing is I cannot make it work.See my code (but nothing appears in my JSP page):public void setPanelTabuladores(UIPanel panelTabuladores) {if (this.panelTabuladores == null){this.panelTabuladores = panelTabuladores;UIPanel tab0 = (HtmlPanelTab) FacesUtils.getApplication().createComponent(HtmlPanelTab.COMPONENT_TYPE);tab0.setId(panelTab0);tab0.getAttributes ().put(label, Variable0);UIData tabla0 = (HtmlDataTable) FacesUtils.getApplication().createComponent(HtmlDataTable.COMPONENT_TYPE);tabla0.setId(tablaEdicionPuntuaciones0); tabla0.setVar(puntuacion0);tabla0.getAttributes().put(width, 100%);tabla0.getAttributes().put(cellspacing, 1);tabla0.getAttributes().put(cellpadding, 2);tabla0.getAttributes().put(renderedIfEmpty, Boolean.FALSE);tabla0.getAttributes().put(preserveDataModel, Boolean.FALSE);tabla0.setValueBinding(value, FacesUtils .getValueBinding(#{puntuaciones.listasPuntuaciones[0]}));tabla0.setRows(10);tabla0.getAttributes().put(rowClasses, impar,par);tabla0.getAttributes().put(headerClass, apptblhdr);tabla0.getAttributes().put(rowIndexVar, numFila0);tabla0.getAttributes().put(rowOnMouseOver, tblOver(this));tabla0.getAttributes().put(rowOnMouseOut,tblOut(this, #{numFila0%2}));UIColumn col1 = (HtmlSimpleColumn) FacesUtils.getApplication().createComponent(HtmlSimpleColumn.COMPONENT_TYPE);col1.getAttributes().put(style, text-align: center;);UIOutput texto1 = (HtmlOutputText) FacesUtils.getApplication().createComponent(HtmlOutputText.COMPONENT_TYPE);texto1.setValueBinding(value, FacesUtils.getValueBinding(#{mensajes.puntuaciones_Tramos}));col1.setHeader(texto1);UIOutput texto2 = (HtmlOutputText) FacesUtils.getApplication().createComponent(HtmlOutputText.COMPONENT_TYPE);texto2.setValueBinding(value, FacesUtils .getValueBinding(#{puntuacion0.valor.minimo} - #{puntuacion0.valor.maximo}));col1.getChildren().add(texto2); UIColumn col2 = (HtmlSimpleColumn) FacesUtils.getApplication().createComponent(HtmlSimpleColumn.COMPONENT_TYPE);col2.getAttributes().put(style, text-align: center;);UIInput texto3 = (HtmlInputText) FacesUtils.getApplication().createComponent(HtmlInputText.COMPONENT_TYPE);texto3.setValueBinding(value, FacesUtils.getValueBinding(#{puntuacion0.puntuacion}));col2.getChildren().add(texto3);tabla0.getChildren().add(col1); tabla0.getChildren().add(col2);tab0.getChildren().add(tabla0);this.panelTabuladores.getChildren().add(tab0);}} 2005/11/4, Martin Marinschek [EMAIL PROTECTED]: Well, for very easy situations, it is ok to create it in the getter, when it is sure that your component will not change during the life-time of a view. For all other things, it is much better to provide a setter and initialize the component somewhere else so that you can dynamically change the component and what it binds to. regards, MartinOn 11/4/05, Enrique Medina [EMAIL PROTECTED] wrote: Hi,Recently I posted a similar question and got the answer from Mike Kienenberger about not using the getter of the binded property to create it, as I can have it already created from the JSF engine in my setter method.Now I see that Martin proposes to create it in the getter. But should be the best approach then? 2005/11/4, Martin Marinschek [EMAIL PROTECTED] :What you want to do is do a binding for panelGroup and then add children to this panelGroup - with this you can createextra components. code snippet (not compiled except in my head ;): public UIComponent getPanelGroup(){HtmlPanelGroup panelGroup = new HtmlPanelGroup(); panelGroup.getChildren().add(new HtmlInputText());panelGroup.getChildren().add(new HtmlOutputText());... return panelGroup; } regards, Martin On 11
Dynamic component creation
Hi, I am trying to dynamically create some components inside my backing bean, but I can't get it to work right now... Imagine I have to dynamically generate some tabs inside a PanelTabbedPane, and one data table inside each tab, so I'll explain what I am doing: 1) In my JSP I define the HtmlPanelTabbedPaneTag: t:panelTabbedPane bgcolor=#F8F8F8 align=center binding=#{puntuacionesBean.panelTabuladores} and as can be seen, I bind it to my component in my backing bean (puntuacionesBean). 2) Inside my backing bean (puntuacionesBean), I declare a variable named panelTabuladores with type UIPanel. Then I also declare a getter and a setter for it. 3) When the page is rendered, the HtmlPanelTabbedPaneTag invokes the HtmlPanelTabbedPane component, so my getPanelTabuladores method is called. So: 3.1) I check whether my panelTabuladores variable is null or not. If it is null, the I create myself the component, and then I create all the components that will be the children of the HtmlPanelTabbedPane (simulating tags inside tags): if (this.panelTabuladores == null) { this.panelTabuladores = (HtmlPanelTabbedPane) FacesUtils .getApplication().createComponent( HtmlPanelTabbedPane.COMPONENT_TYPE); UIPanel tab0 = (HtmlPanelTab) FacesUtils.getApplication() .createComponent(HtmlPanelTab.COMPONENT_TYPE); ; tab0.setParent(this.panelTabuladores); tab0.setId(panelTab0); tab0.getAttributes().put(label, Variable0); UIData tabla0 = (HtmlDataTable) FacesUtils.getApplication() .createComponent(HtmlDataTable.COMPONENT_TYPE); tabla0.setId(tablaEdicionPuntuaciones0); tabla0.setVar(puntuacion0); tabla0.getAttributes().put(width, 100%); tabla0.getAttributes().put(cellspacing, 1); tabla0.getAttributes().put(cellpadding, 2); tabla0.getAttributes().put(renderedIfEmpty, Boolean.FALSE); tabla0.getAttributes().put(preserveDataModel, Boolean.FALSE); tabla0.setValueBinding(value, FacesUtils .getValueBinding(#{puntuaciones.listasPuntuaciones[0]})); tabla0.setRows(10); tabla0.getAttributes().put(rowClasses, impar,par); tabla0.getAttributes().put(headerClass, apptblhdr); tabla0.getAttributes().put(rowIndexVar, numFila0); tabla0.getAttributes().put(rowOnMouseOver, tblOver(this)); tabla0.getAttributes().put(rowOnMouseOut, tblOut(this, #{numFila0%2})); UIColumn col1 = (HtmlSimpleColumn) FacesUtils.getApplication() .createComponent(HtmlSimpleColumn.COMPONENT_TYPE); col1.getAttributes().put(style, text-align: center;); UIOutput texto1 = (HtmlOutputText) FacesUtils.getApplication() .createComponent(HtmlOutputText.COMPONENT_TYPE); texto1.setValueBinding(value, FacesUtils .getValueBinding(#{mensajes.puntuaciones_Tramos})); col1.setHeader(texto1); UIOutput texto2 = (HtmlOutputText) FacesUtils.getApplication() .createComponent(HtmlOutputText.COMPONENT_TYPE); texto2 .setValueBinding( value, FacesUtils .getValueBinding(#{puntuacion0.valor.minimo} - #{puntuacion0.valor.maximo})); col1.getChildren().add(texto2); UIColumn col2 = (HtmlSimpleColumn) FacesUtils.getApplication() .createComponent(HtmlSimpleColumn.COMPONENT_TYPE); col2.getAttributes().put(style, text-align: center;); UIInput texto3 = (HtmlInputText) FacesUtils.getApplication() .createComponent(HtmlInputText.COMPONENT_TYPE); texto3.setValueBinding(value, FacesUtils .getValueBinding(#{puntuacion0.puntuacion})); col2.getChildren().add(texto3); tabla0.getChildren().add(col1); tabla0.getChildren().add(col2); tab0.getChildren().add(tabla0); this.panelTabuladores.getChildren().add(tab0); As can be seen, I create every subcomponent and add it to the getChildren list of the parent component. 3.2) I return the just initialized panelTabuladores variables as a HtmlPanelTabbedPane component The problem is that the tabs are visible, but the data table seems to be absolutely ignored, as it doesn't appear in the page. However if, instead of the data table, I simply create tab with a text component inside it, then it is correctly displayed, so there must be a problem I cannot see with my data table. Any help would be really appreciated.
Re: Dynamic component creation
Hi Mike, I've been taking a look to your code, and if I understand well, you mean to do what you implement in the RowAndColumnRelationshipsHtmlDataTable constructor, but within my setter method inside my backing bean, don't you?2005/11/3, Mike Kienenberger [EMAIL PROTECTED]: Enrique,Try a different approach.Put this code in your setPanelTabuladores() method. You don't needto create a HtmlPanelTabbedPane because this component is alreadycreated for you. All you need to do is create tabs and add them to the table passed into the method. I think you should do this usingparent.getChildren().add(child) instead of child.setParent() as that'show I've always seen it done in the past.You can find a very old example I wrote of dynamically creating components in a dataTable subclass as an attachment here. It mightbe of help.If so, the most interesting class isRowAndColumnRelationshipsHtmlDataTable as it does all of the creationwork. http://issues.apache.org/jira/secure/attachment/12311217/RowAndColumnRelationshipComponent.zipOn 11/3/05, Enrique Medina [EMAIL PROTECTED] wrote: Hi, I am trying to dynamically create some components inside my backing bean, but I can't get it to work right now...Imagine I have to dynamically generate some tabs inside a PanelTabbedPane, and one data table inside each tab, so I'll explain what I am doing:1) In my JSP I define the HtmlPanelTabbedPaneTag:t:panelTabbedPane bgcolor=#F8F8F8 align=center binding=#{puntuacionesBean.panelTabuladores}and as can be seen, I bind it to my component in my backing bean (puntuacionesBean).2) Inside my backing bean (puntuacionesBean), I declare a variable named panelTabuladores with type UIPanel. Then I also declare a getter and a setter for it.3) When the page is rendered, the HtmlPanelTabbedPaneTag invokes the HtmlPanelTabbedPane component, so my getPanelTabuladores method is called. So:3.1) I check whether my panelTabuladores variable is null or not. If it is null, the I create myself the component, and then I create all the components that will be the children of the HtmlPanelTabbedPane (simulating tags inside tags):if (this.panelTabuladores == null){this.panelTabuladores = (HtmlPanelTabbedPane) FacesUtils.getApplication().createComponent( HtmlPanelTabbedPane.COMPONENT_TYPE);UIPanel tab0 = (HtmlPanelTab) FacesUtils.getApplication().createComponent(HtmlPanelTab.COMPONENT_TYPE);;tab0.setParent(this.panelTabuladores); tab0.setId(panelTab0);tab0.getAttributes().put(label, Variable0);UIData tabla0 = (HtmlDataTable) FacesUtils.getApplication().createComponent(HtmlDataTable.COMPONENT_TYPE);tabla0.setId(tablaEdicionPuntuaciones0); tabla0.setVar(puntuacion0);tabla0.getAttributes().put(width, 100%);tabla0.getAttributes().put(cellspacing, 1);tabla0.getAttributes().put(cellpadding, 2);tabla0.getAttributes().put(renderedIfEmpty, Boolean.FALSE);tabla0.getAttributes().put(preserveDataModel, Boolean.FALSE);tabla0.setValueBinding(value, FacesUtils .getValueBinding(#{puntuaciones.listasPuntuaciones[0]}));tabla0.setRows(10);tabla0.getAttributes().put(rowClasses, impar,par);tabla0.getAttributes().put(headerClass, apptblhdr);tabla0.getAttributes().put(rowIndexVar, numFila0);tabla0.getAttributes().put(rowOnMouseOver, tblOver(this));tabla0.getAttributes().put(rowOnMouseOut,tblOut(this, #{numFila0%2}));UIColumn col1 = (HtmlSimpleColumn) FacesUtils.getApplication().createComponent(HtmlSimpleColumn.COMPONENT_TYPE);col1.getAttributes().put(style, text-align: center;);UIOutput texto1 = (HtmlOutputText) FacesUtils.getApplication().createComponent(HtmlOutputText.COMPONENT_TYPE);texto1.setValueBinding(value, FacesUtils.getValueBinding(#{mensajes.puntuaciones_Tramos}));col1.setHeader(texto1);UIOutput texto2 = (HtmlOutputText) FacesUtils.getApplication().createComponent(HtmlOutputText.COMPONENT_TYPE);texto2.setValueBinding(value, FacesUtils .getValueBinding(#{puntuacion0.valor.minimo} - #{puntuacion0.valor.maximo}));col1.getChildren().add(texto2); UIColumn col2 = (HtmlSimpleColumn) FacesUtils.getApplication().createComponent(HtmlSimpleColumn.COMPONENT_TYPE);col2.getAttributes().put(style, text-align: center;);UIInput texto3 = (HtmlInputText) FacesUtils.getApplication().createComponent(HtmlInputText.COMPONENT_TYPE);texto3.setValueBinding(value, FacesUtils.getValueBinding(#{puntuacion0.puntuacion}));col2.getChildren().add(texto3);tabla0.getChildren().add(col1); tabla0.getChildren().add(col2);tab0.getChildren().add(tabla0);this.panelTabuladores.getChildren().add(tab0); As can be seen, I create every subcomponent and add it to the getChildren list of the parent component.3.2) I return the just initialized panelTabuladores variables as a HtmlPanelTabbedPane component The problem is that the tabs are visible, but the data table seems to be absolutely ignored, as it doesn't appear in the page.However if, instead of the data table, I simply create tab with a text component inside it, then it is correctly displayed, so there must be a problem I cannot see with my data table.Any
EL Maps
Hi, I was trying to use an EL reference to a Map defined in my backing bean, but I always get null as a result. Doing some code reviewing I have seen that MyFaces uses the ELParserHelper class to invoke the Apache Commons library, but only gives support to arrays through its MyArraySuffix static inner class. Does this mean that no support for working with EL and maps in MyFaces is given? Am I missing something?
Re: EL Maps
Hi, Yes I have both a getter for the map and a setter, which returns the whole map. Let's put my example: JSP EL _expression_ -- t:dataTable value=#{puntuacionesBean.listasPuntuaciones['2'].value}/ Bean PuntuacionesBean -- public Map getListasPuntuaciones() { // Imagin something like... this.puntuacionesMap = new HashMap(); this.puntuacionesMap.put(new Integer(2), //someValue); return puntuacionesMap; } public void setListasPuntuaciones(Map listasPuntuaciones) { this.listasPuntuaciones = listasPuntuaciones; } If I debug the code, the value binding returns null when getting the value for the data table... 2005/11/2, Stefan Gesigora [EMAIL PROTECTED]: Hi Enrique,you always need a getter and a setter method for the map.Then you can use it with the EL in this way:h:inputText binding=#{test1Bean.map['t3']}/If you use a list: h:inputText binding=#{test1Bean.list[1]}/regards,Stefan-Ursprüngliche Nachricht-Von: Rick Gruber-Riemer [mailto:[EMAIL PROTECTED] ]Gesendet: Mittwoch, 2. November 2005 12:04An: MyFaces DiscussionBetreff: Re: EL MapsHiI definitively can confirm that Maps are supported - as I am using themwith MyFaces 1.1.1. Maybe you could elaborate a bit more ... RickEnrique Medina wrote: Hi, I was trying to use an EL reference to a Map defined in my backing bean, but I always get null as a result. Doing some code reviewing I have seen that MyFaces uses the ELParserHelper class to invoke the Apache Commons library, but only gives support to arrays through its MyArraySuffix static inner class. Does this mean that no support for working with EL and maps in MyFaces is given? Am I missing something?