RE : Setting error page
Title: Message OK thx Paul this works fine for the redirect on error. I'll look at thelink for the session timeout redirection. Thx again. Clément. -Message d'origine-De: Keel, Paul [mailto:[EMAIL PROTECTED] Envoyé: jeudi 25 août 2005 16:20À: MyFaces DiscussionObjet: RE: Setting error page To Set the error page, put the following entry in your web.xml file: error-page error-code500/error-code location/errorPage.jsf/location /error-page I believe you can set a page for each type of error but this seems to redirect on all exceptions. In order to redirect to a page when the session ends, you will have to write a session filter. I found this article very useful: http://www.jguru.com/forums/view.jsp?EID=1248692 Paul From: Clément Maignien [mailto:[EMAIL PROTECTED] Sent: Thursday, August 25, 2005 8:42 AMTo: MyFaces DiscussionSubject: Setting error page Hi, I would like to know how to set a JSFerror page that will be displayed instead of the default Tomcat one. Is it possible to redirect the navigation to a specific page when the user session times out ? Thx. Clément
Re: Tree2 and actionListeners
Not sure if this is a tree2 specific problem, I can just see that for some reason the behaviour seems to have changed in my app when I switch to 20050822. Yes the actionListener is called in the APPLY_REQUEST_VALUES(2) phase, and the repopulation is done before that (which means that when I click on the commandLink) the data I retrieve is wrong. The commandLink behave normally outside of the tree. The dataTable is generated dynamically (in fact I generate n datatables dynamically), and at the moment contains outputText and commandLinks. I am really puzzled...On 8/25/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hmm, strange. Are you sure that this is a tree2 specific problem? AFAIK the recent changes in the tree2 should not influence the behaviour of a commandLink. Is the actionListener called at all? Can you determine the phase in which this happens? Does the commandLink behave normally when it is outside of the tree? Do you use input components to display your data (in the dataTable)? [EMAIL PROTECTED] schrieb am 23.08.2005 15:05:18: Hi, Just got the 20050822 build and I have problems with my app (I did not have this problem with the 20050802 build). The problem is as follows. I have a tree2 where each item is a commandLink (with immediate set to true) with an actionListener. A click on a tree item should trigger the repopulation of a dataTable as well as the update of values in other components. Until today this all worked as the actionListener was triggered before the repopulation phase. However with this new build it looks like the immediate attribute is not taken into account, i.e. the repopulation phase in my app is triggered before the event handling Is that a bug or am I doing something wrong? Thanks for your help, Emmanuel
TR : Dynamic Locale change
Title: Message Sorry for asking so much questions but I'll have to present my webapp very soon and I need the multi-language to works fine. Has anybody any idea ? Why the locale is reset to the default one ? Could it comes from a redirect/ instruction in my faces-config.xml ? Ty for your help :D Clément -Message d'origine-De: Clément Maignien Envoyé: lundi 22 août 2005 18:18À: MyFaces DiscussionObjet: Dynamic Locale change Hi, I'm trying to allow the application user to change the language of my web app. I did it the way it is done in the myFaces 1.0.9 examples : a selectOneMenu with a choice of languages and an action button with that code : OptionBean { ... public String action { ... FacesUtil.setLocale(selectedLocale); ... } ... } FacesUtil { ... public static void setLocale(Locale l) { FacesContext.getCurrentInstance().getFacesContext().getViewRoot().setLocale(l); } ... } It works fine when the action is executed (the language change), but as soonas I navigate to another page of the App, the language is resetted to the default one. Why ? NB: I'm trying not to use the locale parameter of the f:view tag ... Thx, Clément.
Re: RE : Let's write that doc!
You know what? There is nothing like official information. If you start off doing the doc on the wiki, and it gets better than the one on the webpage (and trust me, I will add a link to the corresponding wiki pages from the component pages to ensure competitition is fair); your doc will grow to be official. Why don't we start an official doc competition? Ready - steady - go! and after some time, we can reevaluate the approaches Have fun documenting on the WIKI! regards, Martin On 8/26/05, ir. ing. Jan Dockx [EMAIL PROTECTED] wrote: Trust me, I love the work you're doing. And I don't want to make enemies. Sadly, the response you sent confirms my analysis: you are very, very busy after hours making great code for MyFaces, and you have no time to spent on the documentation 'right now'. That next version needs shipping. You're being bugged by users on the mailing list that really need it, and you want to oblige. Furthermore, from looking at the history of the project, it is clear that the committers don't really have a natural drive towards user documentation. Now, that is not a complaint, that is not a reproach, it's however a fact. You're not alone in those dire straits, BTW ;-). But the fact remains that user documentation is not a priority for you, since the committers know the code from the inside, and don't have this itch: you don't need user documentation yourself. All this together makes that we will not have even mediocre user documentation for a while. That's a problem for your users. What I am suggesting is that you prioritize, and put the svn / forrest documentation on hold for now. Stabilize the code, and get that next version out! What you like to do, what you want to do, and what you are good at. In the mean while, lower the bar for users to scratch their itch, and motivate them to solve their own problem, and leave you to focus at the code. Yes, for users it is too hard to write forrest documentation. I work with a bunch of them. Seriously. Promote the wiki to official documentation at interim, and plan to move it to the svn / forrest documentation format at a later time, and respond to all emails with if you solved your issue, and you understand the component a bit better now, please report your findings in the wiki; it's 10 minutes work. At a later time, you will find an almost finished documentation set, you can work into the format you require. But I strongly believe that for that to succeed, 1) the bar needs to be extremely low for users 2) it needs to be 'official' (be it at interim) 3) new users need to be pointed to the 'growing documentation', directly, it can't be second tier (be it at interim) 4) and they need to be reminded constantly that they can easily contribute (mailing list) Sorry, couldn't resist on making my point. I hope I convinced the committers, but I'll leave it at this. I'm going to bed now ;-). On 26 Aug 2005, at 0:17, Sean Schofield wrote: It's not too hard to write forrest documentation. It takes a little bit of effort and if you or any other user does not want to put forth that effort then fine. As for your lack of interest in creating svn patches ... well that is how things are done at the ASF. The project is not a giant free-for-all like a wiki is. We rely on our users to help us. There are many ways to help. The most important is this mailing list. Users helping other users. If you have something you want to share with other users then the wiki is fine. Nobody is afraid of wikis and if you look at what I said in my earlier post, I gave several examples of where wiki's are appropriate. In fact, I am the one who added a link to the wiki from our website and I made several updates to the wiki (for project management stuff) just yesterday. The tomahawk documentation is a key part of the MyFaces project that is every bit as important as the source code. So therefore we have chosen to put the same restrictions on this documentation as we do the source code. Yes that slows things down but you are focusing on the down-side. It also keeps things under control and useable. Again I refer you to other ASF projects (commons, ant, struts, etc.) Some have wikis but the key documentation on how to use the product is part of svn and under control of the PMC and committers. Sorry, that's just how ASF works. We're happy to accept consider any of your suggestions/contributions. If you would like to limit your contributions to mailing list participation and/or wiki documentation we welcome your help. I agree that there is a lack of documentation. We are working on it. We all have day jobs and things on this project are moving incredibly fast. Please bear with us or better yet, help us in the way we most need help (xdocs and svn patches.) sean I'm not saying *I* am not writing doc's on the wiki. I am saying that with
new panelTabbedPane problems
I used until now myFaces 1.0.9 version. Now I use tomahawk.jar lib nightly (20050824) . Problems are : 1. panelTabbedPane from simple example does not work with h:commandLink instead of h:commandButton. If you are in second or third tab, after click h:commandLink, panelTabbedPane will displays first tab. 2. I cannot use dataTable inside of an tab (other than first tab) of panelTabbedPane, like I used in previews version (myfaces.jar 1.0.9). After click to change the page of dataTable , panelTabbedPane displays fist tab. Is there a possibility to have server side switch of tabs of panelTabbedPane like in previous version ? In tomahawk is client side. Bogdan Sava
RE: Invalid bit mask of 14
I'm also getting the same error you had, Invalid bit mask of 14. I was wondering how you solved your problem? I'm using the latest build (8/24) and am trying to use tree2 to create a dynamic tree. I implemented my actionListener like this: public void addNewNode(ActionEvent event){ UIComponent component = event.getComponent(); UIComponent parent = component.getParent().getParent(); HtmlTree tree = (HtmlTree) parent; TreeNode treeData = tree.getNode(); TreeNode newNode = new TreeNodeBase(name, description, identifier, true); treeData.getChildren().add(newNode); } --- in jsp --- f:facet name=type h:panelGroup h:commandLink action=#{t.toggleExpanded} actionListener=#{tree.addNewNode} h:graphicImage value=/images/yellow-folder-open.png rendered=#{t.nodeExpanded} styleClass=nodeFolder/ h:graphicImage value=/images/yellow-folder-closed.png rendered=#{!t.nodeExpanded} styleClass=nodeFolder/ /h:commandLink h:outputText value=#{node.description} styleClass=nodeFolder / /h:panelGroup /f:facet Thx, -Ky -Original Message- From: Sean Schofield [mailto:[EMAIL PROTECTED] Sent: Sunday, August 14, 2005 8:48 AM To: MyFaces Discussion Subject: Re: Invalid bit mask of 14 Yes there is a way but its a bit difficult to pull off without something like Shale's prerender method. There is a expandAll method on the UITreeData but there's a catch. It can't be called until the tree has been populated with all of the model stuff. I can really see a way to have it as a *property* on tree2 (ie. t:tree2 value=#{backer.getData} expandAll=true) This is coming from the new TreeState interface which maintains the expanded state of the nodes. You can't set all of the nodes to be expanded until you have all of the nodes loaded into your TreeModel. Of course you could come up with your own TreeModel/TreeState combination that will do this but its difficult to provide one that is appropriate for all sorts of scenarios (dynamic model and well-defined tree model where all nodes are known in advance.) I'm still trying to figure out a way around this problem. Let me know if you come up with any ideas. sean On 8/12/05, Enrique Medina [EMAIL PROTECTED] wrote: Solved, but now I was wondering whether there is a way to show the tree with all the nodes expanded by default at the first time, rather than provinding a link to expand them all... 2005/8/12, Enrique Medina [EMAIL PROTECTED]: Umm, I'll take a look. Thanks :-) 2005/8/12, Sean Schofield [EMAIL PROTECTED] : Martin's right. This happens when HtmlTreeRenderer encounters an unexpected condition. Most likely you are using your own instance of TreeNode. isLeaf is just one of a few possible explanations. It comes down to the fact that you have an illogical set of results when the bitmask is calcualted during rendering (like the node is expanded but it has no children.) sean On 8/12/05, Martin Marinschek [EMAIL PROTECTED] wrote: See our faq on this: Q: I'm getting an exception Invalid bit mask of ... A: You are probably returning the incorrect value for the isLeaf method of the TreeNode interface. HTH, Martin On 8/12/05, Enrique Medina [EMAIL PROTECTED] wrote: Hi, What the hell is this? I downloaded the nightly version (10th, August) and suddenly I recompile my application and get this exception: javax.faces.FacesException: Invalid bit mask of 14 at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch (ServletExternalContextImpl.java:421) at org.apache.myfaces.application.jsp.JspTilesViewHandlerImpl.dispatch(Js pTilesViewHandlerImpl.java:233) at org.apache.myfaces.application.jsp.JspTilesViewHandlerImpl.renderView (JspTilesViewHandlerImpl.java:219) at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:2 99) at javax.faces.webapp.FacesServlet.service(FacesServlet.java :95) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appli cationFilterChain.java:237) at org.apache.catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain.java:157) at net.sf.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter (FilterChainProxy.java:292) at net.sf.acegisecurity.intercept.web.FilterSecurityInterceptor.invoke (FilterSecurityInterceptor.java:84) at net.sf.acegisecurity.intercept.web.SecurityEnforcementFilter.doFilter( SecurityEnforcementFilter.java:182) at net.sf.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter (FilterChainProxy.java:303) at net.sf.acegisecurity.ui.basicauth.BasicProcessingFilter.doFilter(Basic ProcessingFilter.java:206) at
Re: x:convertBoolean
Yes this is true and yes SVN seems to be down (actually the entire server on which SVN resides is down.) I have informed the appropriate people about that. sean On 8/25/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I think you'll want to put it in a package for the sandbox, not tomahawk. I'd check to see if this is true, but http://svn.apache.org/repos/asf/myfaces/ gives me a gateway timeout. Dennis Byrne
Re: RE : Let's write that doc!
On 8/25/05, ir. ing. Jan Dockx [EMAIL PROTECTED] wrote: Trust me, I love the work you're doing. And I don't want to make enemies. I'm standing on the sidelines on this particular issue, but it is worth making a point here ... people who end up making major contributions to the open source community tend not to pay any attention to we've always done it this way sorts of limitations, and go do their own thing. In the context of the current discussion, you are making a *horrendously* incorrect assumption. Why do you *care* if the existing MyFaces developers think a wiki is the right way to accumulate sufficient useful documentation in the short term? Just do it. If your idea works ... that is, we see MyFaces users gather together and actually create significant quantities of documentation of significant quality, the very concept will catch on like wildfire. From what I know of the PHP community, this certainly seems to be possible. On the other hand, if nobody contributes, you will have turned out to be one of the many idealists who have a great idea for what someone *else* should do, but nobody else buys in to doing the actual grung work. The assumption that whatever user-developed wiki based documentation *must* be blessed by the MyFaces developers as official is ridiculous -- *please* go create the documentation that you, and other MyFaces users, need! I can vouch for the fact that the MyFaces developers are smarter than the average bear (yes, dating myself to Yogi Bear cartoons :-). If what you create causes a groundswell of participation, the MyFaces developers would be foolish to ignore it. On the other hand, maybe nobody else other than you actually cares enough to contrbute to this effort. Then, it's perfectly legitimate for the MyFaces developers to switch over to a totally different (yes, still US-centric :-) TV commercial paradigm, and ask where's the beef? For the last year or so, I've taken on the personal mantra (related to open source involvement) that code speaks louder than words. In the global context of making open source a globally used technology, documentation is at *least* as important as code. So, where's the beef? Craig McClanahan
Re: h:commandLink with f:param not working with expired session.
FYI, Looks like there's a bug in JSF. See http://forum.java.sun.com/thread.jspa?threadID=549675tstart=0 Hope this helps anyone else who may be running into this problem. On 8/24/05, Ken [EMAIL PROTECTED] wrote: I'm attempting to convert working Sun JSF RI application to MyFaces containing many h:commandLinks with nested f:param tags. For some reason most but not all of my commandLinks no longer execute the action method when my session has expired. I'm not sure why some work and others don't anymore with MyFaces. Can't determine the difference but behavior is inconsistent even within the same h:form tag. Instead, framework goes straight back to the same jsp page for many of my commandLinks without giving me a chance to do anything in the action method. I've tried various configurations of the type attribute (button, submit). Tried commandButton. Also tried various org.apache.myfaces.DETECT_JAVASCRIPT and org.apache.myfaces.ALLOW_JAVASCRIPT parameter settings in web.xml. What am I missing? Anyone have any ideas why my action methods aren't getting called after my session has expired? Thanks, Ken
Re: x:convertBoolean
Looking forward to your contribution. Dennis is correct in pointing out that the patch should be for sandbox. Feel free to ask around on the dev list if you have questions regarding procedure, patching, etc. sean On 8/25/05, Ken Weiner [EMAIL PROTECTED] wrote: Ok, great, I will get familiar with the sandbox, change my code to follow the packages for tomahawk, and submit patches to JIRA. Looking forward to participating... On 8/25/05, Sean Schofield [EMAIL PROTECTED] wrote: Suggestion: Add an issue to JIRA (select sandbox as the component type.) This gives committers a chance to shout down any ideas they find completely objectionable so you don't waste your time (this is not one of those ideas btw.) Then provide a SVN patch and we'll add it to sandbox. Be prepared to provide documentation and a simple example (or add to an existing simple example) when appropriate. The docs and examples are now required for new tomahawk goodies. sean On 8/25/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Looks convenient Ken. Please post your code. I would like to see it, even if this does not make it to the issue tracker. Dennis Byrne
RE : new panelTabbedPane problems
Hi, I use the same nightly build than yours and I can use a dataTable in every tab of my tabbedPane ... Maybe theres an error in your code. Regards, Clément -Message d'origine- De : Bogdan Sava [mailto:[EMAIL PROTECTED] Envoyé : vendredi 26 août 2005 10:20 À : MyFaces Discussion Objet : new panelTabbedPane problems I used until now myFaces 1.0.9 version. Now I use tomahawk.jar lib nightly (20050824) . Problems are : 1. panelTabbedPane from simple example does not work with h:commandLink instead of h:commandButton. If you are in second or third tab, after click h:commandLink, panelTabbedPane will displays first tab. 2. I cannot use dataTable inside of an tab (other than first tab) of panelTabbedPane, like I used in previews version (myfaces.jar 1.0.9). After click to change the page of dataTable , panelTabbedPane displays fist tab. Is there a possibility to have server side switch of tabs of panelTabbedPane like in previous version ? In tomahawk is client side. Bogdan Sava
[ANNOUNCE] A Call for Volunteers
The MyFaces team has created a new Wiki that we plan to use to keep users informed of our current needs. If anyone would like to do a little extra to help the community effort you can check out the wiki for details on where we need assistance: http://wiki.apache.org/myfaces/Help_Wanted The MyFaces project is growing very rapidly right now. We have lots of new users, bugs, enhancements, etc. The MyFaces JSF implementation is also about to undergo preliminary JSF 1.1 compatability testing. Following the results of these tests we will have even more to do as we address newly uncovered issues. Any assistance will be appreciated. Thanks to all of the contributors so far who are now becoming too numerous to mention.
Re: RE : Let's write that doc!
Yes, get us the beef ;) You can change something if you are motivated (and motivate others), that's for sure! regards, Martin On 8/26/05, Craig McClanahan [EMAIL PROTECTED] wrote: On 8/25/05, ir. ing. Jan Dockx [EMAIL PROTECTED] wrote: Trust me, I love the work you're doing. And I don't want to make enemies. I'm standing on the sidelines on this particular issue, but it is worth making a point here ... people who end up making major contributions to the open source community tend not to pay any attention to we've always done it this way sorts of limitations, and go do their own thing. In the context of the current discussion, you are making a *horrendously* incorrect assumption. Why do you *care* if the existing MyFaces developers think a wiki is the right way to accumulate sufficient useful documentation in the short term? Just do it. If your idea works ... that is, we see MyFaces users gather together and actually create significant quantities of documentation of significant quality, the very concept will catch on like wildfire. From what I know of the PHP community, this certainly seems to be possible. On the other hand, if nobody contributes, you will have turned out to be one of the many idealists who have a great idea for what someone *else* should do, but nobody else buys in to doing the actual grung work. The assumption that whatever user-developed wiki based documentation *must* be blessed by the MyFaces developers as official is ridiculous -- *please* go create the documentation that you, and other MyFaces users, need! I can vouch for the fact that the MyFaces developers are smarter than the average bear (yes, dating myself to Yogi Bear cartoons :-). If what you create causes a groundswell of participation, the MyFaces developers would be foolish to ignore it. On the other hand, maybe nobody else other than you actually cares enough to contrbute to this effort. Then, it's perfectly legitimate for the MyFaces developers to switch over to a totally different (yes, still US-centric :-) TV commercial paradigm, and ask where's the beef? For the last year or so, I've taken on the personal mantra (related to open source involvement) that code speaks louder than words. In the global context of making open source a globally used technology, documentation is at *least* as important as code. So, where's the beef? Craig McClanahan -- http://www.irian.at Your JSF powerhouse - JSF Trainings in English and German
Navigation bug through browser previous button
Title: Message Hi everybody, there's a bug in my webapp when I use the browser "previous page"navigation button instead of my custom links : When clicking "previous page" the button, the previous page displays well but redisplays as soon a I do an action in the page and as a consequence skip it. In my opinion, this could comes from the SERVER_STATE saving method associated to the redirect instruction in my faces-config.xml. Does it comes from that ? if yes, is there a solution to this problem without switching tothe CLIENT_STATE saving method ? if no, where does it comes from ? Thanks for your help Clément.
Re: Having trouble with JSTL inside JSF
Well, there is a way in MyFaces to do so. check out the t:aliasBean! regards, Martin On 8/26/05, Udo Schnurpfeil [EMAIL PROTECTED] wrote: * The fact that you can use a value binding expression on nearly every attribute makes using rt expressions redundant ... you can do anything you need with a value binding anyway. A very powerful feature in JSP 2.0 are Custom Tags. Having a bean Foo in your application with several instances. Now you write some code to edit this bean. If you put this code into a custom tag like WEB-INF/tags/beans/foo.tag begin -- %@ attribute name=bean % h:outputLabel value=here comes my bean: / h:inputText value=#{${bean}.firstName} / h:inputText value=#{${bean}.secondName} / foo.tag end you can use this snip many times on your jsp like page.jsp begin -- %@ taglib tagdir=/WEB-INF/tags/beans prefix=beans % beans:foo bean=foo1 / beans:foo bean=foo2 / beans:foo bean=foo3 / page.jsp end Unfortunately this does not work. Because of the rtexpression=false. In tobago we decided to enable the feature, to make such things work. Is there a way in JSF 1.2 / JSP 2.1 to make such sniplets run without dublicating code? Udo In JSF 1.2 / JSP 2.1, the concepts are getting unified ... but in the mean time (when the JSP container doesn't know what a value binding expression is) this was the decision made at the JSF spec level. Craig -- http://www.irian.at Your JSF powerhouse - JSF Trainings in English and German
tree2 help needed urgently.
Hi , Im using tree2 component in my project. In my listener class I retrieve the currentnode clicked whose value I have to pass to my treeBacker class for some processing. Is there any way of maintaining state given in myfaces API .. ?? Please let me know ASAP . Regards. Pallavi. This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message. Any unauthorised review, use, disclosure, dissemination, forwarding, printing or copying of this email or any action taken in reliance on this e-mail is strictly prohibited and may be unlawful. Visit us at http://www.cognizant.com
MyFaces Ajax by Smirnov
Hi, I suppose some of you are using the great AJAX framework provided by Smirnov. I was trying to simple give AJAX power only to the datatables in my application, so: a) I added the new CommandLink renderer to the faces-config.xml file b) I added the tag ajax:view to the page where my datable is defined using t:dataTable (actually my page is a subview - I'm using Tiles) c) I added the necessary JARs to my LIB folder When I run the application, the page gets perfectly rendered, but when I click on the scroller, nothing happens. I go to the _javascript_ console and this error is shown: Error: [Exception... Component returned failure code: 0x80040111 (NS_ERROR_NOT_AVAILABLE) [nsIXMLHttpRequest.getResponseHeader] nsresult: 0x80040111 (NS_ERROR_NOT_AVAILABLE) location: JS frame :: http://localhost:8080/DeltaR/faces/myFacesExtensionResource/ajax.UIAjaxViewComponent/11245933/JSFAJAX.js :: anonymous :: line 48 data: no] Source File: http://localhost:8080/DeltaR/faces/myFacesExtensionResource/ajax.UIAjaxViewComponent/11245933/JSFAJAX.js Line: 48 where the source line is: var idsFromResponse = req.getResponseHeader(Ajax-Update-Ids); So my questions are: a) Is it possible to only use this AJAX framework to have AJAXed datatables (just changing the CommanLinkRenderer)? b) What is the difference between ajax:view and ajax:page? Which one should be used when inside a f:subview, as I am using tiles? Thanks for your help ;-)
Re: Having trouble with JSTL inside JSF
Hmmm, I worry about this will not solve my problem. I understand the t:aliasBean to use like this: page.jsp begin -- t:aliasBean alias=#{foo} value=#{foo1} / beans:foo / t:aliasBean alias=#{foo} value=#{foo2} / beans:foo / page.jsp end -- and use h:inputText value=#{foo.firstName} / in the custom tag. So far, so good. But, I want to use, of course, the tobago layout manager for layouting: t:panel f:facet name=layoutt:gridLayout ... /f:facet t:aliasBean alias=#{foo} value=#{foo1} / beans:foo / t:aliasBean alias=#{foo} value=#{foo2} / beans:foo / /t:panel The layout manager has to know all of its containers children to make an appropriate layout. So the panel has rendersChilden=true, and all the tags will be parsed before rendering. In the moment where #{foo.firstname} will be evaluated by the renderer (2 times), the value of #{foo} equals #{foo2}, because it will be done at the end tag of the panel (/t:panel). regards Udo Martin Marinschek wrote: Well, there is a way in MyFaces to do so. check out the t:aliasBean! regards, Martin On 8/26/05, Udo Schnurpfeil [EMAIL PROTECTED] wrote: * The fact that you can use a value binding expression on nearly every attribute makes using rt expressions redundant ... you can do anything you need with a value binding anyway. A very powerful feature in JSP 2.0 are Custom Tags. Having a bean Foo in your application with several instances. Now you write some code to edit this bean. If you put this code into a custom tag like WEB-INF/tags/beans/foo.tag begin -- %@ attribute name=bean % h:outputLabel value=here comes my bean: / h:inputText value=#{${bean}.firstName} / h:inputText value=#{${bean}.secondName} / foo.tag end you can use this snip many times on your jsp like page.jsp begin -- %@ taglib tagdir=/WEB-INF/tags/beans prefix=beans % beans:foo bean=foo1 / beans:foo bean=foo2 / beans:foo bean=foo3 / page.jsp end Unfortunately this does not work. Because of the rtexpression=false. In tobago we decided to enable the feature, to make such things work. Is there a way in JSF 1.2 / JSP 2.1 to make such sniplets run without dublicating code? Udo In JSF 1.2 / JSP 2.1, the concepts are getting unified ... but in the mean time (when the JSP container doesn't know what a value binding expression is) this was the decision made at the JSF spec level. Craig -- Dipl.-Math. Udo Schnurpfeil - Executive Officer - Atanion GmbH Software Development - Bismarckstraße 13 - 26122 Oldenburg - Germany phone +49 441 4082310 - mobile +49 174 9784746 - fax +49 441 4082333 mailto:[EMAIL PROTECTED] - http://www.atanion.com
Re: TR : Dynamic Locale change
If you set the locale in the UIViewRoot manually, I don't know if it will be passed on to the next UIViewRoot. One solution for you might be putting the users locale in the session (e.g. the key locale or user.locale if your have a user object) and use the locale attribute f:view locale=#{locale} or f:view locale=#{user.locale} on all of your JSF pages. regards, Udo Clément Maignien wrote: Sorry for asking so much questions but I'll have to present my webapp very soon and I need the multi-language to works fine. Has anybody any idea ? Why the locale is reset to the default one ? Could it comes from a redirect/ instruction in my faces-config.xml ? Ty for your help :D Clément -Message d'origine- *De :* Clément Maignien *Envoyé :* lundi 22 août 2005 18:18 *À :* MyFaces Discussion *Objet :* Dynamic Locale change Hi, I'm trying to allow the application user to change the language of my web app. I did it the way it is done in the myFaces 1.0.9 examples : a selectOneMenu with a choice of languages and an action button with that code : OptionBean { ... public String action { ... FacesUtil.setLocale(selectedLocale); ... } ... } FacesUtil { ... public static void setLocale(Locale l) { FacesContext.getCurrentInstance().getFacesContext().getViewRoot().setLocale(l); } ... } It works fine when the action is executed (the language change), but as soon as I navigate to another page of the App, the language is resetted to the default one. Why ? NB : I'm trying not to use the /locale/ parameter of the /f:view/ tag ... Thx, Clément.
Re: Tree2 and actionListeners
I would agree with Mathias that this doesn't seem to be a Tree2 problem, especially if your actionListener is getting called. What do you mean by the repopulation is done before that? The component tree will be recreated and the tree data can be set but it should still be possible to add to the tree data before rendering. sean On 8/26/05, Emmanuel Jay [EMAIL PROTECTED] wrote: Not sure if this is a tree2 specific problem, I can just see that for some reason the behaviour seems to have changed in my app when I switch to 20050822. Yes the actionListener is called in the APPLY_REQUEST_VALUES(2) phase, and the repopulation is done before that (which means that when I click on the commandLink) the data I retrieve is wrong. The commandLink behave normally outside of the tree. The dataTable is generated dynamically (in fact I generate n datatables dynamically), and at the moment contains outputText and commandLinks. I am really puzzled... On 8/25/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hmm, strange. Are you sure that this is a tree2 specific problem? AFAIK the recent changes in the tree2 should not influence the behaviour of a commandLink. Is the actionListener called at all? Can you determine the phase in which this happens? Does the commandLink behave normally when it is outside of the tree? Do you use input components to display your data (in the dataTable)? [EMAIL PROTECTED] schrieb am 23.08.2005 15:05:18: Hi, Just got the 20050822 build and I have problems with my app (I did not have this problem with the 20050802 build). The problem is as follows. I have a tree2 where each item is a commandLink (with immediate set to true) with an actionListener. A click on a tree item should trigger the repopulation of a dataTable as well as the update of values in other components. Until today this all worked as the actionListener was triggered before the repopulation phase. However with this new build it looks like the immediate attribute is not taken into account, i.e. the repopulation phase in my app is triggered before the event handling Is that a bug or am I doing something wrong? Thanks for your help, Emmanuel
Re: tree2 help needed urgently.
You want to know which node was clicked or do you want to preserve that information? To find out which node was clicked, you can add an actionListener and check the node identifier. It won't give you the true node id that the model uses but the identifier will be whatever you set it to so you can choose something meaningful. The most recently selected node is also known to tree2 but there seems to be a minor issue with that at the moment. sean On 8/26/05, Kolhe, Pallavi (Cognizant) [EMAIL PROTECTED] wrote: Hi , I'm using tree2 component in my project. In my listener class I retrieve the currentnode clicked whose value I have to pass to my treeBacker class for some processing. Is there any way of maintaining state given in myfaces API .. ?? Please let me know ASAP . Regards. Pallavi. This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message. Any unauthorised review, use, disclosure, dissemination, forwarding, printing or copying of this email or any action taken in reliance on this e-mail is strictly prohibited and may be unlawful. Visit us at http://www.cognizant.com
Re: Having trouble with JSTL inside JSF
in fact, you would use the alias bean like this: t:panel f:facet name=layoutt:gridLayout ... /f:facet t:aliasBean alias=#{foo} value=#{foo1} beans:foo / /t:aliasBean t:aliasBean alias=#{foo} value=#{foo2} beans:foo / /t:aliasBean /t:panel but in any case, you are right, the JSF expression is not there any more when you close the t:panel tag. regards, Martin On 8/26/05, Udo Schnurpfeil [EMAIL PROTECTED] wrote: Hmmm, I worry about this will not solve my problem. I understand the t:aliasBean to use like this: page.jsp begin -- t:aliasBean alias=#{foo} value=#{foo1} / beans:foo / t:aliasBean alias=#{foo} value=#{foo2} / beans:foo / page.jsp end -- and use h:inputText value=#{foo.firstName} / in the custom tag. So far, so good. But, I want to use, of course, the tobago layout manager for layouting: t:panel f:facet name=layoutt:gridLayout ... /f:facet t:aliasBean alias=#{foo} value=#{foo1} / beans:foo / t:aliasBean alias=#{foo} value=#{foo2} / beans:foo / /t:panel The layout manager has to know all of its containers children to make an appropriate layout. So the panel has rendersChilden=true, and all the tags will be parsed before rendering. In the moment where #{foo.firstname} will be evaluated by the renderer (2 times), the value of #{foo} equals #{foo2}, because it will be done at the end tag of the panel (/t:panel). regards Udo Martin Marinschek wrote: Well, there is a way in MyFaces to do so. check out the t:aliasBean! regards, Martin On 8/26/05, Udo Schnurpfeil [EMAIL PROTECTED] wrote: * The fact that you can use a value binding expression on nearly every attribute makes using rt expressions redundant ... you can do anything you need with a value binding anyway. A very powerful feature in JSP 2.0 are Custom Tags. Having a bean Foo in your application with several instances. Now you write some code to edit this bean. If you put this code into a custom tag like WEB-INF/tags/beans/foo.tag begin -- %@ attribute name=bean % h:outputLabel value=here comes my bean: / h:inputText value=#{${bean}.firstName} / h:inputText value=#{${bean}.secondName} / foo.tag end you can use this snip many times on your jsp like page.jsp begin -- %@ taglib tagdir=/WEB-INF/tags/beans prefix=beans % beans:foo bean=foo1 / beans:foo bean=foo2 / beans:foo bean=foo3 / page.jsp end Unfortunately this does not work. Because of the rtexpression=false. In tobago we decided to enable the feature, to make such things work. Is there a way in JSF 1.2 / JSP 2.1 to make such sniplets run without dublicating code? Udo In JSF 1.2 / JSP 2.1, the concepts are getting unified ... but in the mean time (when the JSP container doesn't know what a value binding expression is) this was the decision made at the JSF spec level. Craig -- Dipl.-Math. Udo Schnurpfeil - Executive Officer - Atanion GmbH Software Development - Bismarckstraße 13 - 26122 Oldenburg - Germany phone +49 441 4082310 - mobile +49 174 9784746 - fax +49 441 4082333 mailto:[EMAIL PROTECTED] - http://www.atanion.com -- http://www.irian.at Your JSF powerhouse - JSF Trainings in English and German
RE : TR : Dynamic Locale change
Thx Udo but look at the NB of my first message --- NB : I'm trying not to use the locale parameter of the f:view tag This solution works (I've tried it) but not so clean in my opinion. The use of FacesContext.getCurrentInstance().getFacesContext().getViewRoot().setLocale(l) should work as it work in the myfaces1.0.9 examples. Anybody ? Other ideas ? Thx again Udo Regards, Clément -Message d'origine- De : Udo Schnurpfeil [mailto:[EMAIL PROTECTED] Envoyé : vendredi 26 août 2005 15:20 À : MyFaces Discussion Objet : Re: TR : Dynamic Locale change If you set the locale in the UIViewRoot manually, I don't know if it will be passed on to the next UIViewRoot. One solution for you might be putting the users locale in the session (e.g. the key locale or user.locale if your have a user object) and use the locale attribute f:view locale=#{locale} or f:view locale=#{user.locale} on all of your JSF pages. regards, Udo Clément Maignien wrote: Sorry for asking so much questions but I'll have to present my webapp very soon and I need the multi-language to works fine. Has anybody any idea ? Why the locale is reset to the default one ? Could it comes from a redirect/ instruction in my faces-config.xml ? Ty for your help :D Clément -Message d'origine- *De :* Clément Maignien *Envoyé :* lundi 22 août 2005 18:18 *À :* MyFaces Discussion *Objet :* Dynamic Locale change Hi, I'm trying to allow the application user to change the language of my web app. I did it the way it is done in the myFaces 1.0.9 examples : a selectOneMenu with a choice of languages and an action button with that code : OptionBean { ... public String action { ... FacesUtil.setLocale(selectedLocale); ... } ... } FacesUtil { ... public static void setLocale(Locale l) { FacesContext.getCurrentInstance().getFacesContext().getViewRoot().setLocale(l); } ... } It works fine when the action is executed (the language change), but as soon as I navigate to another page of the App, the language is resetted to the default one. Why ? NB : I'm trying not to use the /locale/ parameter of the /f:view/ tag ... Thx, Clément.
Re: TR : Dynamic Locale change
I suggest you take a look at the list archives for Maintain locale across views. I had a similar issue and it seems the locale is not maintained across views when a redirect/ is used. In the end I set f:view locale=#{visit.locale}, where visit is a session scoped bean. Gianni Sorry for asking so much questions but I'll have to present my webapp very soon and I need the multi-language to works fine. Has anybody any idea ? Why the locale is reset to the default one ? Could it comes from a redirect/ instruction in my faces- config.xml ? Ty for your help :D Clément -Message d'origine- *De :* Clément Maignien *Envoyé :* lundi 22 août 2005 18:18 *À :* MyFaces Discussion *Objet :* Dynamic Locale change Hi, I'm trying to allow the application user to change the language of my web app. I did it the way it is done in the myFaces 1.0.9 examples : a selectOneMenu with a choice of languages and an action button with that code : OptionBean { ... public String action { ... FacesUtil.setLocale(selectedLocale); ... } ... } FacesUtil { ... public static void setLocale(Locale l) { FacesContext.getCurrentInstance().getFacesContext().getViewRoot ().setLocale(l); } ... } It works fine when the action is executed (the language change), but as soon as I navigate to another page of the App, the language is resetted to the default one. Why ? NB : I'm trying not to use the /locale/ parameter of the / f:view/ tag ... Thx, Clément.
Re: Tree2 and actionListeners
I apologise as it seemed to be a issue in my code :-o Nothing to do with tree 2 in the end... EmmanuelOn 8/26/05, Sean Schofield [EMAIL PROTECTED] wrote: I would agree with Mathias that this doesn't seem to be a Tree2problem, especially if your actionListener is getting called.What do you mean by the repopulation is done before that?Thecomponent tree will be recreated and the tree data can be set but it should still be possible to add to the tree data before rendering.seanOn 8/26/05, Emmanuel Jay [EMAIL PROTECTED] wrote: Not sure if this is a tree2 specific problem, I can just see that for some reason the behaviour seems to have changedin my app when I switch to 20050822. Yes the actionListener is called in the APPLY_REQUEST_VALUES(2) phase, and the repopulation is done before that (which means that when I click on the commandLink) the data I retrieve is wrong. The commandLink behave normally outside of the tree. The dataTable is generated dynamically (in fact I generate n datatables dynamically), and at the moment contains outputText and commandLinks.I am really puzzled... On 8/25/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hmm, strange. Are you sure that this is a tree2 specific problem? AFAIK the recent changes in the tree2 should not influence the behaviour of a commandLink. Is the actionListener called at all? Can you determine the phase in which this happens? Does the commandLink behave normally when it is outside of the tree? Do you use input components to display your data (in the dataTable)? [EMAIL PROTECTED] schrieb am 23.08.2005 15:05:18: Hi, Just got the 20050822 build and I have problems with my app (I did not have this problem with the 20050802 build). The problem is as follows. I have a tree2 where each item is a commandLink (with immediate set to true) with an actionListener. A click on a tree item should trigger the repopulation of a dataTable as well as the update of values in other components. Until today this all worked as the actionListener was triggered before the repopulation phase. However with this new build it looks like the immediate attribute is not taken into account, i.e. the repopulation phase in my app is triggered before the event handling Is that a bug or am I doing something wrong? Thanks for your help, Emmanuel
Re: portlet modes
Dave Brondsema wrote: How can I create a link which changes portlet modes (view, edit, etc) and states (minimized, normal, etc)? portlet:actionURL var=viewURL portletMode=view/ gives me a URL but when I try to put it in a commandlink or outputlink it doesn't work. ${viewURL} isn't allowed by the TLD and #{viewURL} outputs nothing. Using ${viewURL} in a regular a href gives errors about VIEW_ID I am using uPortal 2.5.0 Thanks! renderURL works instead of actionURL -- Dave Brondsema Software Developer Cornerstone University signature.asc Description: OpenPGP digital signature
rowOn... scripts not fired when creating datatable programmatically
Hi, Have any of you seen any issue with setting the rowOnMouseOver, rowOnMouseOut... fields of a datatable programmatically. I am dynamically generating datatables, and the scripts do not seem to be triggered (they were triggered correctly when I was declaring and creating the datatable in the jsp). In my code I have: dataTable.setRowOnMouseOver(this.style.backgroundColor='#B5'); Emmanuel
Re: TR : Dynamic Locale change
The solution would be quite similar to what was done in a collaborative effort on the mailing list - install a phaselistener, store it in the session, restore it from the session after the redirect. regards, Martin On 8/26/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I suggest you take a look at the list archives for Maintain locale across views. I had a similar issue and it seems the locale is not maintained across views when a redirect/ is used. In the end I set f:view locale=#{visit.locale}, where visit is a session scoped bean. Gianni Sorry for asking so much questions but I'll have to present my webapp very soon and I need the multi-language to works fine. Has anybody any idea ? Why the locale is reset to the default one ? Could it comes from a redirect/ instruction in my faces- config.xml ? Ty for your help :D Clément -Message d'origine- *De :* Clément Maignien *Envoyé :* lundi 22 août 2005 18:18 *À :* MyFaces Discussion *Objet :* Dynamic Locale change Hi, I'm trying to allow the application user to change the language of my web app. I did it the way it is done in the myFaces 1.0.9 examples : a selectOneMenu with a choice of languages and an action button with that code : OptionBean { ... public String action { ... FacesUtil.setLocale(selectedLocale); ... } ... } FacesUtil { ... public static void setLocale(Locale l) { FacesContext.getCurrentInstance().getFacesContext().getViewRoot ().setLocale(l); } ... } It works fine when the action is executed (the language change), but as soon as I navigate to another page of the App, the language is resetted to the default one. Why ? NB : I'm trying not to use the /locale/ parameter of the / f:view/ tag ... Thx, Clément. -- http://www.irian.at Your JSF powerhouse - JSF Trainings in English and German
RE : TR : Dynamic Locale change
OK thx Gianni. So if I sum up things : 2 solutions to dynamically change your application locale : *1- If you use the server STATE_SAVING_METHOD with somes /redirect instructions : Create a bean to save the locale choice This bean must be in session scope or request + saveState Then in each page of your application that needs to be localized, add the locale parameter to them : f:view locale=#{localeBean.locale} *2- If you use the client STATE_SAVING_METHOD ( - no /redirect instructions) : Use the UIViewRoot.setLocale(Locale l) method. For example : FacesContext.getCurrentInstance().getFacesContext().getViewRoot.().setLocale(l); Regards, Clément -Message d'origine- De : [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Envoyé : vendredi 26 août 2005 15:48 À : MyFaces Discussion Objet : Re: TR : Dynamic Locale change I suggest you take a look at the list archives for Maintain locale across views. I had a similar issue and it seems the locale is not maintained across views when a redirect/ is used. In the end I set f:view locale=#{visit.locale}, where visit is a session scoped bean. Gianni Sorry for asking so much questions but I'll have to present my webapp very soon and I need the multi-language to works fine. Has anybody any idea ? Why the locale is reset to the default one ? Could it comes from a redirect/ instruction in my faces- config.xml ? Ty for your help :D Clément -Message d'origine- *De :* Clément Maignien *Envoyé :* lundi 22 août 2005 18:18 *À :* MyFaces Discussion *Objet :* Dynamic Locale change Hi, I'm trying to allow the application user to change the language of my web app. I did it the way it is done in the myFaces 1.0.9 examples : a selectOneMenu with a choice of languages and an action button with that code : OptionBean { ... public String action { ... FacesUtil.setLocale(selectedLocale); ... } ... } FacesUtil { ... public static void setLocale(Locale l) { FacesContext.getCurrentInstance().getFacesContext().getViewRoot ().setLocale(l); } ... } It works fine when the action is executed (the language change), but as soon as I navigate to another page of the App, the language is resetted to the default one. Why ? NB : I'm trying not to use the /locale/ parameter of the / f:view/ tag ... Thx, Clément.
Re: Method binding calls not being made
Possibly validation is failing and the lifecycle never reaches the point where it would execute your action. You might try sticking in h:messages globalOnly=true/ h:messages globalOnly=false/ and see if anything shows up. Otherwise set a breakpoint in LifecycleImpl.execute() and see what phases are being executed. On 8/24/05, Joel Wilson [EMAIL PROTECTED] wrote: I am trying to create an admin section for an online database, right now I'm simply trying to create basic add/edit/remove functionality. Almost everything seems to work, except that my bound methods only call sometimes. There is not logical reason I am seeing for this, there is nothing in my logs about it. When I have my SelectOneListBox bound to a property it pretty much ignores it, once in a while it will try to call the getter, but it has never called the setter. I have tried every combination of things to try and get it working but most seem to have no effect. Does anyone else know if maybe it's the Apple JDK or the Spring Framework's DelegatingVariableResolver, the Tomahawk extensions, maybe even the fact that I have multiple commandXX's in the form? Page backing Bean /* * Created on Aug 23, 2005 * */ package com.devotion.jra.website.pagebeans; import javax.faces.context.FacesContext; import javax.faces.event.ActionEvent; import javax.faces.event.ValueChangeEvent; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.orm.hibernate3.HibernateTemplate; import com.devotion.jra.website.dao.SpringBeanGetter; import com.devotion.jra.website.databeans.Location; public class Locations { private static final Log log = LogFactory.getLog(Locations.class); private HibernateTemplate dao; public static final String SELF = viewLocations; private Location currentItem = new Location(); private Integer currentlySelected = null; // page methods // constructor public Locations() { dao = SpringBeanGetter.getDao(FacesContext.getCurrentInstance()); } // we are asked to create a new location public String newItem() { System.out.println(Creating new current item); currentItem = new Location(); return SELF; } // we are asked to pull the current one from the list public String editItem() { System.out.println(Getting currently selected item); if (currentlySelected != null) setCurrentItem((Location) dao.get(Location.class, currentlySelected)); return SELF; } // we are asked to delete the currently selected one public String removeItem() { System.out.println(Removing currently selected item); if (currentlySelected != null) dao.delete(dao.get(Location.class, currentlySelected)); currentlySelected = null; return SELF; } // we are asked to save the current item public String saveItem() { System.out.println(Saving current item); dao.saveOrUpdate(currentItem); return SELF; } public void listen(ActionEvent e) { System.out.println(Action Event Fired); System.out.println(Source: + e.getSource()); System.out.println(e.toString()); } public void listen(ValueChangeEvent e) { System.out.println(Value Change Event Fired); System.out.println(Source: + e.getSource()); System.out.println(e.toString()); } // -- end page methods // getters and setters public Location getCurrentItem() { System.out.println(Returning current item); return currentItem; } public void setCurrentItem(Location currentItem) { System.out.println(Setting current item); this.currentItem = currentItem; } public Integer getCurrentlySelected() { System.out.println(Returning selection index); return currentlySelected; } public void setCurrentlySelected(Integer currentlySelected) { System.out.println(Setting selection index); this.currentlySelected = currentlySelected; } } JSP File %@ page language=java pageEncoding=UTF-8% %@ taglib uri=http://java.sun.com/jsf/html; prefix=h % %@ taglib uri=http://java.sun.com/jsf/core; prefix=f % %@ taglib uri=http://myfaces.apache.org/extensions; prefix=x% h:outputText value=Locations styleClass=adminPageHeading/ x:aliasBean alias=#{simpleElementBean} value=#{LocationsBean} x:aliasBean alias=#{dao} value=#{LocationsDao} x:aliasBean alias=#{type} value=location h:panelGrid columns=1 h:form h:panelGrid columns=2 styleClass=controlPanelPaneSubPanel h:selectOneListbox size=5 value=#{simpleElementBean.currentlySelected} f:convertNumber type=int/ f:selectItems value=#{dao.selectItems}/
Re: validation skipped w/ commandLink and inputText
Are the table/column/inputTexts set to be rendered? Phases are skipped for non-rendered components. Otherwise, it sounds like a bug. On 8/23/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: More on this... The request values of all inputText elements of the dataTable are not applied to the model. If I take them out of the dataTable, all is well. Dennis Byrne
RE : RE : TR : Dynamic Locale change
Another solution provided by Martin : -Message d'origine- De : Martin Marinschek [mailto:[EMAIL PROTECTED] Envoyé : vendredi 26 août 2005 16:37 À : MyFaces Discussion Objet : Re: TR : Dynamic Locale change The solution would be quite similar to what was done in a collaborative effort on the mailing list - install a phaselistener, store it in the session, restore it from the session after the redirect. regards, Martin -Message d'origine- De : Clément Maignien Envoyé : vendredi 26 août 2005 16:37 À : MyFaces Discussion Objet : RE : TR : Dynamic Locale change OK thx Gianni. So if I sum up things : 2 solutions to dynamically change your application locale : *1- If you use the server STATE_SAVING_METHOD with somes /redirect instructions : Create a bean to save the locale choice This bean must be in session scope or request + saveState Then in each page of your application that needs to be localized, add the locale parameter to them : f:view locale=#{localeBean.locale} *2- If you use the client STATE_SAVING_METHOD ( - no /redirect instructions) : Use the UIViewRoot.setLocale(Locale l) method. For example : FacesContext.getCurrentInstance().getFacesContext().getViewRoot.().setLocale(l); Regards, Clément -Message d'origine- De : [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Envoyé : vendredi 26 août 2005 15:48 À : MyFaces Discussion Objet : Re: TR : Dynamic Locale change I suggest you take a look at the list archives for Maintain locale across views. I had a similar issue and it seems the locale is not maintained across views when a redirect/ is used. In the end I set f:view locale=#{visit.locale}, where visit is a session scoped bean. Gianni Sorry for asking so much questions but I'll have to present my webapp very soon and I need the multi-language to works fine. Has anybody any idea ? Why the locale is reset to the default one ? Could it comes from a redirect/ instruction in my faces- config.xml ? Ty for your help :D Clément -Message d'origine- *De :* Clément Maignien *Envoyé :* lundi 22 août 2005 18:18 *À :* MyFaces Discussion *Objet :* Dynamic Locale change Hi, I'm trying to allow the application user to change the language of my web app. I did it the way it is done in the myFaces 1.0.9 examples : a selectOneMenu with a choice of languages and an action button with that code : OptionBean { ... public String action { ... FacesUtil.setLocale(selectedLocale); ... } ... } FacesUtil { ... public static void setLocale(Locale l) { FacesContext.getCurrentInstance().getFacesContext().getViewRoot ().setLocale(l); } ... } It works fine when the action is executed (the language change), but as soon as I navigate to another page of the App, the language is resetted to the default one. Why ? NB : I'm trying not to use the /locale/ parameter of the / f:view/ tag ... Thx, Clément.
Re: Searching for popup example
Take a look at http://www.jsftutorials.net/interface/jsf-popup.html On 8/24/05, CONNER, BRENDAN (SBCSI) [EMAIL PROTECTED] wrote: See the book Core JavaServer Faces (Geary, Horstman), pp. 587 - 595 (in the section: How do I generate a popup window). - Brendan -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 24, 2005 6:28 AM To: users@myfaces.apache.org Subject: Searching for popup example Hello, does someone know where I can find a good example for a popup? Thanks! Shed -- Ein Service von http://www.sms.at
Tile and Alias Bean
I am trying to use tiles to make designing an application admin interface much easier to maintain. I am having trouble getting tiles and alias to bean to work together and wonder if anyone knows of an workaround or the proper method for getting it to work. I'm including a short amount of my code that should help explain what I am trying to do. FROM adminMainLayout x:aliasBean alias="#{simpleElementBean}" value="#{pageBean}" x:aliasBean alias="#{dao}" value="#{typeDao}" x:aliasBean alias="#{type}" value="#{typeDesc}" h:panelGrid columns="1" f:subview id="selectorAndControls" t:insert attribute="selectorAndControls" flush="false" / /f:subview f:subview id="elementPropertiesPane" t:insert attribute="elementPropertiesPane" flush="false"/ /f:subview /h:panelGrid /x:aliasBean /x:aliasBean /x:aliasBean FROM tiles.xml !-- Locations -- definition name="/admin/locations.tiles" extends="adminMainLayout" put name="typeDesc" value="locations"/ put name="pageTitle" value="Locations"/ put name="pageBean" value="#{LocationsBean}"/ put name="typeDao" value="#{LocationsDao}"/ /definition !-- Time Commitments -- definition name="/admin/timecommitments.tiles" extends="adminMainLayout" !-- put name="elementPropertiesPane" value="/admin/nameAndOrderElementPane.jsp"/-- put name="typeDesc" value="commitments"/ put name="pageTitle" value="Time Commitments"/ put name="pageBean" value="#{TimeCommitmentsBean}"/ put name="typeDao" value="#{TimeCommitmentsDao}"/ /definition !-- Age Ranges -- definition name="/admin/ageranges.tiles" extends="adminMainLayout" !-- put name="elementPropertiesPane" value="/admin/nameAndOrderElementPane.jsp"/-- put name="typeDesc" value="ranges"/ put name="pageTitle" value="Age Ranges"/ put name="pageBean" value="#{AgeRangesBean}"/ put name="typeDao" value="#{AgeRangesDao}"/ /definition
Re: How to call a method in the backing bean from a JSF page
This sounds like it may work for me. I never used Shale, so how do I map the backingbean from fooBar to fooBar.jsp as you mentioned below? in face-config.xml? thanks. On 8/24/05, Saul Qunming Yuan [EMAIL PROTECTED] wrote: Thanks for your response. I guess I didn't make me clear here. My question is how to call a method in the backing bean from a JSF page without rendering out anything to the screen. I would suggest using Shale with JSF. Use the Shale jars and then have your backing bean implement a ViewController (I just extend AbstractViewController), and then you'll have several nice methods you can override. One is called prerender(). So if you map this backingbean to the correct path, for example fooBar, when fooBar.jsp is called the prerender method is invoked. That's the ultra simplified explanation and since I'm new to this, others (Craig) will probably elaborate more. It's really useful though for exactly what you want. -- Rick
Using h:outputLabel
I recently tried to use an h:outputLabel tag against a t:inputText tag and received a compiler error saying the id specified by the for=... attribute was not found. When I changed h:outputLabel to t:outputLabel, the compiler error went away. If, instead, I changed t:inputText to h:inputText, the error also went away. So the bottom line, I guess, is that, when using a Tomahawk component, any outputLabel tag used to refer to it also has to be from the Tomahawk library. (By contrast, a Tomahawk outputLabel can be used against a Tomahawk or non-Tomahawk tag.) Can someone explain why there is this restriction? It's easy enough to use t:outputLabel everywhere, but I was just curious. - Brendan
Opening a new window
Hi, I would like to know if there are any solution to open a new (sub) window with MyFaces. I have a button on my main page and on user clicc I would like to open a new window and display some data in it. Are there any other solutions than using _javascript_? Can the JSF navigation system handle that, and if yes how is it do-able? Thanks for your help, Emmanuel
Fwd: Experience with developing web app. based on MyFaces
Hi, I've been working on an application based on MyFaces 1.0.8. Now, we are moving to MyFaces 1.0.9 and I would like to discuss discovered issues and some ideas (not only related to MyFaces but to JSF in general). AliasBean * This is a pretty useful component and I'm glad that MyFaces contains it! * There were a few bugs in this component in MyFaces 1.0.8 (processSaveState, queueEvent) but now they are fixed (1.0.9) - great Table * This is one of the most used components * It's definitely better than standard table (sorting support, scroller, …) BUT: * Suppose this (selecting a row while model has been concurrently modified by a different user): 1) Your table has 3 rows and you display a check box for each row so that user can select a row 2) User selects first row and submits but another user has concurrently deleted first row. So, model has now only 2 rows. 3) Submitted value (selected checkbox of the first row) will be applied to the first row of the model. So, actually the second row is selected :-(. (we've developed a quite simple solution, so if you are interested, let me know - and we definitely do not serialize whole model of the table!) * It's a common case that table rows have checkboxes and can be selected. So, we have to provide (for most of the tables) model where each row is wrapped in an extra class that has selected property - and that's tedious. DataScroller = * We've discovered following issue: uiData.setFirst(someNewValue) is used within the =decode= method of the HtmlDataScrollerRenderer - it is too early to modify uiData within =apply request values phase=. * If some rows of the table were modified too, they will be applied to wrong table rows :-( (because setFirst has already been called and table contains different rows now) * Our solution: DataScrollerRenderer fires an even that uiData should be updated, and they are updated later in =update model values= phase (just after model has been updated) Backing Bean's State, HttpSession, Concurrent Access within a Session === In my view, a reasonable web application should fulfill following requirements: * users can use browser's navigation buttons (back, forward, reload) * users can use an application from multiple browser tabs (tabs share the same session) Although these requirements look simple and unimportant, they present serious problems and have serious consequences on the whole architecture of an application. * navigation buttons * We use redirects. So, user can use the back button even when he's moved to a next page via HTTP POST * We use javax.faces.STATE_SAVING_METHOD=client. So, even if user has pressed the back button 10 times, a proper view will be restored when he submits form (or clicks link) on the old page (if state saving=server, this would obviously not work - you would have to click twice to perform an action :-)). * But who/when/how will store state of backing beans? - note that if you not store the state of your backing beans on a client, your application will not work. Suppose this: 1) Your page displays a category (it has name, description and sub-categories) 2) User selected category A and it is stored in a property =currentCategory= in your backing bean 3) User selected category B (sub-category of A), so =currentCategory= is now B 4) User uses browser's back button, so he can see detail of category A 5) User edits description of the category (A) and submits the page 6) Description of category B will be updated because =currentCategory= is still B :-( * Solution: a component (saveState) that accepts a value binding and saves the value within its state. E.g. y:saveState value=#{myConroller.pageState}/ * tabbed browsing * Any session scope backing bean is a potential race-condition * Moreover, if your data like currentItem, MyPageConroller have session scope, actions performed in one tab may influence behavior of the other tab Error Handling === * We created a special component similar to the Buffer component. We render a sub-tree of this component into the buffer and if and exception is thrown while processing the sub-tree, we render the exception. (in addition, we had to wrap ActionListener, HtmlDataTablePhaseListener, …). * It would be nice to see an errorHandling component in next MyFaces distribution. I hope that you will find some info from this mail useful and intelligible. Best regards, MN.
Re: Using h:outputLabel
Doh! no clue... can you open an issue on this? regards, Martin On 8/26/05, CONNER, BRENDAN (SBCSI) [EMAIL PROTECTED] wrote: I recently tried to use an h:outputLabel tag against a t:inputText tag and received a compiler error saying the id specified by the for=... attribute was not found. When I changed h:outputLabel to t:outputLabel, the compiler error went away. If, instead, I changed t:inputText to h:inputText, the error also went away. So the bottom line, I guess, is that, when using a Tomahawk component, any outputLabel tag used to refer to it also has to be from the Tomahawk library. (By contrast, a Tomahawk outputLabel can be used against a Tomahawk or non-Tomahawk tag.) Can someone explain why there is this restriction? It's easy enough to use t:outputLabel everywhere, but I was just curious. - Brendan -- http://www.irian.at Your JSF powerhouse - JSF Trainings in English and German
Re: Opening a new window
I dont think this tag opens a new browser window as the _javascript_ function window.open('url',...) would (correct me if I'm wrong and if there is a way to do it with this tag without modifying it)... I nevertheless use the popup tag to display info that is temporary in the same way as in the popup example. On 8/26/05, Dennis Byrne [EMAIL PROTECTED] wrote: This one might help.http://myfaces.apache.org/tlddoc/tomahawk/t/popup.html Original message Date: Fri, 26 Aug 2005 17:53:04 +0200 From: Emmanuel Jay [EMAIL PROTECTED]Subject: Opening a new windowTo: MyFaces Discussion users@myfaces.apache.org Hi, I would like to know if there are any solution to open a new (sub) window with MyFaces.I have a button on my main page and on user clicc I would like to open a new window and display some data in it. Are there any other solutions than using _javascript_? Can the JSF navigation system handle that, and if yes how is it do-able? Thanks for your help, Emmanuel Dennis Byrne
Re: How to call a method in the backing bean from a JSF page
I did it by just making the managedBean name the same as the jsp. So in your case: managed-bean managed-bean-namefooBar/managed-bean-name On 8/26/05, Saul Qunming Yuan [EMAIL PROTECTED] wrote: This sounds like it may work for me. I never used Shale, so how do I mapthe backingbean from fooBar to fooBar.jsp as you mentioned below? inface-config.xml?thanks. On 8/24/05, Saul Qunming Yuan [EMAIL PROTECTED] wrote: Thanks for your response. I guess I didn't make me clear here. My question is how to call a method in the backing bean from a JSF page without rendering out anything to the screen. I would suggest using Shale with JSF. Use the Shale jars and then have your backing bean implement a ViewController (I just extend AbstractViewController), and then you'll have several nice methods you can override. One is called prerender(). So if you map this backingbean to the correct path, for example fooBar, when fooBar.jsp is called the prerender method is invoked. That's the ultra simplified explanation and since I'm new to this, others (Craig) will probably elaborate more. It's really useful though for exactly what you want. -- Rick-- Rick
Developing web app. with MyFaces
Hi, I've been working on an application based on MyFaces 1.0.8. Now, we are moving to MyFaces 1.0.9 and I would like to discuss discovered issues and some ideas (not only related to MyFaces but to JSF in general). AliasBean * This is a pretty useful component and I'm glad that MyFaces contains it! * There were a few bugs in this component in MyFaces 1.0.8 (processSaveState, queueEvent) but now they are fixed (1.0.9) - great Table * This is one of the most used components * It's definitely better than standard table (sorting support, scroller, …) BUT: * Suppose this (selecting a row while model has been concurrently modified by a different user): 1) Your table has 3 rows and you display a check box for each row so that user can select a row 2) User selects first row and submits but another user has concurrently deleted first row. So, model has now only 2 rows. 3) Submitted value (selected checkbox of the first row) will be applied to the first row of the model. So, actually the second row is selected :-(. (we've developed a quite simple solution, so if you are interested, let me know - and we definitely do not serialize whole model of the table!) * It's a common case that table rows have checkboxes and can be selected. So, we have to provide (for most of the tables) model where each row is wrapped in an extra class that has selected property - and that's tedious. DataScroller = * We've discovered following issue: uiData.setFirst(someNewValue) is used within the =decode= method of the HtmlDataScrollerRenderer - it is too early to modify uiData within =apply request values phase=. * If some rows of the table were modified too, they will be applied to wrong table rows :-( (because setFirst has already been called and table contains different rows now) * Our solution: DataScrollerRenderer fires an even that uiData should be updated, and they are updated later in =update model values= phase (just after model has been updated) Backing Bean's State, HttpSession, Concurrent Access within a Session === In my view, a reasonable web application should fulfill following requirements: * users can use browser's navigation buttons (back, forward, reload) * users can use an application from multiple browser tabs (tabs share the same session) Although these requirements look simple and unimportant, they present serious problems and have serious consequences on the whole architecture of an application. * navigation buttons * We use redirects. So, user can use the back button even when he's moved to a next page via HTTP POST * We use javax.faces.STATE_SAVING_METHOD=client. So, even if user has pressed the back button 10 times, a proper view will be restored when he submits form (or clicks link) on the old page (if state saving=server, this would obviously not work - you would have to click twice to perform an action :-)). * But who/when/how will store state of backing beans? - note that if you not store the state of your backing beans on a client, your application will not work. Suppose this: 1) Your page displays a category (it has name, description and sub-categories) 2) User selected category A and it is stored in a property =currentCategory= in your backing bean 3) User selected category B (sub-category of A), so =currentCategory= is now B 4) User uses browser's back button, so he can see detail of category A 5) User edits description of the category (A) and submits the page 6) Description of category B will be updated because =currentCategory= is still B :-( * Solution: a component (saveState) that accepts a value binding and saves the value within its state. E.g. y:saveState value=#{myConroller.pageState}/ * tabbed browsing * Any session scope backing bean is a potential race-condition * Moreover, if your data like currentItem, MyPageConroller have session scope, actions performed in one tab may influence behavior of the other tab Error Handling === * We created a special component similar to the Buffer component. We render a sub-tree of this component into the buffer and if and exception is thrown while processing the sub-tree, we render the exception. (in addition, we had to wrap ActionListener, HtmlDataTablePhaseListener, …). * It would be nice to see an errorHandling component in next MyFaces distribution. I hope that you will find some info from this mail useful and intelligible. Best regards, MN.
Re: Opening a new window
This one might help. http://myfaces.apache.org/tlddoc/tomahawk/t/popup.html Original message Date: Fri, 26 Aug 2005 17:53:04 +0200 From: Emmanuel Jay [EMAIL PROTECTED] Subject: Opening a new window To: MyFaces Discussion users@myfaces.apache.org Hi, I would like to know if there are any solution to open a new (sub) window with MyFaces. I have a button on my main page and on user clicc I would like to open a new window and display some data in it. Are there any other solutions than using javascript? Can the JSF navigation system handle that, and if yes how is it do-able? Thanks for your help, Emmanuel Dennis Byrne
Re: Developing web app. with MyFaces
* Suppose this (selecting a row while model has been concurrently modified by a different user): Is the backing bean that supplies the List/DataModel/UIData in session scope? If so, this is a consequence of the design, not JSF. You'll get the same thing w/ Tapestry, or ASP.NET for that matter. 3) Submitted value (selected checkbox of the first row) will be applied to the first row of the model. So, actually the second row is selected :-(. (we've developed a quite simple solution, so if you are interested, let me know - and we definitely do not serialize whole model of the table!) Please share this w/ the list. This comes up a lot in my shop and it would be appreciated. I'm also looking for ideas for one of my side projects, http://forum.hibernate.org/viewtopic.php?t=945552 . Dennis Byrne
Re: Developing web app. with MyFaces
for 3) : use the preserveDataModel of the dataTable regards, Martin On 8/26/05, Dennis Byrne [EMAIL PROTECTED] wrote: * Suppose this (selecting a row while model has been concurrently modified by a different user): Is the backing bean that supplies the List/DataModel/UIData in session scope? If so, this is a consequence of the design, not JSF. You'll get the same thing w/ Tapestry, or ASP.NET for that matter. 3) Submitted value (selected checkbox of the first row) will be applied to the first row of the model. So, actually the second row is selected :-(. (we've developed a quite simple solution, so if you are interested, let me know - and we definitely do not serialize whole model of the table!) Please share this w/ the list. This comes up a lot in my shop and it would be appreciated. I'm also looking for ideas for one of my side projects, http://forum.hibernate.org/viewtopic.php?t=945552 . Dennis Byrne -- http://www.irian.at Your JSF powerhouse - JSF Trainings in English and German
RE: Opening a new window
Title: Message See the book Core JavaServer Faces (Geary, Horstman), pp. 587 - 595 (in the section: "How do I generate a popup window"). - Brendan -Original Message-From: Emmanuel Jay [mailto:[EMAIL PROTECTED] Sent: Friday, August 26, 2005 10:53 AMTo: MyFaces DiscussionSubject: Opening a new windowHi, I would like to know if there are any solution to open a new (sub) window with MyFaces. I have a button on my main page and on user clicc I would like to open a new window and display some data in it. Are there any other solutions than using _javascript_? Can the JSF navigation system handle that, and if yes how is it do-able?Thanks for your help,Emmanuel
RE: Opening a new window
Title: Message Also, as Mike Kienenberger pointed out in a previous thread on this topic: http://www.jsftutorials.net/interface/jsf-popup.html - Brendan -Original Message-From: CONNER, BRENDAN (SBCSI) Sent: Friday, August 26, 2005 11:43 AMTo: 'MyFaces Discussion'Subject: RE: Opening a new window See the book Core JavaServer Faces (Geary, Horstman), pp. 587 - 595 (in the section: "How do I generate a popup window"). - Brendan -Original Message-From: Emmanuel Jay [mailto:[EMAIL PROTECTED] Sent: Friday, August 26, 2005 10:53 AMTo: MyFaces DiscussionSubject: Opening a new windowHi, I would like to know if there are any solution to open a new (sub) window with MyFaces. I have a button on my main page and on user clicc I would like to open a new window and display some data in it. Are there any other solutions than using _javascript_? Can the JSF navigation system handle that, and if yes how is it do-able?Thanks for your help,Emmanuel
Re: Developing web app. with MyFaces
Thank you for you opinion :-) On 8/26/05, Dennis Byrne [EMAIL PROTECTED] wrote: * Suppose this (selecting a row while model has been concurrently modified by a different user): Is the backing bean that supplies the List/DataModel/UIData in session scope? If so, this is a consequence of the design, not JSF. You'll get the same thing w/ Tapestry, or ASP.NET for that matter. I think that you are not right: - problem is that sequence number of the rows has changed (this problem arises whenever sequence number (position) of a row changes before the page with table is submitted) - we are displaying life data, so if user's had a break and after a while submits the page with the table and data (in db) has been modified concurrently, submitted values will be applied to bad rows :-( - if model were cached in the session, it would surprisingly work - because if the model is cached, it cannot be modified concurrently by a different user 3) Submitted value (selected checkbox of the first row) will be applied to the first row of the model. So, actually the second row is selected :-(. (we've developed a quite simple solution, so if you are interested, let me know - and we definitely do not serialize whole model of the table!) Please share this w/ the list. This comes up a lot in my shop and it would be appreciated. I'm also looking for ideas for one of my side projects, http://forum.hibernate.org/viewtopic.php?t=945552 . Dennis Byrne we've extended MyFaces table. Our table expects stronger data model, that extends DataModel but implementation of our model must: return id of any row, return value of a row by ID So, when the method saveState is called on our table, we store IDs of displayed rows (from first to first+rows). So, if table is scrolled (10 of 1000 rows is displayed), we will serialize only IDs of displayed (10) rows. When table is to be restored, we read serialized row IDs, ask for data (getRowDataById(id)) and we provide a temporary model - this model contains exactly the same data as when the page was previously rendered. After all the request values were applied and model is updated we just restore original model (maybe model contains more or less rows, maybe in a different order ...) Btw. I will definitely check your project :-)
Re: Opening a new window
Thanks for your help Brendan!On 8/26/05, CONNER, BRENDAN (SBCSI) [EMAIL PROTECTED] wrote: Also, as Mike Kienenberger pointed out in a previous thread on this topic: http://www.jsftutorials.net/interface/jsf-popup.html - Brendan -Original Message-From: CONNER, BRENDAN (SBCSI) Sent: Friday, August 26, 2005 11:43 AMTo: 'MyFaces Discussion'Subject: RE: Opening a new window See the book Core JavaServer Faces (Geary, Horstman), pp. 587 - 595 (in the section: How do I generate a popup window). - Brendan -Original Message-From: Emmanuel Jay [mailto:[EMAIL PROTECTED]] Sent: Friday, August 26, 2005 10:53 AMTo: MyFaces DiscussionSubject: Opening a new windowHi, I would like to know if there are any solution to open a new (sub) window with MyFaces. I have a button on my main page and on user clicc I would like to open a new window and display some data in it. Are there any other solutions than using _javascript_? Can the JSF navigation system handle that, and if yes how is it do-able?Thanks for your help,Emmanuel
Re: Developing web app. with MyFaces
- if model were cached in the session, it would surprisingly work - because if the model is cached, it cannot be modified concurrently by a different user The model can still be modified ... by the same user when they open a second browser window. Dennis Byrne
Re: Experience with developing web app. based on MyFaces
It would be great if you could copy all this to the Wiki ;-) http://wiki.apache.org/myfaces/2005/8/26, mirek novak [EMAIL PROTECTED]: Hi, I've been working on an application based on MyFaces 1.0.8. Now, weare moving to MyFaces 1.0.9 and I would like to discuss discoveredissues and some ideas (not only related to MyFaces but to JSF ingeneral). AliasBean * This is a pretty useful component and I'm glad that MyFaces contains it! * There were a few bugs in this component in MyFaces 1.0.8(processSaveState, queueEvent) but now they are fixed (1.0.9) - greatTable * This is one of the most used components * It's definitely better than standard table (sorting support, scroller, …) BUT:* Suppose this (selecting a row while model has beenconcurrently modified by a different user): 1) Your table has 3 rows and you display a check box for eachrow so that user can select a row 2) User selects first row and submits but another user hasconcurrently deleted first row. So, model has now only 2 rows. 3) Submitted value (selected checkbox of the first row) will be applied to the first row of the model. So, actually the second rowis selected :-(. (we've developed a quite simple solution, so if youare interested, let me know - and we definitely do not serialize wholemodel of the table!) * It's a common case that table rows have checkboxes and can beselected. So, we have to provide (for most of the tables) model whereeach row is wrapped in an extra class that has selected property - and that's tedious.DataScroller= * We've discovered following issue: uiData.setFirst(someNewValue)is used within the =decode= method of the HtmlDataScrollerRenderer -it is too early to modify uiData within =apply request values phase=. * If some rows of the table were modified too, they will beapplied to wrong table rows :-( (because setFirst has already beencalled and table contains different rows now) * Our solution: DataScrollerRenderer fires an even that uiData should be updated, and they are updated later in =update model values=phase (just after model has been updated)Backing Bean's State, HttpSession, Concurrent Access within a Session=== In my view, a reasonable web application should fulfill following requirements: * users can use browser's navigation buttons (back, forward, reload) * users can use an application from multiple browser tabs (tabs share the same session)Although these requirements look simple and unimportant, they presentserious problems and have serious consequences on the wholearchitecture of an application. * navigation buttons * We use redirects. So, user can use the back button even whenhe's moved to a next page via HTTP POST* We use javax.faces.STATE_SAVING_METHOD=client. So, even ifuser has pressed the back button 10 times, a proper view will be restored when he submits form (or clicks link) on the old page (ifstate saving=server, this would obviously not work - you would have toclick twice to perform an action :-)).* But who/when/how will store state of backing beans? - note that if you not store the state of your backing beans on a client,your application will not work. Suppose this: 1) Your page displays a category (it has name, descriptionand sub-categories) 2) User selected category A and it is stored in a property=currentCategory= in your backing bean 3) User selected category B (sub-category of A), so=currentCategory= is now B 4) User uses browser's back button, so he can see detail of category A 5) User edits description of the category (A) and submits the page 6) Description of category B will be updated because=currentCategory= is still B :-( * Solution: a component (saveState) that accepts a value binding and saves the value within its state. E.g. y:saveStatevalue=#{myConroller.pageState}/ * tabbed browsing* Any session scope backing bean is a potential race-condition * Moreover, if your data like currentItem, MyPageConrollerhave session scope, actions performed in one tab may influencebehavior of the other tabError Handling=== * We created a special component similar to the Buffer component.We render a sub-tree of this component into the buffer and if andexception is thrown while processing the sub-tree, we render theexception. (in addition, we had to wrap ActionListener, HtmlDataTablePhaseListener, …). * It would be nice to see an errorHandling component in nextMyFaces distribution.I hope that you will find some info from this mail useful and intelligible. Best regards,MN.
Re: x:convertBoolean
Thanks Sean. I just created http://issues.apache.org/jira/browse/MYFACES-451 and uploaded my code and patches in case anyone wants to take a look. I'm happy to add more docs and unit tests if required. On 8/25/05, Sean Schofield [EMAIL PROTECTED] wrote: Looking forward to your contribution. Dennis is correct in pointing out that the patch should be for sandbox. Feel free to ask around on the dev list if you have questions regarding procedure, patching, etc. sean
Re: x:convertBoolean
Docs are required and unit tests are a definite plus. If you thought we were bad with documentation, the lack of unit tests is even worse! We're slowly getting on top of that though. As we add more committers and get through JSF 1.1 certification we will turn our attention to testing. If you can add simple unit tests that don't require cactus, etc. then please add those as well. sean On 8/26/05, Ken Weiner [EMAIL PROTECTED] wrote: Thanks Sean. I just created http://issues.apache.org/jira/browse/MYFACES-451 and uploaded my code and patches in case anyone wants to take a look. I'm happy to add more docs and unit tests if required. On 8/25/05, Sean Schofield [EMAIL PROTECTED] wrote: Looking forward to your contribution. Dennis is correct in pointing out that the patch should be for sandbox. Feel free to ask around on the dev list if you have questions regarding procedure, patching, etc. sean
Re: Experience with developing web app. based on MyFaces
Better take a look at the latest nightly build. I suspect several of your issues have been resolved already in the upcoming 1.0.10 release. We're probably 2-3 weeks away from the release and now is the time to let us know about bugs. (Feature requests can wait until future relelases but bugs should be addressed *now*.) sean On 8/26/05, Enrique Medina [EMAIL PROTECTED] wrote: It would be great if you could copy all this to the Wiki ;-) http://wiki.apache.org/myfaces/ 2005/8/26, mirek novak [EMAIL PROTECTED]: Hi, I've been working on an application based on MyFaces 1.0.8. Now, we are moving to MyFaces 1.0.9 and I would like to discuss discovered issues and some ideas (not only related to MyFaces but to JSF in general). AliasBean * This is a pretty useful component and I'm glad that MyFaces contains it! * There were a few bugs in this component in MyFaces 1.0.8 (processSaveState, queueEvent) but now they are fixed (1.0.9) - great Table * This is one of the most used components * It's definitely better than standard table (sorting support, scroller, …) BUT: * Suppose this (selecting a row while model has been concurrently modified by a different user): 1) Your table has 3 rows and you display a check box for each row so that user can select a row 2) User selects first row and submits but another user has concurrently deleted first row. So, model has now only 2 rows. 3) Submitted value (selected checkbox of the first row) will be applied to the first row of the model. So, actually the second row is selected :-(. (we've developed a quite simple solution, so if you are interested, let me know - and we definitely do not serialize whole model of the table!) * It's a common case that table rows have checkboxes and can be selected. So, we have to provide (for most of the tables) model where each row is wrapped in an extra class that has selected property - and that's tedious. DataScroller = * We've discovered following issue: uiData.setFirst(someNewValue) is used within the =decode= method of the HtmlDataScrollerRenderer - it is too early to modify uiData within =apply request values phase=. * If some rows of the table were modified too, they will be applied to wrong table rows :-( (because setFirst has already been called and table contains different rows now) * Our solution: DataScrollerRenderer fires an even that uiData should be updated, and they are updated later in =update model values= phase (just after model has been updated) Backing Bean's State, HttpSession, Concurrent Access within a Session === In my view, a reasonable web application should fulfill following requirements: * users can use browser's navigation buttons (back, forward, reload) * users can use an application from multiple browser tabs (tabs share the same session) Although these requirements look simple and unimportant, they present serious problems and have serious consequences on the whole architecture of an application. * navigation buttons * We use redirects. So, user can use the back button even when he's moved to a next page via HTTP POST * We use javax.faces.STATE_SAVING_METHOD=client. So, even if user has pressed the back button 10 times, a proper view will be restored when he submits form (or clicks link) on the old page (if state saving=server, this would obviously not work - you would have to click twice to perform an action :-)). * But who/when/how will store state of backing beans? - note that if you not store the state of your backing beans on a client, your application will not work. Suppose this: 1) Your page displays a category (it has name, description and sub-categories) 2) User selected category A and it is stored in a property =currentCategory= in your backing bean 3) User selected category B (sub-category of A), so =currentCategory= is now B 4) User uses browser's back button, so he can see detail of category A 5) User edits description of the category (A) and submits the page 6) Description of category B will be updated because =currentCategory= is still B :-( * Solution: a component (saveState) that accepts a value binding and saves the value within its state. E.g. y:saveState value=#{myConroller.pageState}/ * tabbed browsing * Any session scope backing bean is a potential race-condition * Moreover, if your data like currentItem, MyPageConroller have session scope, actions performed in one tab may influence behavior of the other tab Error Handling === * We created a special component similar to the Buffer component. We
RE: [jira] Commented: (MYFACES-447) tree2 TreeNode interface has too many methods
Title: Message There actuallyare subtle differences among isLeaf(), getChildren.size(), and getChildCount() that are useful: 1. When doing "on-demand" population of the tree, isLeaf() can be false even though there are no children loaded yet (i.e., getChildCount() == 0). 2. I believe that getChildCount() is available for performance reasons insituations whereactually getting the children just to determine the list size can be expensive. - Brendan -Original Message-From: ir. ing. Jan Dockx [mailto:[EMAIL PROTECTED] Sent: Thursday, August 25, 2005 6:26 PMTo: Dennis Byrne (JIRA); MyFaces Discussion; sean schofield (JIRA)Subject: Re: [jira] Commented: (MYFACES-447) tree2 TreeNode interface has too many methodsNow we are on the list, and we can discuss this ;-).The first suggested patch doesn't influence anybody, actually, since the methods that are removed from the interface are not used by any tree2 code. And TreeNodeBase keeps behaving as it did before (actually, for it should better be changed too, but it should stay in now at least for backward compatibility reasons).The second suggested patch takes cleaning up the interface further. But since the differences between isLeaf(), getChildren().isEmpty() and getChildCount() == 0 on the one hand, and getChildren().size() and getChildCount() on the other hand, are rather obscure (and, as far as I can see, not applied consistently in the existing tree2 code either), I bet that there are not that many users out there that depend on the differences. If so, please let me know here: it might increase my understanding of the differences.And if your current implementation of a TreeNode is consistent (getChildCount() == getChildren().size() and isLeaf() == getChildren().isEmpty() == getChildCount() == 0), this change will not affect your code either, since that is how the code is changed in tree2 implementation.On 26 Aug 2005, at 1:10, sean schofield (JIRA) wrote: [ http://issues.apache.org/jira/browse/MYFACES-447?page=comments#action_12320067 ] sean schofield commented on MYFACES-447:No you did not miss a discussion. Don't worry this patch will not be applied in the short term for a few reasons. The first reason is that it is too close to release time to change an interface. The second reason is that we will need to do extensive review and consultation with users before a major change such as this.I'm definitely interested in improving tree2 so I will take a close look at this patch when I get a chance. We can discuss the changes now even if we don't make them for a while.@JanJIRA is a good place to discuss matters like this (especially when patches are provided to help illustrate the requestor's point.) In the future can you also email the user list if you have a *major* change of this nature? Let them know the JIRA link. That way nobody gets left out of a crucial discussion. Bug fixes or minor feature additions (that's don't impact existing features, interfaces) can go directly to JIRA though. This is kind of a special case b/c its a major change.@DennisYou may want to add yourself as a watcher to issues when you do spot them on the dev list. Now that you know you're interested, why take the chance on missing out on an important discussion? tree2 TreeNode interface has too many methods-Key: MYFACES-447URL: http://issues.apache.org/jira/browse/MYFACES-447Project: MyFacesType: ImprovementComponents: TomahawkVersions: Nightly BuildReporter: Jan DockxAttachments: tree2_TreeNode_extensive_patch.txt, tree2_TreeNode_extensive_patch_examples.txt, tree2_TreeNode_patch.txtThe TreeNode interface is the hook for the backing bean developer, the user, into the tree2 framework. As such, the interface should pose minimal requirements for the user. It should only require from the user to implement those methods that are strictly needed for the framework to work, and leave as much freedom for the user as possible.The patch included removes unnecessary methods. Apart from a minor change in TreeNodeBase, the change doesn't affect the existing tree2 code, nor the example, at all.The patch also contains some documentation for the interface, and some suggestions for further changes.-- This message is automatically generated by JIRA.-If you think it was sent incorrectly contact one of the administrators:http://issues.apache.org/jira/secure/Administrators.jspa-For more information on JIRA, see:http://www.atlassian.com/software/jiraMet vriendelijke groeten,Jan DockxPeopleWare NV - Head OfficeCdt.Weynsstraat 85 B-2660 Hoboken Tel: +32 3 448.33.38 Fax: +32 3 448.32.66
Tree2 - problem with the states of the nodes
I am using the tree2 in Myfaces and my requirement is to get the data from the database and build the tree nodes every time a node is expanded. If an expanded node is collapsed I want to remove the nodes under this node from the tree and add the nodes afresh by getting the data from the database when that node is expanded again. I am facing the problem that even if I remove the child nodes of the node that I collapse, when I add the nodes again when I expand that node it seems to remember the state of the child nodes before I collapsed the parent node and removed these child nodes. So if I had a child node which was expanded before I removed it, the next time I expand the parent node and add these child nodes and I click on this child node that was expanded it will not expand on the first click as it was expanded when I removed this node. On the second click It expands. I believe it is collapsing the state on the first click and on the second click it is then expanding. How do I remove the state of the child nodes that I remove from the tree. I use.. List children = node.getChildren(); Children.removeAll(children); . to remove the nodes. Is there another better way to remove the nodes or am I doing it correctly. IF this is correct then how do I remove the states of the nodes the tree maintains. Any help is much appreciated. ** Please be aware that, notwithstanding the fact that the person sending this communication has an address in Bear Stearns' e-mail system, this person is not an employee, agent or representative of Bear Stearns. Accordingly, this person has no power or authority to represent, make any recommendation, solicitation, offer or statements or disclose information on behalf of or in any way bind Bear Stearns or any of its affiliates. **
Dealing with links/buttons to fire off an action? confusion on how to set this up
I was wondering how to d something that I would think would be a common situation, yet I'm not finding any examples at the moment... scenario:... list of employees. You want to be able to click on one of the employees and go to an editEmployee backing bean method that would retrieve the employee based on the id of the employee in the list. I'm used to doing this with a simple link John Doe a href="" /setUpForEdit?employeeID=4355Edit/a With JSF I'm not so sure about how to do this. My JSF book mentions briefly about passing in f:param in commandLink but doesn't show how to retrieve this param. As a side note I find this very interesting, I was testing by using a DataTable and providing a commandLink next to each employee for each row... h:commandLink value=Edit action=""> f:param name=empID value=#{emp.id}/ /h:commandLink One of the odd/interesting things is that when I cycle through and print out the Request parameters I noticed that I'm getting a single parameter (assuming a map) that actually has the Employee info that I'm concerned with (2nd one): 8/26/05 02:28:55 PM DEBUG net.reumann.Employee editAction - param = [EMAIL PROTECTED] 08/26/05 02:28:55 PM DEBUG net.reumann.Employee editAction - param = id: 3, name: Rachel, age: 26 08/26/05 02:28:55 PM DEBUG net.reumann.Employee editAction - param = /employees.jsp That second enry *does* correspond to the button I clicked but not sure how I'm supposed to get a handle to the id (actually I'm not even sure how the heck that got into the request based on the commandLink I set up)? Also the f:param empID is *not* seen as a request parameter when I loop over them. What is the typical procedure for providing a link or button to click on that isn't part of a form but should fire off an action method that will look up something based on parameter(s) ?
RE: Dealing with links/buttons to fire off an action? confusion on how to set this up
You can pass the parameter as you have done and get the value of the parameter as follows FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get(empID); From: Rick Reumann [mailto:[EMAIL PROTECTED] Sent: Friday, August 26, 2005 2:49 PM To: MyFaces Discussion Subject: Dealing with links/buttons to fire off an action? confusion on how to set this up I was wondering how to d something that I would think would be a common situation, yet I'm not finding any examples at the moment... scenario:... list of employees. You want to be able to click on one of the employees and go to an editEmployee backing bean method that would retrieve the employee based on the id of the employee in the list. I'm used to doing this with a simple link John Doe a href="" /setUpForEdit?employeeID=4355Edit/a With JSF I'm not so sure about how to do this. My JSF book mentions briefly about passing in f:param in commandLink but doesn't show how to retrieve this param. As a side note I find this very interesting, I was testing by using a DataTable and providing a commandLink next to each employee for each row... h:commandLink value=Edit action=""> f:param name=empID value=#{emp.id}/ /h:commandLink One of the odd/interesting things is that when I cycle through and print out the Request parameters I noticed that I'm getting a single parameter (assuming a map) that actually has the Employee info that I'm concerned with (2nd one): 8/26/05 02:28:55 PM DEBUG net.reumann.Employee editAction - param = [EMAIL PROTECTED] 08/26/05 02:28:55 PM DEBUG net.reumann.Employee editAction - param = id: 3, name: Rachel, age: 26 08/26/05 02:28:55 PM DEBUG net.reumann.Employee editAction - param = /employees.jsp That second enry *does* correspond to the button I clicked but not sure how I'm supposed to get a handle to the id (actually I'm not even sure how the heck that got into the request based on the commandLink I set up)? Also the f:param empID is *not* seen as a request parameter when I loop over them. What is the typical procedure for providing a link or button to click on that isn't part of a form but should fire off an action method that will look up something based on parameter(s) ? ** Please be aware that, notwithstanding the fact that the person sending this communication has an address in Bear Stearns' e-mail system, this person is not an employee, agent or representative of Bear Stearns. Accordingly, this person has no power or authority to represent, make any recommendation, solicitation, offer or statements or disclose information on behalf of or in any way bind Bear Stearns or any of its affiliates. **
Fwd: Tree2
Please direct all MyFaces correspondence to the user list. This way everyone can benefit from the answers to your questions. sean -- Forwarded message -- From: Patel, Hitesh (Exchange) [EMAIL PROTECTED] Date: Aug 26, 2005 2:17 PM Subject: Tree2 To: [EMAIL PROTECTED] Hi Sean, I am using the tree2 in Myfaces and my requirement is to get the data from the database and build the tree nodes every time a node is expanded. If an expanded node is collapsed I want to remove the nodes under this node from the tree and add the nodes afresh by getting the data from the database when that node is expanded again. I am facing the problem that even if I remove the child nodes of the node that I collapse, when I add the nodes again when I expand that node it seems to remember the state of the child nodes before I collapsed the parent node and removed these child nodes. So if I had a child node which was expanded before I removed it, the next time I expand the parent node and add these child nodes and I click on this child node that was expanded it will not expand on the first click as it was expanded when I removed this node. On the second click It expands. I believe it is collapsing the state on the first click and on the second click it is then expanding. How do I remove the state of the child nodes that I remove from the tree. I use….. List children = node.getChildren(); Children.removeAll(children); …. to remove the nodes. Is there another better way to remove the nodes or am I doing it correctly. IF this is correct then how do I remove the states of the nodes the tree maintains. Your help is much appreciated. Thank you, Hitesh ** Please be aware that, notwithstanding the fact that the person sending this communication has an address in Bear Stearns' e-mail system, this person is not an employee, agent or representative of Bear Stearns. Accordingly, this person has no power or authority to represent, make any recommendation, solicitation, offer or statements or disclose information on behalf of or in any way bind Bear Stearns or any of its affiliates. **
Re: Dealing with links/buttons to fire off an action? confusion on how to set this up
You can also use dataTable.getRowData(), provided your model data is consistent, and then you don't need to create or pass a parameter. public void editRecord(ActionEvent event) { dataStore.editRecord(dataTable.getRowData()); } On 8/26/05, Patel, Hitesh (Exchange) [EMAIL PROTECTED] wrote: You can pass the parameter as you have done and get the value of the parameter as follows FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get(empID); From: Rick Reumann [mailto:[EMAIL PROTECTED] Sent: Friday, August 26, 2005 2:49 PM To: MyFaces Discussion Subject: Dealing with links/buttons to fire off an action? confusion on how to set this up I was wondering how to d something that I would think would be a common situation, yet I'm not finding any examples at the moment... scenario:... list of employees. You want to be able to click on one of the employees and go to an editEmployee backing bean method that would retrieve the employee based on the id of the employee in the list. I'm used to doing this with a simple link John Doe a href=/myApp /setUpForEdit?employeeID=4355Edit/a With JSF I'm not so sure about how to do this. My JSF book mentions briefly about passing in f:param in commandLink but doesn't show how to retrieve this param. As a side note I find this very interesting, I was testing by using a DataTable and providing a commandLink next to each employee for each row... h:commandLink value=Edit action=#{employee.editAction} f:param name=empID value=#{emp.id}/ /h:commandLink One of the odd/interesting things is that when I cycle through and print out the Request parameters I noticed that I'm getting a single parameter (assuming a map) that actually has the Employee info that I'm concerned with (2nd one): 8/26/05 02:28:55 PM DEBUG net.reumann.Employee editAction - param = [EMAIL PROTECTED] 08/26/05 02:28:55 PM DEBUG net.reumann.Employee editAction - param = id: 3, name: Rachel, age: 26 08/26/05 02:28:55 PM DEBUG net.reumann.Employee editAction - param = /employees.jsp That second enry *does* correspond to the button I clicked but not sure how I'm supposed to get a handle to the id (actually I'm not even sure how the heck that got into the request based on the commandLink I set up)? Also the f:param empID is *not* seen as a request parameter when I loop over them. What is the typical procedure for providing a link or button to click on that isn't part of a form but should fire off an action method that will look up something based on parameter(s) ? ** Please be aware that, notwithstanding the fact that the person sending this communication has an address in Bear Stearns' e-mail system, this person is not an employee, agent or representative of Bear Stearns. Accordingly, this person has no power or authority to represent, make any recommendation, solicitation, offer or statements or disclose information on behalf of or in any way bind Bear Stearns or any of its affiliates. **
Re: Dealing with links/buttons to fire off an action? confusion on how to set this up
Do you know of any way to do this if the underlying DataModel is in a property of a request scoped bean and the you couldn't use preserveDataModel=true, t:saveState, or any other things beyond the spec itself ? I am in such a situation and the only solution I see at this time is using f:param in the JSP and server side manual request parsing. Original message Date: Fri, 26 Aug 2005 15:19:17 -0400 From: Mike Kienenberger [EMAIL PROTECTED] Subject: Re: Dealing with links/buttons to fire off an action? confusion on how to set this up To: MyFaces Discussion users@myfaces.apache.org You can also use dataTable.getRowData(), provided your model data is consistent, and then you don't need to create or pass a parameter. public void editRecord(ActionEvent event) { dataStore.editRecord(dataTable.getRowData()); } On 8/26/05, Patel, Hitesh (Exchange) [EMAIL PROTECTED] wrote: You can pass the parameter as you have done and get the value of the parameter as follows FacesContext.getCurrentInstance().getExternalContext ().getRequestParameterMap().get(empID); From: Rick Reumann [mailto:[EMAIL PROTECTED] Sent: Friday, August 26, 2005 2:49 PM To: MyFaces Discussion Subject: Dealing with links/buttons to fire off an action? confusion on how to set this up I was wondering how to d something that I would think would be a common situation, yet I'm not finding any examples at the moment... scenario:... list of employees. You want to be able to click on one of the employees and go to an editEmployee backing bean method that would retrieve the employee based on the id of the employee in the list. I'm used to doing this with a simple link John Doe a href=/myApp /setUpForEdit?employeeID=4355Edit/a With JSF I'm not so sure about how to do this. My JSF book mentions briefly about passing in f:param in commandLink but doesn't show how to retrieve this param. As a side note I find this very interesting, I was testing by using a DataTable and providing a commandLink next to each employee for each row... h:commandLink value=Edit action=# {employee.editAction} f:param name=empID value=#{emp.id}/ /h:commandLink One of the odd/interesting things is that when I cycle through and print out the Request parameters I noticed that I'm getting a single parameter (assuming a map) that actually has the Employee info that I'm concerned with (2nd one): 8/26/05 02:28:55 PM DEBUG net.reumann.Employee editAction - param = [EMAIL PROTECTED] 08/26/05 02:28:55 PM DEBUG net.reumann.Employee editAction - param = id: 3, name: Rachel, age: 26 08/26/05 02:28:55 PM DEBUG net.reumann.Employee editAction - param = /employees.jsp That second enry *does* correspond to the button I clicked but not sure how I'm supposed to get a handle to the id (actually I'm not even sure how the heck that got into the request based on the commandLink I set up)? Also the f:param empID is *not* seen as a request parameter when I loop over them. What is the typical procedure for providing a link or button to click on that isn't part of a form but should fire off an action method that will look up something based on parameter(s) ? ** Please be aware that, notwithstanding the fact that the person sending this communication has an address in Bear Stearns' e-mail system, this person is not an employee, agent or representative of Bear Stearns. Accordingly, this person has no power or authority to represent, make any recommendation, solicitation, offer or statements or disclose information on behalf of or in any way bind Bear Stearns or any of its affiliates. ** Dennis Byrne
Re: Dealing with links/buttons to fire off an action? confusion on how to set this up
Nothing comes to mind, but allowing the end-user to specify the target record by key (generally a database primary key) may cause security issues. You'll have to validate the suitability of key provided when used. On 8/26/05, Dennis Byrne [EMAIL PROTECTED] wrote: Do you know of any way to do this if the underlying DataModel is in a property of a request scoped bean and the you couldn't use preserveDataModel=true, t:saveState, or any other things beyond the spec itself ? I am in such a situation and the only solution I see at this time is using f:param in the JSP and server side manual request parsing. Original message Date: Fri, 26 Aug 2005 15:19:17 -0400 From: Mike Kienenberger [EMAIL PROTECTED] Subject: Re: Dealing with links/buttons to fire off an action? confusion on how to set this up To: MyFaces Discussion users@myfaces.apache.org You can also use dataTable.getRowData(), provided your model data is consistent, and then you don't need to create or pass a parameter. public void editRecord(ActionEvent event) { dataStore.editRecord(dataTable.getRowData()); } On 8/26/05, Patel, Hitesh (Exchange) [EMAIL PROTECTED] wrote: You can pass the parameter as you have done and get the value of the parameter as follows FacesContext.getCurrentInstance().getExternalContext ().getRequestParameterMap().get(empID); From: Rick Reumann [mailto:[EMAIL PROTECTED] Sent: Friday, August 26, 2005 2:49 PM To: MyFaces Discussion Subject: Dealing with links/buttons to fire off an action? confusion on how to set this up I was wondering how to d something that I would think would be a common situation, yet I'm not finding any examples at the moment... scenario:... list of employees. You want to be able to click on one of the employees and go to an editEmployee backing bean method that would retrieve the employee based on the id of the employee in the list. I'm used to doing this with a simple link John Doe a href=/myApp /setUpForEdit?employeeID=4355Edit/a With JSF I'm not so sure about how to do this. My JSF book mentions briefly about passing in f:param in commandLink but doesn't show how to retrieve this param. As a side note I find this very interesting, I was testing by using a DataTable and providing a commandLink next to each employee for each row... h:commandLink value=Edit action=# {employee.editAction} f:param name=empID value=#{emp.id}/ /h:commandLink One of the odd/interesting things is that when I cycle through and print out the Request parameters I noticed that I'm getting a single parameter (assuming a map) that actually has the Employee info that I'm concerned with (2nd one): 8/26/05 02:28:55 PM DEBUG net.reumann.Employee editAction - param = [EMAIL PROTECTED] 08/26/05 02:28:55 PM DEBUG net.reumann.Employee editAction - param = id: 3, name: Rachel, age: 26 08/26/05 02:28:55 PM DEBUG net.reumann.Employee editAction - param = /employees.jsp That second enry *does* correspond to the button I clicked but not sure how I'm supposed to get a handle to the id (actually I'm not even sure how the heck that got into the request based on the commandLink I set up)? Also the f:param empID is *not* seen as a request parameter when I loop over them. What is the typical procedure for providing a link or button to click on that isn't part of a form but should fire off an action method that will look up something based on parameter(s) ? ** Please be aware that, notwithstanding the fact that the person sending this communication has an address in Bear Stearns' e-mail system, this person is not an employee, agent or representative of Bear Stearns. Accordingly, this person has no power or authority to represent, make any recommendation, solicitation, offer or statements or disclose information on behalf of or in any way bind Bear Stearns or any of its affiliates. ** Dennis Byrne
Re: Dealing with links/buttons to fire off an action? confusion on how to set this up
I found a way to address the security issues when the navigation path is to and from the same JSP . I use a converter where getAsString encrypts and encodes the id on the way out, getAsObject decodes and decrypts the string coming in. This however can't be used when navigating from one view to the next. If anyone has ideas on the first problem, do not be shy. Original message Date: Fri, 26 Aug 2005 15:31:52 -0400 From: Mike Kienenberger [EMAIL PROTECTED] Subject: Re: Dealing with links/buttons to fire off an action? confusion on how to set this up To: MyFaces Discussion users@myfaces.apache.org Nothing comes to mind, but allowing the end-user to specify the target record by key (generally a database primary key) may cause security issues. You'll have to validate the suitability of key provided when used. On 8/26/05, Dennis Byrne [EMAIL PROTECTED] wrote: Do you know of any way to do this if the underlying DataModel is in a property of a request scoped bean and the you couldn't use preserveDataModel=true, t:saveState, or any other things beyond the spec itself ? I am in such a situation and the only solution I see at this time is using f:param in the JSP and server side manual request parsing. Original message Date: Fri, 26 Aug 2005 15:19:17 -0400 From: Mike Kienenberger [EMAIL PROTECTED] Subject: Re: Dealing with links/buttons to fire off an action? confusion on how to set this up To: MyFaces Discussion users@myfaces.apache.org You can also use dataTable.getRowData(), provided your model data is consistent, and then you don't need to create or pass a parameter. public void editRecord(ActionEvent event) { dataStore.editRecord(dataTable.getRowData()); } On 8/26/05, Patel, Hitesh (Exchange) [EMAIL PROTECTED] wrote: You can pass the parameter as you have done and get the value of the parameter as follows FacesContext.getCurrentInstance().getExternalContext ().getRequestParameterMap().get(empID); From: Rick Reumann [mailto:[EMAIL PROTECTED] Sent: Friday, August 26, 2005 2:49 PM To: MyFaces Discussion Subject: Dealing with links/buttons to fire off an action? confusion on how to set this up I was wondering how to d something that I would think would be a common situation, yet I'm not finding any examples at the moment... scenario:... list of employees. You want to be able to click on one of the employees and go to an editEmployee backing bean method that would retrieve the employee based on the id of the employee in the list. I'm used to doing this with a simple link John Doe a href=/myApp /setUpForEdit?employeeID=4355Edit/a With JSF I'm not so sure about how to do this. My JSF book mentions briefly about passing in f:param in commandLink but doesn't show how to retrieve this param. As a side note I find this very interesting, I was testing by using a DataTable and providing a commandLink next to each employee for each row... h:commandLink value=Edit action=# {employee.editAction} f:param name=empID value=#{emp.id}/ /h:commandLink One of the odd/interesting things is that when I cycle through and print out the Request parameters I noticed that I'm getting a single parameter (assuming a map) that actually has the Employee info that I'm concerned with (2nd one): 8/26/05 02:28:55 PM DEBUG net.reumann.Employee editAction - param = [EMAIL PROTECTED] 08/26/05 02:28:55 PM DEBUG net.reumann.Employee editAction - param = id: 3, name: Rachel, age: 26 08/26/05 02:28:55 PM DEBUG net.reumann.Employee editAction - param = /employees.jsp That second enry *does* correspond to the button I clicked but not sure how I'm supposed to get a handle to the id (actually I'm not even sure how the heck that got into the request based on the commandLink I set up)? Also the f:param empID is *not* seen as a request parameter when I loop over them. What is the typical procedure for providing a link or button to click on that isn't part of a form but should fire off an action method that will look up something based on parameter(s) ? ** Please be aware that, notwithstanding the fact that the person sending this communication has an address in Bear Stearns' e- mail system, this person is not an employee, agent or representative of Bear Stearns. Accordingly, this person has no power or authority to represent, make any recommendation, solicitation, offer or statements or disclose information on behalf of or in any way bind Bear Stearns or any of its affiliates. ** Dennis Byrne Dennis Byrne
MyFacesGenericPortlet
When I execute nonFacesRequest to go to a view without obeying navigation-rules the state of Navigation is not saved. So, after that, when I click the maximize or restore button of portlet the portlet goes back to the previous page. How can I change this navigation state?
Re: Dealing with links/buttons to fire off an action? confusion on how to set this up
On 8/26/05, Patel, Hitesh (Exchange) [EMAIL PROTECTED] wrote: You can pass the parameter as you have done and get the value of the parameter as follows FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get(empID); I would guess this common to have to use? I would think it would be, and find it a bit odd that there isn't a more convenient way to get the params. Granted I can probably make a helper method to do the above. I know that in many of my apps I have cases where you'll click on a link or button in order to get to a different populated screen based on an id or some other var(s). For example in one app there are a lot of page that on the top of the page it displays the user you are looking at and provides a few convenience buttons next to the name for viewing 'summary' 'user logs' etc - which are just links that execute actions and the appropriate information is pulled back based on some params passed through the link. -- Rick
Re: Dealing with links/buttons to fire off an action? confusion on how to set this up
On 8/26/05, Mike Kienenberger [EMAIL PROTECTED] wrote: You can also use dataTable.getRowData(), provided your model data isconsistent, and then you don't need to create or pass a parameter.public void editRecord(ActionEvent event){dataStore.editRecord (dataTable.getRowData());} Can you explain this a bit more? For example will it matter if another user ends up going to the same JSP and has a 'different' view of the dataTable while I'm working with it in the editRecord method above? I would think that it wouldnt' matter but just double checking. -- Rick
RE: Dealing with links/buttons to fire off an action? confusion on how to set this up
Title: Message There's a goodexample of getting row-specific events inthe O'Reilly book JavaServer Faces (Hans Bergsten), pp. 173 - 178. The example application throughout the book is to build an expense report application, and it makes use of the summary-detaillinks you refer to. However, I believe that, using this mechanism, there's no real way to get around usingsomething liket:saveState or having a session-scoped bean. Just out of curiosity, what is the objection to using t:saveState? - Brendan -Original Message-From: Rick Reumann [mailto:[EMAIL PROTECTED] Sent: Friday, August 26, 2005 2:59 PMTo: MyFaces DiscussionSubject: Re: Dealing with links/buttons to fire off an action? confusion on how to set this up On 8/26/05, Mike Kienenberger [EMAIL PROTECTED] wrote: You can also use dataTable.getRowData(), provided your model data isconsistent, and then you don't need to create or pass a parameter.public void editRecord(ActionEvent event){dataStore.editRecord (dataTable.getRowData());} Can you explain this a bit more? For example will it matter if another user ends up going to the same JSP and has a 'different' view of the dataTable while I'm working with it in the editRecord method above? I would think that it wouldnt' matter but just double checking.-- Rick
Re: Dealing with links/buttons to fire off an action? confusion on how to set this up
Not as long as the data model is contained in your component tree or session rather than in some global location. On 8/26/05, Rick Reumann [EMAIL PROTECTED] wrote: On 8/26/05, Mike Kienenberger [EMAIL PROTECTED] wrote: You can also use dataTable.getRowData(), provided your model data is consistent, and then you don't need to create or pass a parameter. public void editRecord(ActionEvent event) { dataStore.editRecord (dataTable.getRowData()); } Can you explain this a bit more? For example will it matter if another user ends up going to the same JSP and has a 'different' view of the dataTable while I'm working with it in the editRecord method above? I would think that it wouldnt' matter but just double checking. -- Rick
Re: Dealing with links/buttons to fire off an action? confusion on how to set this up
I'm a fan of the Struts ActionForm. If you wanted to populate an object with query parameters, you might think about creating a managed bean and use the setter injection stuff. managed-bean managed-bean-nameformBean/managed-bean-name managed-bean-classxxx.FormBean/managed-bean-class managed-bean-scoperequest/managed-bean-scope managed-property property-nameusername/property-name value#{param.username}/value /managed-property /managed-bean You could use a helper method to get to the formBean. Struts Shale ViewController would be a perfect fit for this pattern. It has a helper method called getBean(); public void prerender() { FormBean queryParams = (FormBean) getBean(formBean); String userName = queryParams.getUserName(); } Gary ---BeginMessage--- On 8/26/05, Patel, Hitesh (Exchange) [EMAIL PROTECTED] wrote: You can pass the parameter as you have done and get the value of the parameter as follows FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get(empID); I would guess this common to have to use? I would think it would be, and find it a bit odd that there isn't a more convenient way to get the params. Granted I can probably make a helper method to do the above. I know that in many of my apps I have cases where you'll click on a link or button in order to get to a different populated screen based on an id or some other var(s). For example in one app there are a lot of page that on the top of the page it displays the user you are looking at and provides a few convenience buttons next to the name for viewing 'summary' 'user logs' etc - which are just links that execute actions and the appropriate information is pulled back based on some params passed through the link. -- Rick ---End Message---
Re: Experience with developing web app. based on MyFaces
On 8/26/05, Enrique Medina [EMAIL PROTECTED] wrote: It would be great if you could copy all this to the Wiki ;-) http://wiki.apache.org/myfaces/ I'll take a look at it. Yes, some issues have been already resolved - a few minutes after sending this mail I've come across saveState component that works *exactly* the same way as our component :-) 2005/8/26, mirek novak [EMAIL PROTECTED]: Hi, I've been working on an application based on MyFaces 1.0.8. Now, we are moving to MyFaces 1.0.9 and I would like to discuss discovered issues and some ideas (not only related to MyFaces but to JSF in general). AliasBean * This is a pretty useful component and I'm glad that MyFaces contains it! * There were a few bugs in this component in MyFaces 1.0.8 (processSaveState, queueEvent) but now they are fixed (1.0.9) - great Table * This is one of the most used components * It's definitely better than standard table (sorting support, scroller, …) BUT: * Suppose this (selecting a row while model has been concurrently modified by a different user): 1) Your table has 3 rows and you display a check box for each row so that user can select a row 2) User selects first row and submits but another user has concurrently deleted first row. So, model has now only 2 rows. 3) Submitted value (selected checkbox of the first row) will be applied to the first row of the model. So, actually the second row is selected :-(. (we've developed a quite simple solution, so if you are interested, let me know - and we definitely do not serialize whole model of the table!) * It's a common case that table rows have checkboxes and can be selected. So, we have to provide (for most of the tables) model where each row is wrapped in an extra class that has selected property - and that's tedious. DataScroller = * We've discovered following issue: uiData.setFirst(someNewValue) is used within the =decode= method of the HtmlDataScrollerRenderer - it is too early to modify uiData within =apply request values phase=. * If some rows of the table were modified too, they will be applied to wrong table rows :-( (because setFirst has already been called and table contains different rows now) * Our solution: DataScrollerRenderer fires an even that uiData should be updated, and they are updated later in =update model values= phase (just after model has been updated) Backing Bean's State, HttpSession, Concurrent Access within a Session === In my view, a reasonable web application should fulfill following requirements: * users can use browser's navigation buttons (back, forward, reload) * users can use an application from multiple browser tabs (tabs share the same session) Although these requirements look simple and unimportant, they present serious problems and have serious consequences on the whole architecture of an application. * navigation buttons * We use redirects. So, user can use the back button even when he's moved to a next page via HTTP POST * We use javax.faces.STATE_SAVING_METHOD=client. So, even if user has pressed the back button 10 times, a proper view will be restored when he submits form (or clicks link) on the old page (if state saving=server, this would obviously not work - you would have to click twice to perform an action :-)). * But who/when/how will store state of backing beans? - note that if you not store the state of your backing beans on a client, your application will not work. Suppose this: 1) Your page displays a category (it has name, description and sub-categories) 2) User selected category A and it is stored in a property =currentCategory= in your backing bean 3) User selected category B (sub-category of A), so =currentCategory= is now B 4) User uses browser's back button, so he can see detail of category A 5) User edits description of the category (A) and submits the page 6) Description of category B will be updated because =currentCategory= is still B :-( * Solution: a component (saveState) that accepts a value binding and saves the value within its state. E.g. y:saveState value=#{myConroller.pageState}/ * tabbed browsing * Any session scope backing bean is a potential race-condition * Moreover, if your data like currentItem, MyPageConroller have session scope, actions performed in one tab may influence behavior of the other tab Error Handling === * We created a special component similar to the Buffer component. We render a sub-tree of this component into the buffer and if and exception is thrown while processing the sub-tree, we render
Re: Dealing with links/buttons to fire off an action? confusion on how to set this up
On 8/26/05, CONNER, BRENDAN (SBCSI) [EMAIL PROTECTED] wrote: However, I believe that, using this mechanism, there's no real way to get around usingsomething liket:saveState or having a session-scoped bean. Just out of curiosity, what is the objection to using t:saveState? Well I haven't gotten that far in my learning to have touched upon t:saveState. Was actually just more curious in general of how you deal with cases where you would typically want to use requestParams attached to a url link. -- Rick
RE: Dealing with links/buttons to fire off an action? confusion on how to set this up
Title: Message t:saveState is trivially simple to use, but it's a Godsend. Wherever you want the state of a bean to be maintained across requests, just declare the bean with request scope andput a t:saveSave value="#{myBean}" on the pages that use it. The bean's state will be maintained until control reaches a page that doesn't have a t:saveState declared for it, at which point it will go away automatically. So wherever you need to maintain the state of a bean for more than one request (but don't need it for the entire session), stick in a t:saveState tag for all pages that use it, and you're set. If you do this, and you follow Mike Kienenberger's suggestion to access the DataModel object that backs the dataTable component(illustrated in the O'Reilly book JavaServer Faces, pp. 175 - 179), you're all set; you don't need to pass any parameters through the request. Using the DataModel object also is explained in the book CoreJavaServer Faces (Geary, Horstmann), pp. 185 - 201. - Brendan -Original Message-From: Rick Reumann [mailto:[EMAIL PROTECTED] Sent: Friday, August 26, 2005 4:41 PMTo: MyFaces DiscussionSubject: Re: Dealing with links/buttons to fire off an action? confusion on how to set this up On 8/26/05, CONNER, BRENDAN (SBCSI) [EMAIL PROTECTED] wrote: However, I believe that, using this mechanism, there's no real way to get around usingsomething liket:saveState or having a session-scoped bean. Just out of curiosity, what is the objection to using t:saveState? Well I haven't gotten that far in my learning to have touched upon t:saveState. Was actually just more curious in general of how you deal with cases where you would typically want to use requestParams attached to a url link. -- Rick
Re: WebXml.init must be called before!
Nevermind, I figured out what's going on as soon as I hit the send button to send the email. But, hey, thanks anyway. 8-} david Le 05-08-26 à 17:49, David Geary a écrit : I'm trying to move an application from the RI to MyFaces. I've got the StartupServletContextListener specified in web.xml, but when I try to access the application, I get the following unpleasantness: javax.servlet.ServletException: org.apache.myfaces.webapp.webxml.WebXml.init must be called before! javax.faces.webapp.FacesServlet.service(FacesServlet.java:125) org.apache.shale.faces.ShaleApplicationFilter.doFilter (ShaleApplicationFilter.java:280) I have no idea what that message means (before *what*!?!) or what to do about it. Can anybody help me out? Thanks, david
WebXml.init must be called before!
I'm trying to move an application from the RI to MyFaces. I've got the StartupServletContextListener specified in web.xml, but when I try to access the application, I get the following unpleasantness: javax.servlet.ServletException: org.apache.myfaces.webapp.webxml.WebXml.init must be called before! javax.faces.webapp.FacesServlet.service(FacesServlet.java:125) org.apache.shale.faces.ShaleApplicationFilter.doFilter (ShaleApplicationFilter.java:280) I have no idea what that message means (before *what*!?!) or what to do about it. Can anybody help me out? Thanks, david