Re: Converter error during Model update
On 3/18/06, _dani [EMAIL PROTECTED] wrote: The selectOneListbox and the inputText component are in the same form on the same jsp. So i dont now how to control which component is first on my page. The tags are processed in order of appearance, so if the listbox is first, it'll be processed (at each phase) first. So the problem is located in step 3, validating the inputText component. Step 1 is ok, I checked what happens in the userConverter and that looks good. There is also no problem during the validation of the selectOneListbox. But now during the validation of the inputText component in steo 3 selectedUserBean.selectedUser is still null. I think because the model wasn't updated yet, the method processUpdates was not called so far. Yes, that was what I was thinking at first, too, but since you're still in processValidations, the inputText isn't referencing selectedUserBean.selectedUser yet. It's still working with the component value directly. So if I'm right, that tells me that I can't select an edit a user on the same page. I need to separate the selection of an user in a first page and the modification of the user fields in a second page. But I don't like this idea. The only reason I could see this happening is if the inputText appears before the selectOneListbox on the page.
Re: Is ther a way? Life cycle for commandButton
What about callling this.setFlag(true) as the first line of code in #{bean.check}? If it's a matter of having both true and false, create checkTrue() and checkFalse() -- you can even have them both call check() after setting the flag value. On 3/17/06, Dave [EMAIL PROTECTED] wrote: h:form h:commandButton value=Check action=#{bean.check} immediate=true t:updateActionListener property=#{bean.flag} value=false / /h:commandButton /h:form What I need is: set a flag(boolean) before Model update phase, then go to Model update phase, then go to Invoke Applicate phase, call the action method. However, set immediate=true, both Action listener and action method are executed in ApplyRequestValue phase, and Model update is skipped. If immediate= false, normal life cycle. Action listener and action method are executed in InvokeApplication phase. Both ways are not what I need. Using param under commandButton will solve the problem. Model update setter methods can check the param value. But this can be a security issue because client can pass a parameter in URL to collapse the server side. Any other solutions? Thanks for ideas. Yahoo! Mail Use Photomail to share photos without annoying attachments.
Re: myfaces source including sandbox
Currently you have to build the sandbox from source after doing a checkout. Go ahead and open a jira issue on this (making sandbox available as part of the nightlies). On 3/18/06, Dave [EMAIL PROTECTED] wrote: http://svn.apache.org/repos/asf/myfaces/ http://cvs.apache.org/builds/myfaces/nightly/ I try to use subForm. I could not find sandbox in repos. In the nightly build area, there is no sandbox either. I like to download all myfaces source including sandbox. thanks for info. Yahoo! Mail Bring photos to life! New PhotoMail makes sharing a breeze.
Re: CommandButton subclass
Yes, this should be possible. I can't remember if the code that determines the phase is in the component (Probably UICommand) or in the renderer. It may be as simple as providing an alternate renderer. On 3/18/06, Dave [EMAIL PROTECTED] wrote: For commandButton, its action listener and action method are executed in Invoke Application phase. I need to create a custom component that is a subclass of commandButton, but execute action listeners and action method in two different phases: Action listeners in ApplyRequestValue phase, and Action method in Invoke Application phase, Is this possible? Some info on how to do this would be very helpful. Thanks! Brings words and photos together (easily) with PhotoMail - it's free and works with Yahoo! Mail.
Re: jsessionid added to resources in myfaces SVN current?
I recall having to fix this problem of an appended jsessionid for Tomahawk AddResource. I believe the working code we settled on was this: String pathInfo = request.getPathInfo(); String uri = request.getContextPath() + request.getServletPath() + (pathInfo == null ? : pathInfo); On 3/18/06, Andrew Robinson [EMAIL PROTECTED] wrote: I have been using the following code to get the right URL for an image that is being produced by my servlet: src = viewHandler.getResourceURL(facesContext, url); enc = (src == null) ? null : extCtx.encodeResourceURL(src); return enc; In past versions of myfaces this was working fine: /context/path/image.png Against the lastest SVN I am getting: /context/path/image.png;jsessionid=BLAH This is breaking my servlet as I am looking at the path to get the image to create. First of all ; isn't a valid query string separator, is it? Secondly, why is the session ID being added to my resources? I can understand action URLs, but not resources URLs. Is this a new bug?
Re: Fwd: panelTabbedPane serverSideTabSwitch
Raihan, Did you get an answer to your question? I'll probably be committing a serverSideTabSwitch patch to MyFaces today or tomorrow, and I can try to take a look at your tld issue if you haven't heard back from anyone else. -Mike On 3/19/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Dear Mike, Thanks a lot for your help. Sincerely, Raihan Kibria Sr. Software Engineer TechnoVista Limited Lotus Kamal Tower - One, Level - 9, 57 Zoar Shahara C/A, Nikunja - 2 (North) Dhaka - 1229, Bangladesh Phone: +880 2 895 2704-9 Email: [EMAIL PROTECTED] Mike Kienenberger [EMAIL PROTECTED] 02/23/2006 09:30 PM To MyFaces User mailing list users@myfaces.apache.org cc [EMAIL PROTECTED] [EMAIL PROTECTED] Subject Fwd: panelTabbedPane serverSideTabSwitch Forwarding to MyFaces users list. -- Forwarded message -- From: [EMAIL PROTECTED] [EMAIL PROTECTED] Date: Feb 23, 2006 1:27 AM Subject: panelTabbedPane serverSideTabSwitch To: [EMAIL PROTECTED] Hi Mike, When I use serverSideTabSwitch, i get exception that the attribute is invalid according to TLD. Could you please let me give some some tips. Thanks. Sincerely, Raihan Kibria Sr. Software Engineer TechnoVista Limited Lotus Kamal Tower - One, Level - 9, 57 Zoar Shahara C/A, Nikunja - 2 (North) Dhaka - 1229, Bangladesh Phone: +880 2 895 2704-9 Email: [EMAIL PROTECTED]
Re: CommandButton subclass
On 3/18/06, Dave [EMAIL PROTECTED] wrote: HtmlCommandButton is a subclass of UICommand. Should I subclass HtmlCommandButton and override queueEvent(), like Yes, I think that should work. Give it a try and see. I am new to creating custom components. How to set it up so that I can use it in JSP? like tag, where to put the tag description, etc. For JSP, to create a new component, you would need to specify it in your faces-config.xml file and in a tld file. I'm not really very knowledgeable about JSP, though, as I use facelets instead. You could just copy what's in there for HtmlCommandButton. You might also be able to replace the component-type class for HtmlCommandButton directly in the faces-config file. Maybe you wouldn't need to create a new component definition if you're willing to use your new component everywhere you currently using an HtmlCommandButton. -Mike
Re: No variables in t:column header facets! Bug?
UIColumns is basically a UIData turned sideways So you have a data model for your rows, and then you have a second data model for each of your columns. crossDataTable.jsp in myfaces-example-simple gives an example of using it. Live online demo is here -- lets you add columns each submit. http://www.irian.at/myfaces/crossDataTable.jsf On 3/20/06, Andrew Robinson [EMAIL PROTECTED] wrote: I think it would be something like: UIData data = new UIData(); UIColumn col = new UIColumn(); data.getChildren().add(col); etc. You are basically building the component tree by hand. I think tomahawk has a columns item too (UIColumns) that may be less work. Has anyone else done this to provide more knowledge than me? Thanks, Andrew On 3/20/06, octoberdan [EMAIL PROTECTED] wrote: t:dataTable binding=#{bean.data} / where data is a property that returns an instance of javax.faces.component.UIData. Then you would just build this UIData component programatically in your backing bean. Looking over the classes methods there doesn't seem to be any able to add columns... Searching for posts and/or tutorials should help more. I tried looking for a relavent example but can't seem to find one... do you know of any by chance? -- View this message in context: http://www.nabble.com/No-variables-in-t%3Acolumn-header-facets%21-Bug--t1312124.html#a3499883 Sent from the MyFaces - Users forum at Nabble.com.
Re: solution to exception(bad error message here)
Perhaps you were referencing the bean using JSP notation instead of JSF notation? If that's the case, you'll only get errors from the container's JSP compiler. On 3/20/06, Dean Hiller [EMAIL PROTECTED] wrote: The solution to my earlier exception was I named the backing bean incorrectly. funny that I did not get bean not exist error(I think I remember getting one from JSF before). Anyways in this case I had a backing bean misnamed in faces-config.xml and I get the very uninformitive exception of.(there was nothing in the tomcat logs). javax.servlet.ServletException: org.apache.jasper.JasperException javax.faces.webapp.FacesServlet.service(FacesServlet.java:109) org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsFilter.java:122) *root cause* javax.faces.FacesException: org.apache.jasper.JasperException org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:425) org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:234) org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:300) javax.faces.webapp.FacesServlet.service(FacesServlet.java:95) org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsFilter.java:122)
Re: actionListener not invoked
My guess is that you are not persisting the value of #{back.enabled} between requests. In order for a UICommand to work, it must remain enabled (rendered=true) from the first request renderResponse phase to the next request's invokeApplication phase. Maybe all you need to do is use t:saveState on #{back.enabled}. On 3/21/06, Murat Hazer [EMAIL PROTECTED] wrote: A simple page has two links t:commandLink id=link1 actionListener=#{backer.edit} value=Edit rendered=#{back.enabled} / t:commandLink id=link2 actionListener=#{backer.enableEdit} value=Enable Edit / When the enable edit link is cliked 'enabled' property of the backing bean is changed to true so that the Edit link is rendered. The problem is that once the Edit link is rendered, it's method binding doesn't work. The edit method is never called when I click the link (or button). Why does this happen? -- Murat HAZER Elektrik-Elektronik Mühendisi - Electrical-Electronics Engineer Tel - Phone: +90 222 335 05 80 - 1395 Cep Tel - Mobile Phone: +90 532 472 00 63 Blog URL: http://www.projedunyasi.org Yahoo Group: http://groups.yahoo.com/group/malatyafenlisesi/
MyFaces example wanted for t:panelTabbedPane's selectedIndex, and/or TabChangeListener
I've noticed that a lot of posters have asked for help with t:panelTabbedPane's selectedIndex and TabChangeListener over the last few months. Would someone be willing to expand the sandbox example (or provide a new example) showing how to use these features of panelTabbedPane? It will enable new users to understand how to do this easier as well as allow us to more quickly debug issues reported against selectedIndex and TabChangeListener. Thanks!
Re: Do I need to set up .jspx extentions in my web.xml?
You are only allowed to have one suffix with the default JSF implementation. context-param param-namejavax.faces.DEFAULT_SUFFIX/param-name param-value.jsp/param-value /context-param or context-param param-namejavax.faces.DEFAULT_SUFFIX/param-name param-value.jspx/param-value /context-param You could create your own view handler that does this. Facelets delegates non-facelets file extensions back to the default viewhandler so that it can support both .xhtml and .jspx (for example). It'd seem like it'd be fairly simple to extend the default viewhandler functionality to try two suffixes instead of one. There's been interest (for this very reason) expressed by others in the last week for the same functionality. Search through the past week's myafces-users list for DEFAULT_SUFFIX to find the threads. On 3/21/06, James Reynolds [EMAIL PROTECTED] wrote: I'm in the process of converting my jsp files to jspx. I set up one test case and I was surprised by a 404 error. Do I need to add some configuration in my web.xml? In my faces-config I have: navigation-rule from-view-id/welcome.jsp/from-view-id navigation-case from-outcomego_template/from-outcome to-view-id/template.jspx/to-view-id /navigation-case /navigation-rule ***But the error I receive indicates that Tomcat is looking for a jsp extention:*** HTTP Status 404 - /template.jsp type Status report message /template.jsp description The requested resource (/template.jsp) is not available. Apache Tomcat/5.5.15
Re: MyFaces Tomahawk
Rick, Sorry. I can't help you. I've never used the JSF RI, nor do I use server-side state saving. You could either implement the special phase listener described in TOMAHAWK-134 or you could try asking on the JSF RI list why saveState/restoreState aren't called for server-side state saving. I'm cc'ing your message to the MyFaces User mailing list users@myfaces.apache.org as you're far more likely to get help there than emailing me directly. On 3/21/06, Rick Nendza [EMAIL PROTECTED] wrote: Hi Mike, I'm really sorry to bother you. Your probably not the right person but I've noticed activity on this JIRA but yet no patch to grab. I promise to start contributing in the future! Any help would be appreciated it as I'm at a desperate standstill! I'm a independent consultant for IBM (previous employed by IBM) helping them with development of a web requisition system. I'm really desperate for some sort of solution / patch for JIRA 134 ( https://issues.apache.org/jira/browse/TOMAHAWK-134) The client insists on using the Sun 1.1 RI with IBM extensions and allows Tomahawk extensions (using RAD 6.0.1 for development) They insist on using STATE_SAVING_METHOD set to the server. I need to maintain a backing bean that contains a complex object graph (all objects serializable) for which its data was not easy to get (many many db queries). I simply need to maintain this duing the reload of the page or trigger of an post that redisplays the page for that matter. I've looked at t:saveState and it apears that the SUN RI refuses to call saveState() / restoreState() on the UIComponent when using a server STATE_SAVING_METHOD. I've looked at ADF and client deems it too drastic to incorporate at this time. I've looked at flowState done by the boys at Berkley but wasn't unable to get that to work either because I'm simply not implementing it right or perhaps they were reliant on Client STATE_SAVING_METHOD with the SUN at the time it was development.. not sure. Thanks Man!
Re: How to contribute?
On 3/22/06, Aleksei Valikov [EMAIL PROTECTED] wrote: I've ported jenia4faces PopupBox onto MyFaces. The reason was to reuse MyFaces resource management, remove the need to configure jenia4faces servlet, allow static javascript configuration with JSFAttr.JAVASCRIPT_LOCATION and so on. How could I make a contribution? I'm only one member of the MyFaces PMC, but I'd be hesitant to accept such a donation. Jenai4Faces components are best supported by the Jenia4Faces project. I'd recommend instead that you provide Jenai4Faces with a patch so that their components can be configured to use tomahawk directly. Helping them support both a tomahawk-specific configuration in addition to a JSF-independent configuration for their components should be done in such a way as to make it work for all of their components, and will allow those who best understand the PopupBox component (the original authors) to continue maintaining it, while still allowing you to take advantage of Tomahawk resource management. If they are not interested in supporting a Tomahawk-specific configuration, then perhaps you could join the jsf-comp sourceforge project at http://sourceforge.net/projects/jsf-comp/ and provide your port of the component from there. Again, other MyFaces PMC members may feel differently about it. You might get more of a response for pure MyFaces Development issues by using the MyFaces dev list.
Re: actionListener not invoked
The confusion is probably caused by the fact that a UICommand component needs to have a rendered attribute that is page-scoped rather than request-scoped. The rendered attribute value needs to remain constant from the first request's RenderResponse phase until the next request's InvokeApplication phase. This is because each phase checks to insure that a component is rendered=true before executing for a particular component. If the rendered value is only true during the first request (for generating html representation), then during the second request, the component will not exist to generate action events. On 3/21/06, Dean Hiller [EMAIL PROTECTED] wrote: I am confused by the response. if back.enabled was false, he would not be able to click the commanLink, would he? It sounds like he was saying backer.edit was not working. Maybe my question is a stupid question from a newb(me), but could you explain that response more so I can understand. thanks, dean Mike Kienenberger wrote: My guess is that you are not persisting the value of #{back.enabled} between requests. In order for a UICommand to work, it must remain enabled (rendered=true) from the first request renderResponse phase to the next request's invokeApplication phase. Maybe all you need to do is use t:saveState on #{back.enabled}. On 3/21/06, Murat Hazer [EMAIL PROTECTED] wrote: A simple page has two links t:commandLink id=link1 actionListener=#{backer.edit} value=Edit rendered=#{back.enabled} / t:commandLink id=link2 actionListener=#{backer.enableEdit} value=Enable Edit / When the enable edit link is cliked 'enabled' property of the backing bean is changed to true so that the Edit link is rendered. The problem is that once the Edit link is rendered, it's method binding doesn't work. The edit method is never called when I click the link (or button). Why does this happen? -- Murat HAZER Elektrik-Elektronik Mühendisi - Electrical-Electronics Engineer Tel - Phone: +90 222 335 05 80 - 1395 Cep Tel - Mobile Phone: +90 532 472 00 63 Blog URL: http://www.projedunyasi.org Yahoo Group: http://groups.yahoo.com/group/malatyafenlisesi/
Re: solution to exception(bad error message here)
On 3/21/06, Dean Hiller [EMAIL PROTECTED] wrote: I don't know jsp notation actually, and actually below I was trying to say The solution was I named the backing bean incorrectly not that I was using jsp notation. Sorry as I am sometimes not good at being clear about this. I was just posting the solution in case someone else ran into it. I believe the jsp notation is anything involving % % and ${}. Jsf notation is #{}. jsp notation would be handled by the JSP compiler, which could result in obscure error messages.
Re: What is the correct jspx Doctype Declaration?
I have successfully used this in the past before switching to facelets: ?xml version='1.0' encoding='windows-1252'? jsp:root xmlns:jsp=http://java.sun.com/JSP/Page; version=1.2 xmlns:h=http://java.sun.com/jsf/html; xmlns:f=http://java.sun.com/jsf/core; jsp:text ![CDATA[ ?xml version=1.0 encoding=windows-1252 ? ]] /jsp:text jsp:text ![CDATA[ !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; ]] /jsp:text jsp:directive.page contentType=text/html;charset=windows-1252 errorPage=ErrorHandlingPage.jspx/ On 3/22/06, James Reynolds [EMAIL PROTECTED] wrote: I'm in the process of converting my jsp files to jspx. If I don't include a DocType declaration, I get an error like: *The XML page cannot be displayed *Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or *try again later. * *--- - * *A string literal was not closed. Error processing resource 'http://localhost:8080/myNPP/'. Line 12, Position *354 * *//--/script/formdiv class=shortyContenth1Test Content/h1/divform i... I added this doctype to my page: *jsp:output *![CDATA[!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN *http://www.w3c.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;]] */jsp:output But then I get a different error (listed below) from the index page that forwards to my first jsf page. Am I just using the wrong doctype, or am I missing a key requirement for jspx? Thanks HTTP Status 500 - type Exception report message description The server encountered an internal error () that prevented it from fulfilling this request. exception org.apache.jasper.JasperException: Exception in JSP: /index.jspx:9 6: To change this template use File | Settings | File Templates. 7: -- 8: jsp:root xmlns:jsp=http://java.sun.com/JSP/Page; xmlns=http://www.w3.org/1999/xhtml; version=2.0 9: jsp:forward page=/template.jsf/ 10: /jsp:root Stacktrace: org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServle tWrapper.java:504) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.ja va:375) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) org.apache.shale.faces.ShaleApplicationFilter.doFilter(ShaleApplicationF ilter.java:285) root cause javax.servlet.ServletException: /template.jspx(15,17) lt;jsp:outputgt; must not have a body javax.faces.webapp.FacesServlet.service(FacesServlet.java:121) org.apache.shale.faces.ShaleApplicationFilter.doFilter(ShaleApplicationF ilter.java:285) org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java :703) org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:6 70) org.apache.jsp.index_jspx._jspService(org.apache.jsp.index_jspx:43) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.ja va:332) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) org.apache.shale.faces.ShaleApplicationFilter.doFilter(ShaleApplicationF ilter.java:285) root cause javax.faces.FacesException: /template.jspx(15,17) lt;jsp:outputgt; must not have a body org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(S ervletExternalContextImpl.java:421) org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspView HandlerImpl.java:234) org.apache.shale.clay.faces.ClayViewHandler.renderView(ClayViewHandler.j ava:384) org.apache.shale.view.faces.ViewViewHandler.renderView(ViewViewHandler.j ava:146) org.apache.shale.tiles.TilesViewHandler.renderView(TilesViewHandler.java :175) org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:352 ) javax.faces.webapp.FacesServlet.service(FacesServlet.java:107) org.apache.shale.faces.ShaleApplicationFilter.doFilter(ShaleApplicationF ilter.java:285) org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java :703) org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:6 70) org.apache.jsp.index_jspx._jspService(org.apache.jsp.index_jspx:43) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97) javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
Re: saveState question
On 3/23/06, [EMAIL PROTECTED] But I can use jsf session beans as it, because on our project we are using JBoss 4.0.3 in cluster and for all JSF UI components I will get NonSerializable exception. Also I can not use one manage bean on two pages, because I have actually wizard application with 4-5 pages. You're not really using the same bean.You're using an request-scoped bean with identical data/state on each page. t:saveState merely initializes the new request-scoped bean with the same data as the last request-scoped bean.Same data, different bean.
Re: inputText and null processing
On 3/23/06, Serge Bogatyrjov [EMAIL PROTECTED] wrote: I have a form and some inputs on it. I marked one input as required. Then I expected to get a error message when posting an empty form. By I did not get any messages. It should be as simple as adding required=true as an attribute for your component. As you have noticed, this is the only validation potentially checked for an empty input component.
Re: Update ManageBean from different pages.
On 3/23/06, Hagay Avisar [EMAIL PROTECTED] wrote: Does t:saveState requires submitting the page? Cause I can see that the data I have insert in input text in tab1 does not update the value in my Bean…. Yes. t:saveState is a server-side process, not a javascript trick. On 3/23/06, Hagay Avisar [EMAIL PROTECTED] wrote: How can we do submit and navigation in same time? UICommand action=#{myBean.myAction} In myBean.myAction, do your submit logic. Then return a String that indicates what page to navigate to next (or null to stay on the same page). How can I update bean from couple of pages when I am navigating from one page to the other? Use a request-scoped bean and use t:saveState to recreate it each page. Or use a session-scoped bean. Why the data I insert in one page doesn't save in bean when I navigate to other page? Not enough information to guess.
Re: Skip Validation Phase
Short answer: immediate doesn't skip validation phase. Long answer: http://wiki.apache.org/myfaces/How_The_Immediate_Attribute_Works On 3/23/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi, All!!! I've confused with it in JSF. I have some validation logic on my form: 2 textboxes which have required attribute And also one drop-down ( I used immediate=true, because I don't want to run validation before valueChangeListener ). In my valueChangeListener I tried to ignore validation phase at all, so in the end of this method I called FacesContext.getCurrentInstance().renderResponse(); Here is code: public void vendorChanged(ValueChangeEvent event) { FacesContext context = FacesContext.getCurrentInstance(); String value = (String) event.getNewValue(); if (value != null) { … updating bean data, I expected that data will be appear on my page } context.renderResponse(); } But when this valueChangeListener finished data isn't updates on the my page? Why? Any ideas? Thanks in advance, Yura.
Re: Skip Validation Phase
My first attempt to solve such a problem was to create the OptionalValidationFramework discussed on the wiki, but I don't really like that approach. It worked for me because I had a lot of dropdowns on the page. You might take a look at using the Sandbox subform validation as an alternate way to do optional validation. If you have only a few components that need to work like this, you could manually perform the update model phase yourself.I haven't tried it, but you might be able to call component.processUpdates() in your handler. Otherwise, you can manually grab the submitted or validated local value from the component, and manually put it into the backing bean. On 3/23/06, Yura.Tkachenko [EMAIL PROTECTED] wrote: Ok, Thanks. Do you know any solution which will be usefull for me? Thanks, Yura. -Original Message- From: Mike Kienenberger [mailto:[EMAIL PROTECTED] Sent: Thursday, March 23, 2006 6:42 PM To: MyFaces Discussion Subject: Re: Skip Validation Phase On 3/23/06, [EMAIL PROTECTED] I know this, but for skip validation phase I'm using call: FacesContext context = FacesContext.getCurrentInstance(); context.renderResponse(); I guess I was too subtle. You're not skipping just the validation phase. You're skipping all phases after ApplyValues, including UpdateModel. Your backing beans will not be updated.
Re: inputText and null processing
Seems unlikely. I recommend posting your actual page code. I use facelets and jetty 5.1.x, and I haven't had these problems. On 3/23/06, Serge Bogatyrjov [EMAIL PROTECTED] wrote: Thanks, but when I were writing marked one input as required, I meant thу following: h:inputText required=true value=... And I found that there is no any validation. ...and other problems. It is possible, that this problems are issued by another software (facelets, jetty, ...), but code I have referenced to some strange nulls processing: * when submitted value is null, the validation process is interrupted; * null request parameters are treated as absent. It is possible, that in another environment nulls in parameter values are not occur. But, in my case, nulls happen. I'll try another container, may be the problem is related to jetty. (?) Best regards. 2006/3/23, Mike Kienenberger [EMAIL PROTECTED]: On 3/23/06, Serge Bogatyrjov [EMAIL PROTECTED] wrote: I have a form and some inputs on it. I marked one input as required. Then I expected to get a error message when posting an empty form. By I did not get any messages. It should be as simple as adding required=true as an attribute for your component. As you have noticed, this is the only validation potentially checked for an empty input component.
Re: inputText and null processing
On 3/23/06, Serge Bogatyrjov [EMAIL PROTECTED] wrote: Some days ago a have written a converter to convert a submitted empty string to null. Are you talking about a JSF String Converter? If so, JSF String Converters are not allowed in JSF 1.1. You'll need to wait until JSF 1.2 (It was only added to JSF 1.2 this month).
Re: inputText and null processing
Well, that is a bit odd. I don't see anything wrong with the code you posted. How are you including your ui:composition in your master page? Things I would try if I were you: 1) Another browser -- the submitted values from your form are generated by your browser -- maybe the one you're using is doing something odd! I'm using Firefox 1.5.0.1, although I've also used IE 6 for some testing int he past. 2) Another container -- As you say, Jetty 6 is still in beta and might be causing this, although I don't see how it could create null values for form fields that the browser doesn't submit. 3) Duplicating your master page and composition and methodically-deleting tags until you've reduced this down to the minimal page code that reproduces the problem. Then post that here. On 3/23/06, Serge Bogatyrjov [EMAIL PROTECTED] wrote: I am using maven-jetty-plugin based on jetty6. This plugin is good for development. But this is a snapshot and there are bugs. Some days ago a have written a converter to convert a submitted empty string to null. But today I encountered with nulls in request parameters. Definitely, I do not sure, I will try. The page is large, but it is quite simple. I have reduced it a little. 23.03.06, Mike Kienenberger [EMAIL PROTECTED] написал(а): Seems unlikely. I recommend posting your actual page code. I use facelets and jetty 5.1.x, and I haven't had these problems.
Re: Ajax jsf component panel
You might take a look at the org.apache.myfaces.custom.accordion.HtmlAccordionPanel in the MyFaces Tomahawk sandbox. On 3/23/06, John Slave [EMAIL PROTECTED] wrote: Hi, i wish to create an ajax component panel that is simply a panel with particular javascript effect to expand and contract. However i found a solution but i don't know if this is the right solution. I will use dwr servlet to communicate by ajax (as explained in blue prints catalog article) but the render inside will be always available but hidden...because i don't know how i can render and put the result via ajax... Someone can tell me if it is a correct solution? Some suggestion? Thank you Yours faithfully John Slave
Re: JSF and Tiles
The tiles support for JSF is primarily there to allow people to port existing tiles apps (or tiles knowledge) to JSF. You should consider using facelets or Shale/Clay for templating with JSF. You can find a list of articles on using Facelets here: http://wiki.java.net/bin/view/Projects/FaceletsArticles On 3/24/06, Murat Hazer [EMAIL PROTECTED] wrote: Hi, Is there a good tutorial introduces tiles and usage of it with JSF, or is there any other good templating framework for JSF? Regards -- Murat HAZER Elektrik-Elektronik Mühendisi - Electrical-Electronics Engineer
Re: test first...mock FacesContext?
On 3/24/06, Dean Hiller [EMAIL PROTECTED] wrote: So, I looked into FacesContext and mocking that and it unfortunately is not an interface. A FacesContextFactory.getInstance() call returning an interface would have made life easier since mock libraries mock interfaces very easily. oh well, how can one test a web app where the web app makes calls into an external system which we naturally mock(with a library of course). Dean, I would start here at the Shale JSF testing framework: http://struts.apache.org/struts-shale/features-test-framework.html
Re: Regarding Server Side Tab Switching in panelTabbedPane.
On 3/25/06, Chandramohan Mani [EMAIL PROTECTED] wrote: Hi Mike, can you please help me how to use this pacth in my file. It's better to post to the MyFaces users mailing list rather than to me directly. The patch I applied for serverSideTabSwitching is a trivial one. It merely fixes a bug where you were required to use #{true} instead of true You can build the latest code snapshot (or use a nightly build if you don't need the sandbox) to pick up the patch automatically. Otherwise, I'd recommend just using the workaround -- #{true} for true and #(false} for false until your next upgrade.
Re: tabchangelistener
On 10/31/05, Turgay Zengin [EMAIL PROTECTED] wrote: The flag is: serverSideTabSwitch=true This attribute is for the t:panelTabbedPane. The interpretation and state-saving of the serverSideTabSwitch was broken until this week. I'd recommend that you use the latest nightly build or an svn snapshot if you need serverSideTabSwitching. The workaround for using it without upgrading is to use serverSideTabSwitch=#{true} However, you may still have problems because the state of the switch is not saved, and the behavior may unexpectedly revert back to client-side tab switching (or may break in some other unexpected way).
Re: PanelTabbedPane : Server Side Tab Switch
On 3/25/06, Cedric Legallo [EMAIL PROTECTED] wrote: Hi everyone, I am using myfaces 1.0.10 for a project, and i need to force a server side tab switching for a t:panelTabbedPane tag. How can it be done with 1.0.10 version of myFaces ? Your best bet is to upgrade to the latest snv snapshot due to bugs I fixed earlier this week. Otherwise, try downloading the latest source code and back-port the changes. I'm fairly certain that the code to support server-side tab switching was still in there -- you only need to provide a flag to activate it. Actually, you could potentially hardcode server-side tab switching into your build -- that should be pretty trivial. -Mike
Re: tabchangelistener
On 3/25/06, Matthias Kahlau [EMAIL PROTECTED] wrote: Can you please tell me what the problem was with the serverSideTabSwitch? You quoted it already below, but to restate, it didn't interpret non-EL expressings as Boolean values, and wasn't saving the state of the switch in saveState/restoreState. On 3/25/06, Matthias Kahlau [EMAIL PROTECTED] wrote: On 10/31/05, Turgay Zengin [EMAIL PROTECTED] wrote: The flag is: serverSideTabSwitch=true This attribute is for the t:panelTabbedPane. The interpretation and state-saving of the serverSideTabSwitch was broken until this week. I'd recommend that you use the latest nightly build or an svn snapshot if you need serverSideTabSwitching. The workaround for using it without upgrading is to use serverSideTabSwitch=#{true} However, you may still have problems because the state of the switch is not saved, and the behavior may unexpectedly revert back to client-side tab switching (or may break in some other unexpected way). Can you please tell me what the problem was with the serverSideTabSwitch? I use the Nightly Build 20051130 with serverSideTabSwitch, and it seems to work without a problem... -Matthias
Re: Getting the sandbox components
On 3/27/06, octoberdan [EMAIL PROTECTED] wrote: I downloaded the examples, but sandbox isn't there! Is there another place to get the most recent build of sandbox? I'm in desperate need of the picklist component... The only way to get it right now is to build the source from svn. There's an open JIRA issue on the lack of a sandbox jar build in the nightlies. http://issues.apache.org/jira/browse/TOMAHAWK-209 Feel free to watch/vote-for/submit-a-patch-for the issue.
Re: missing row attribute in a datatable using a datascroller causes by zero exception
Fixed as of March 1st. http://issues.apache.org/jira/browse/TOMAHAWK-104 On 3/27/06, Hans Sowa [EMAIL PROTECTED] wrote: Hi Is there a possibility to enhance the code of this method? My Problem is if there the row attribute is missing in the datatable (using datascroller) you will always get an by zero exception because of the line if ( uiData.getFirst() % rows 0). It would be very helpfull to have a more specific Exception. Many thanks in advance. class: HtmlDataScroller /** * @return the page index of the uidata */ public int getPageIndex() { UIData uiData = getUIData(); int rows = uiData.getRows(); int pageIndex; if (rows 0) { pageIndex = uiData.getFirst () / rows + 1; } else { log.warn(DataTable + uiData.getClientId(FacesContext.getCurrentInstance()) + has invalid rows attribute.); pageIndex = 0; } if (uiData.getFirst() % rows 0) { pageIndex++; } return pageIndex; } -- mfg Hans Sowa mailto:[EMAIL PROTECTED]
Re: Problem with PhaseListener
Add the phase listener to your faces-config.xml file instead so that it is only registered once at application startup. On 3/26/06, Lisaa [EMAIL PROTECTED] wrote: Hi., In order to manipulate (update model before event request) the default lifecycle, I added a PhaseListener to my Backing bean's constructor. CODE: lifecycle.addPhaseListener(new PhaseListener() { public void beforePhase(PhaseEvent event) { resetValues(); } public void afterPhase(PhaseEvent event) { } public PhaseId getPhaseId() { return PhaseId.RENDER_RESPONSE; } }); It works fine and the method calls as how it should be. But the problem is when I open a new browser and open my index page then the method resetValues() (from old PhaseListener) was called even before it starts its session. So whenever I open a new browser then the PhaseListener array gets incremented and accordingly it calls that many times this resetValues() method. I totally went mad on this. Or I'm doing any wrong in placing/adding PhaseListener ? Please help me with your suggestions. Thanks -- View this message in context: http://www.nabble.com/Problem-with-PhaseListener-t1344308.html#a3595725 Sent from the MyFaces - Users forum at Nabble.com.
Re: SVN Organization
On 3/27/06, Dennis Byrne [EMAIL PROTECTED] wrote: You'll want the current dir . This information should be on the wiki but I am not sure. http://wiki.apache.org/myfaces/Building_With_Maven
Re: MyFaces API SelectItem as an interface rather than a concrete class?
On 3/27/06, Murray Brandon [EMAIL PROTECTED] wrote: SelectItem appears to lend itself well to being an interface (could move the default implementation into a DefaultSelectItem class)? http://wiki.apache.org/myfaces/FAQ#JSFspec
Re: HtmlSelectOneMenu not serializeable ?
On 3/28/06, Michael Heinen [EMAIL PROTECTED] wrote: Do you see also any issues when I mark the field transient and check in the getter whether the instance is null and reinitialize it if necessary? Michael, That is probably a better way to handle this situation. You could also skip the getter and simply accept whatever value is provided by the setter if you are not manually creating the component.
Re: HtmlSelectOneMenu not serializeable ?
On 3/28/06, Michael Heinen [EMAIL PROTECTED] wrote: I create the component in my bean manually and populate it with SelectItems. Do you mean using a managed property and a more complex setter as an alternative? Is this a better approach than the check in the getter? It's had to say without knowing specifically what you're doing. Personally, I haven't had the need to manually create a component in the getter. From what you've posted so far, it doesn't really sound like you need that functionality either. It sounds like all you need is a reference to your selectOneMenu component. It also sounds like you have a couple of different issues you're trying to deal with: Seralization as well as a selectOneMenu that immediately changes what's displayed on the page. I've got more experience with the second. There's no really good way to handle the second case yet. Some of the ways I've seen so far are - OptionalValidationFramework (doesn't work well if you're not using facelets so I'd only suggest it if you have either a lot of immediate controls and are using facelets) - the new sandbox subform stuff (or the ADFFaces equivalent if you're using ADF), - manually updating the backing bean from your immediate actionListener via a component reference - using the delayed valueChangeListener component (I think it's called ValueChangeNotifier or StateChangeNotifier?) Again, you might get better advice if you post a bigger picture of what you're trying to accomplish since some of your reported problems may be irrelevent with a different approach.
Re: panelTabbedPane - only first tab change works
It's possible if you were using serverSideTabSwitching=true that this bug was fixed earlier this week. Try it with a nightly build. The serverSideTabSwitching state was not being saveState'd. Another possibility is that you're basing your actions on a request-scoped bean that no longer exists on the next request. On 3/28/06, Hennie Brugman [EMAIL PROTECTED] wrote: Dear all, When testing on a local Tomcat my panelTabbedPane works fine. However, when running it on Tomcat on our Apache2 server only the first tab change works. Subsequent clicks bring me to the default tab, and no events arrive at my tabChangeListener anymore. Does anyone have an idea what could be wrong? best, Hennie Brugman
Re: graphicImageDynamic
I haven't tried this tag recently, but the original version of it stored the page state in the url. Thus it wouldn't work on large pages. You might see if there's some error about the URL being larger than 4096 characters in your logs. On 3/27/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi, i have problems to implement the sandbox tag graphicImageDynamic. I followed the instructions and use the actual subversion version where i found an example. But with hibernate and facelets it will not work for me. I've read a lot, implemented all properly, but the image from the database will not be rendered. e.g. i implemented http://wiki.java.net/bin/view/Projects/FaceletsTaglibsMyfacesSandbox - for sandbox-facelets support. Have somebody implemented this tag or is it possible to render an image from the database with another tag??? Regards, Udo Jetzt Handykosten senken mit klarmobil - 14 Ct./Min.! Hier klicken www.klarmobil.de/index.html?pid=73025
Re: Tomahawk and JSF RI
On 3/28/06, Frank Russo [EMAIL PROTECTED] wrote: So I assume that means I need to add the myfaces-impl-1.1.3-SNAPSHOT.jar to my project's WEB-INF/lib as well? No, you don't want to do that if you're using the JSF RI. As Matthias states, you only want to add that missing class to your application. Please open a JIRA issue, and we'll fix this!
Re: Tomahawk and JSF RI
On 3/28/06, Frank Russo [EMAIL PROTECTED] wrote: So I assume that means I need to add the myfaces-impl-1.1.3-SNAPSHOT.jar to my project's WEB-INF/lib as well? Hey Frank. It looks like the myfaces-impl dependency is only (incorrectly) required by the sandbox.jar, but there's a lot of them to fix. My suggestion would be to pull out only the sandbox component that you want to use into your own application code rather than trying to get sandbox.jar working with the JSF RI.Or, if you feel comfortable doing so, you can use MyFaces instead of the JSF RI. I've opened an issue to track these. https://issues.apache.org/jira/browse/TOMAHAWK-220
Re: Anyway to bind a tree.HtmlTree (NOT tree2) to backing bean?
Tree has component logic in the JSP tag. It'd be great if someone submitted a patch to clean it up. On 3/29/06, Andrew Robinson [EMAIL PROTECTED] wrote: I just had the same problem with the NullPointerException. I think it is a facelet+myfaces issue. I had to add a model property to the tree to stop the errors: t:tree model=#{currentView.memberDialog.memberTree} value=#{currentView.memberDialog.memberTree} styleClass=availMembersTree expandRoot=false / On 12/22/05, Mike Kienenberger [EMAIL PROTECTED] wrote: All JSF components must support binding. (and id and rendered). If t:tree isn't supporting it, it's a bug. Have you tried it? If so, what error are you getting? On 12/21/05, Kenneth Gertsen [EMAIL PROTECTED] wrote: I'm trying to use MyFaces 1.1.1 TreeTable. Is there any way to bind an instance of org.apache.myfaces.custom.tree.HtmlTree to my backing bean? The t:tree tag does not have a binding attribute? In addition to the binding problem, the HtmlTree code is throwing a NullPointerException in HtmlTree.addToModelListeners() whenever I try to leave the page showing the tree or expand a node of the tree. Also, I'd like more control over what nodes are expanded initially and I believe the best way to do that is to bind the tree to an instance of HtmlTree in my backing bean. Any help would be greatly appreciated. Thanks, Ken Gertsen
Re: SaveState and Websphere 6
On 3/29/06, Geoff Longo [EMAIL PROTECTED] wrote: I am having what appears to be an issue with saveState not working on Websphere 6. My backing bean is request scoped and my jsf is saving the state of the entire backing bean. This works perfectly on Tomcat 5.5, but when I deploy to Websphere, things seem to fall apart. Currently, my backing bean holds a reference to a DataModel (not serializable) that represents a table on my page. When I try to access this DataModel after the page is submitted, I get a null pointer on Websphere, but Tomcat seems to have no problem. Could this be due to serialization differences between Websphere and Tomcat? See the following thread posted a couple hours earlier. Basically, there's another JSF implementation you need to remove. I think there's also a ws.jar file (or something named like that) which also has to be removed. This question comes up a lot -- it'd be great if someone using WebSphere would add an entry to the wiki page on it. http://wiki.apache.org/myfaces/Installation_and_Configuration -- Forwarded message -- From: sia far [EMAIL PROTECTED] Date: Mar 29, 2006 9:31 AM Subject: RE: websphere 6 and myfaces compatibility To: dev@myfaces.apache.org Websphere 6.0 loads IBM JSF jar files during the startup. You may need to remove them to avoid conflicts. Though I removed those jars and changing to Parent_Last, I was unable to run the sample apps on WAS6.0 fully. If this app is a production app, then good luck to you and let me know if you can make it work. If not, you may want to give it a break till things get more stable. From: Mohamed Inelhaj [EMAIL PROTECTED] Reply-To: MyFaces Development dev@myfaces.apache.org To: dev@myfaces.apache.org dev@myfaces.apache.org Subject: websphere 6 and myfaces compatibility Date: Wed, 29 Mar 2006 14:30:48 +0200 I am trying to migrate an application based on myfaces 1.1.0 from tomcat to websphere 6 with no success. I get an nullPointerException [3/29/06 14:12:20:888 CEST] 0049 ServletWrappe E SRVE0068E: Could not invoke the service() method on servlet Controller Servlet. Exception thrown : java.lang.NullPointerException at javax.faces.component.UIComponentBase.processRestoreState(UIComponentBas e.java:1032) at javax.faces.component.UIComponentBase.processRestoreState(UIComponentBas e.java:1043) at javax.faces.component.UIComponentBase.processRestoreState(UIComponentBas e.java:1043) at org.apache.myfaces.application.jsp.JspStateManagerImpl.restoreComponentS tate(JspStateManagerImpl.java:129) at org.apache.myfaces.application.jsp.JspStateManagerImpl.restoreView(JspSt ateManagerImpl.java:185) at org.apache.myfaces.application.jsp.JspViewHandlerImpl.restoreView(JspVie wHandlerImpl.java:255) at org.apache.myfaces.lifecycle.LifecycleImpl.restoreView(LifecycleImpl.jav a:113) at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:66 )
Re: Tomahawk and JSF RI
On 3/28/06, Frank Russo [EMAIL PROTECTED] wrote: This has probably been discussed a thousand times, but I can't find a mailing list archive. Our mailing lists are hidden under the project info navigation link, which is unfortunate. Here's a direct link. http://myfaces.apache.org/mail-lists.html On 3/29/06, Frank Russo [EMAIL PROTECTED] wrote: I'm having trouble getting to the JIRA page. I'm also getting a Service Temporarily Unavailable error. I'm getting another exception: java.lang.NoClassDefFoundError: org/apache/myfaces/renderkit/html/HtmlHiddenRenderer The issue I opened listed the components with incorrect Myfaces-Impl dependencies. However, each of those components had multiple errors. So you're looking at something like 50 errors to correct (although many of them are duplicates). It's something that's going to take time to fix, especially since we want to do a release of the MyFaces implementation this week. My recommendation is to pull out the SelectOneRow component by itself for now.Or maybe it'd be easier to delete the problem components by directory in your personal build.
Re: getChildCount returns 0 at encodeBegin
Don't know if this is of any help to you, but Facelets also corrects the component tree rendering problem if you can use Facelets. On 3/29/06, Cagatay Civici [EMAIL PROTECTED] wrote: Hi, Thanks to Ed Burns, I've learned that this is a JSF issue, at first jsf creates the component tree during rendering components, in JSF 1.2 they've fixed this by first creating the tree and then rendering it. Cagatay Civici, On 3/16/06, Cagatay Civici [EMAIL PROTECTED] wrote: Hi, I wonder why this happens, public void encodeBegin(FacesContext context) throws IOException { log.debug(ChildCount: + getChildCount()); } public void encodeEnd(FacesContext context) throws IOException { log.debug(ChildCount: + getChildCount()); } For example in the jsp page, component's number of children is 3. At encodeBegin log gives me 0 but at encodeEnd it gives 3. Also when I override getRendersChildren to return true, encodeBegin log gives 3 this time. I'll be glad if you help me out, Regards, Cagatay,
Re: Picklist problem
Bruno, Picklist is one of the components that's got a dependency on MyFaces impl. Any chance you could take a look at fixing that? On 3/29/06, Bruno Aranda [EMAIL PROTECTED] wrote: Sorry for taking so long to answer. I am in the process of settling in another country. I have just checked in a fix for this issue in the SVN trunk :-) Regards, Bruno On 2/23/06, Alin Dosoniu [EMAIL PROTECTED] wrote: Hello, Any chance for this problem to be solved? I checked it in myfaces-example-sandbox from today and I can reproduce it. Thank you, Alin. Hi I've tried the examples which where build with the svn source from 16.02. the picklist shows the same error. If i select some values and click submit the values are shown {Selected values: option4, option3, option2, option}. if i click submit a second time no values are submitted and I have a empty right side again {No selected values}. maybe i fetched a wrong version from svn somehow. I'll try again tomorrow. regards stefan
Re: myfaces scrolling
On 3/28/06, Srinivas Surapaneni [EMAIL PROTECTED] wrote: getScrolling() javascript function is not being generated in the portal environment? Is this function being generated by the extension filter? That would be my guess since it would be rendered in the post-processing of the output.
Re: SVN Organization
On 3/28/06, Brandon Goodin [EMAIL PROTECTED] wrote: This is great! Maven... generate eclipse files... import project and bam!... in business. To be honest when i first scanned the repo i thought i was a mess. Glad i was wrong. Thanks a ton for all your help. You can import everything in one sweep by pointing the root import directory at the MyFaces-current root directory. At least that's true under Eclipse 3.1.1. I would recommend putting a link to the multiproject import for eclipse. This will find all the .project files in one sweep. Saves some time importing individual projects. http://eclipse-tools.sourceforge.net/projecttransfer/ I looked at the page, but I'm confused what it adds. Is it a pre 3.1.1 workaround? Please feel free to add it to the Eclipse IDE wiki page if you think it's helpful.
Re: Is there a binary build of ADF Faces?
On 3/29/06, Frank Russo [EMAIL PROTECTED] wrote: I can't find one. I tried building it, but there are maven dependencies that don't seem to exist on Ibiblio. I've tried downloading them directly, but I can't seem to find them. Here are the files if anyone know where to get them: jsp-api:jsp-el-api:jar:2.0 javax.mail:activation:jar:1.0.2 javax.mail:mail:jar:1.2 Frank, you want to either ask this on the Oracle site (if you're using ADFFaces through Oracle) or on the new ADFFaces apache incubator lists. My guess would be no for the OpenSource version since it's only now starting incubation. -- Forwarded message -- From: Craig McClanahan [EMAIL PROTECTED] Date: Mar 27, 2006 3:11 PM Subject: [ANNOUNCE] Mailing Lists for ADF Faces Incubator Podling To: MyFaces Development dev@myfaces.apache.org Cc: MyFaces Discussion users@myfaces.apache.org Good news! There are now four email lists that will be specifically focused on the ADF Faces component contribution to Apache! You can use the subscription links below to subscribe yourselves to the corresponding lists. ADF Faces User List -- this is the place to ask questions about using the ADF Faces components that are currently in incubation: [EMAIL PROTECTED] ADF Faces Developer List -- subscribe here to discuss the technical evolution of the ADF Faces components into the MyFaces community, and to talk about how we should deal with particular bugs and enhancement requests. [EMAIL PROTECTED] ADF Faces Commit Reports -- subscribe here to receive an email for each commit to the ADF Faces source code repository. All developers actively working on the ADF Faces components SHOULD (if it were up to me alone I would say MUST :-) subscribe to this list. [EMAIL PROTECTED] ADF Faces JIRA Issues -- subscribe here to receive an email each time a JIRA issue is created, or modified, for the ADF Faces components project. All developers actively working on the ADF Faces components SHOULD (if it were up to me alone I would say MUST :-) subscribe to this list. [EMAIL PROTECTED]
Re: n x n dataTable (myFaces)
On 3/29/06, fischman_98 [EMAIL PROTECTED] wrote: Can someone help me make a nxn dataTable using myFaces. I want 3 columns and n number of rows) Trying to use Tomahawk t:dataTable and t:columns, can't work it all out. Can't figure out how to loop through the rows and only show the number of columns I want to display. Thanks. Do the columns displayed change? If not, then you only need a regular h:dataTable and h:column. (Of course, you can also use the t:dataTable/t:column for extra functionality, but you don't have to do so). ie, h:dataTable value=#{yourBean.yourRowModel} var=rowObject h:column id=column1 .../ h:column id=column2 .../ h:column id=column3 .../ /h:dataTable If the columns are dynamic, then you'd need to use t:dataTable and t:columns (with an s). t:dataTable value=#{yourBean.yourRowModel} var=rowObject t:columns value=#{yourBean.yourColumnModel} var=columnObject / /h:dataTable
Re: n x n dataTable (myFaces)
You'd write a java class implementing DataModel, probably. You could implement List instead if you liked. Make it into a managed bean, and then assign your source list as a property to it. For example class ConsolidatedList implements List { public ConsolidatedList() public void setSourceList(List list) { ... } public List getSourceList() { ... } public int size() { return sourcelist.size() / 3 } public get(int index) { return new ConsolidatedObject(sourceList.get(index * 3), sourceList.get((index * 3) + 1), sourceList.get((index * 3) + 2)) } } On 3/29/06, fischman_98 [EMAIL PROTECTED] wrote: So for option 2, how do you reference index 0's one, two and three objects? I was trying to reference the t:dataTable var in the t:columns? This wasn't working. ie: t:dataTable value=#{...} var=row ... . . t:columns value=#{row.getColumn() I understand how to create the list of objects you described (in fact, I have created this already!), but I don't understand how to implement it with the dataTablebasically, how to loop through each row and grab the three objects for the columns. Really appreciate the help. Thanks. -- View this message in context: http://www.nabble.com/n-x-n-dataTable-%28myFaces%29-t1365618.html#a3662225 Sent from the MyFaces - Users forum at Nabble.com.
Re: NotSerializableException during saveState
Post your stack trace, but it's probably a non-serializable reference in your bean that's generating the error, and not your bean. You will either need to mark that reference as transient (in which case it will not be saved or restored) or make that reference serializable (or StateHolder'able). On 3/30/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi, All I'm using MyFaces component saveState and trys to save whole bean, so I implemented interface StateHolder for this bean as by manual, but I still get NotserializableException for my request scope bean. Could you please clarify this moment for me, please? I'm using SAVE_STATE_METHOD = client As manual I can implements one of these interfaces StateHolder or Serializable, but with StateHolder it isn't works, why? Thanks, Yura.
Re: values of my managed beans
On 3/30/06, Benjamin Bratkus [EMAIL PROTECTED] wrote: so is it actually possible to use inputfield within a datalist or not ? because my datatable and some fields within grid are nested in a datalist I'm fairly certain that this is fixed in the latest nightlies. Give it a try and see. If not, open a JIRA issue and provide the simplest-possible example demonstrating the problem. Thanks!
Re: Problems with tree2 and facelets
No, this is a good place to ask. The tree2 component doesn't work seemlessly with facelets. Fixing that is on the todo list. http://issues.apache.org/jira/browse/TOMAHAWK-47 A quick workaround is to use the following attribute names instead: // Tree2 attributes public static final String SHOW_NAV= org.apache.myfaces.tree2.SHOW_NAV; public static final String SHOW_LINES = org.apache.myfaces.tree2.SHOW_LINES; public static final String CLIENT_SIDE_TOGGLE = org.apache.myfaces.tree2.CLIENT_SIDE_TOGGLE; public static final String SHOW_ROOT_NODE = org.apache.myfaces.tree2.SHOW_ROOT_NODE; public static final String PRESERVE_TOGGLE = org.apache.myfaces.tree2.PRESERVE_TOGGLE; Ie, org.apache.myfaces.tree2.CLIENT_SIDE_TOGGLE=true However, this will break at some future point when we fix the issues with tree2. You can also quickly write a facelets component handler to alias each of these properities to the fully-qualified name. Just follow the simple example here. https://facelets.dev.java.net/nonav/docs/dev/docbook.html#dev-meta-component You can also go into the myfaces source code and change the definitions in JFSAttr to remove the fully-qualified names -- this has been a popular approach :) There's a similar issue with some of the t:dataTable attributes, also fixable in the same ways. On 3/30/06, Nahrwold, Helge [EMAIL PROTECTED] wrote: Good morning, is his the wrong place to ask this question? Should I ask this in the dev-mailinglist? Regards, Helge -Ursprüngliche Nachricht- Von: Nahrwold, Helge [mailto:[EMAIL PROTECTED] Gesendet: Mittwoch, 29. März 2006 16:15 An: MyFaces Discussion Betreff: RE: Problems with tree2 and facelets Hello again, I could isolate my problem. The tree2 works perfect when I access the content page directly. Normally there is a login page before the content site. If I come from the login (so I had a request over JSF before) then the tree2 needs one following request before it open the nodes. Without this request the nodes will be closed as first. But why? Is this a known problem? The backing bean for the login page only returns a key for the navigation-cases in the faces-config. Thanks, Helge -Ursprüngliche Nachricht- Von: Nahrwold, Helge [mailto:[EMAIL PROTECTED] Gesendet: Mittwoch, 29. März 2006 14:00 An: users@myfaces.apache.org Betreff: Problems with tree2 and facelets Hi, i need some help with Tree2 and Suns JSF RI with Facelets. The tree2 is clientSideToggle=true and (normally) showRootNode=false. I entered the site with a new browser window. I open some nodes and click on a commandLink. After reload all opened nodes are closed again. Next time this is no problem. #1 showRootNode is false The actionListener of the commandLink is not called when I click on it... #2 showRootNode is true The actionListener of the commandLink is called when I click on it... But I want no rootNode. I have tried the example from http://www.irian.at/myfaces/tree2HideRoot.jsf but there is still the same problem. Does anybody know a solution for my problem? Thanks for help, Helge Nahrwold
Re: Documentation for selectOneRow
This is part of the reason it's still in the sandbox. It's also new. Probably the best documentation at this point is the source itself or the sandbox example selectOneRow.jsf: The example is included with the source, but you can also find it online here. http://www.irian.at/myfaces-sandbox/selectOneRow.jsf If you want to help get the component out of the sandbox, documentation contributions would be gladly accepted! On 3/30/06, Frank Russo [EMAIL PROTECTED] wrote: Is there any documention for how to use selectOneRow? It's not listed with the other sandbox components on either myfaces home page or the wiki. Thanks... Frank Russo Senior Developer FX Alliance, LLC
Re: n x n dataTable (myFaces)
You can either create your own custom renderer for dataTable, or you can manually render everything by using a dataList on your page and adding all of the table-building tags explicitly -- you'll need to drop the column components from your page code if you go that route. On 3/29/06, Le Van [EMAIL PROTECTED] wrote: Mike Kienenberger wrote: You'd write a java class implementing DataModel, probably. You couldimplement List instead if you liked. Make it into a managed bean,and then assign your source list as a property to it.For example class ConsolidatedList implements List {public ConsolidatedList()public void setSourceList(List list) { ... }public List getSourceList() { ... }public int size() { return sourcelist.size() / 3 } public get(int index) {return new ConsolidatedObject(sourceList.get(index * 3),sourceList.get((index * 3) + 1), sourceList.get((index * 3) + 2))}}On 3/29/06, fischman_98 [EMAIL PROTECTED] wrote: So for option 2, how do you reference index 0's one, two and three objects?I was trying to reference the t:dataTable var in the t:columns? Thiswasn't working.ie:t:dataTable value=#{...} var=row ... .. t:columns value=#{row.getColumn()I understand how to create the list of objects you described (in fact, Ihave created this already!), but I don't understand how to implement it with the dataTablebasically, how to loop through each row and grab the threeobjects for the columns.Really appreciate the help.Thanks.--View this message in context: http://www.nabble.com/n-x-n-dataTable-%28myFaces%29-t1365618.html#a3662225 Sent from the MyFaces - Users forum at Nabble.com. So with the following table, how could I implement with t:dataTable. Coud someone help me ??. Or I try to extend t:dataTable. Opps I don't want to reinvent the wheel. Arrangement Number GoodsName規Case Amount Demand section MoneyAmount SoApplying Sonawa考 1 Slippers 1Murattecc Co. 100 Administration Section 33 Nothing Slippers 2Murattecc Co. 3 Administration Section 33 Slippers 3Murattecc Co. 3 Administration Section 33 Slippers 4Murattecc Co 3 Administration Section 33 Total 132
Re: Documentation for selectOneRow
The most preferred documentation format would be an xdocs file (for a good example, see the validateCompareTo component in the sandbox). mvn site to build the xdocs into a static html target. But, really, anything you want to put into the wiki would be better than nothing and could eventually be migrated to an xdocs file. On 3/30/06, Frank Russo [EMAIL PROTECTED] wrote: If I get it working, I'd be glad to help document it. What type of documentation are you talking? Just some ideas, so I know what needs to be done... Frank Russo Senior Developer FX Alliance, LLC -Original Message- From: Mike Kienenberger [mailto:[EMAIL PROTECTED] Sent: Thursday, March 30, 2006 10:52 AM To: MyFaces Discussion Subject: Re: Documentation for selectOneRow This is part of the reason it's still in the sandbox. It's also new. Probably the best documentation at this point is the source itself or the sandbox example selectOneRow.jsf: The example is included with the source, but you can also find it online here. http://www.irian.at/myfaces-sandbox/selectOneRow.jsf If you want to help get the component out of the sandbox, documentation contributions would be gladly accepted! On 3/30/06, Frank Russo [EMAIL PROTECTED] wrote: Is there any documention for how to use selectOneRow? It's not listed with the other sandbox components on either myfaces home page or the wiki. Thanks... Frank Russo Senior Developer FX Alliance, LLC
Re: tree2 tomahawk
On 3/30/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Thanks a lot for your answer. I tried your example however I have this error: java.lang.ClassCastException: org.apache.myfaces.config.MyfacesConfig What faces extension filter should I add? http://myfaces.apache.org/tomahawk/extensionsFilter.html I'd recommend making it your inner-most filter (list the extensionFilter's filter-mapping last).
Re: Issue with selectOneRow and Facelets
On 3/30/06, Frank Russo [EMAIL PROTECTED] wrote: s:selectOneRow groupName=entityName id=entityName value=BANK5 binding=/s:selectOneRow Generally means that the sandbox taglib.xml file hasn't been created/processed. Or that you didn't put a selectOneRow tag in it.
Re: Issue with selectOneRow and Facelets
On 3/30/06, Mike Kienenberger [EMAIL PROTECTED] wrote: On 3/30/06, Frank Russo [EMAIL PROTECTED] wrote: s:selectOneRow groupName=entityName id=entityName value=BANK5 binding=/s:selectOneRow Generally means that the sandbox taglib.xml file hasn't been created/processed. Or that you didn't put a selectOneRow tag in it. Or that you left of the xml namespace tag for s
Re: Does inputSuggestAjax works with STATE_SAVING_METHOD=server
Yes, you currently have to build sandbox from source. On 3/31/06, Murat Hazer [EMAIL PROTECTED] wrote: i have looked nightly build of sandbox.jar like tomahawk.jar, so i could'nt get it from http://cvs.apache.org/builds/myfaces/nightly/ , should i build it from the source? -- Murat HAZER Elektrik-Elektronik Mühendisi - Electrical-Electronics Engineer Tel - Phone: +90 222 335 05 80 - 1395
Re: Does inputSuggestAjax works with STATE_SAVING_METHOD=server
On 3/31/06, Murat Hazer [EMAIL PROTECTED] wrote: Is there any wiki entry about how to do this? http://wiki.apache.org/myfaces/Building_With_Maven
Re: myfaces-archetype bug?
Yep. Looks like your missing the JSP 2.0 classes. On 3/31/06, Mikael Andersson [EMAIL PROTECTED] wrote: [INFO] Trace java.lang.NoClassDefFoundError: javax/servlet/jsp/el/ELException HTTP ERROR: 500 JSP support not configured
Re: facelets
You can find a partial myfaces.taglib.xml file at this URL: https://facelets.dev.java.net/servlets/ReadMsg?list=usersmsgNo=90 While waiting to hear what's going on with the myfaces code gen, I've been manually adding myfaces extensions as I use them. So far it contains: aliasBean inputCalendar dataTable dataScroller columns -Mike On 8/1/05, Claudio Tamietto [EMAIL PROTECTED] wrote: thanks for the help - Original Message - From: Matthias Wessendorf [EMAIL PROTECTED] To: MyFaces Discussion users@myfaces.apache.org Sent: Monday, August 01, 2005 5:53 PM Subject: Re: facelets Claudio- that is posible! you have to do some xml stuff... add this to web.xml: *snip* context-param param-namefacelet.LIBRARIES/param-name param-value/WEB-INF/tag.xml/param-value /context-param *snip* your tag.xml contains component and renderer types, like: ?xml version=1.0? !DOCTYPE facelet-taglib PUBLIC -//Sun Microsystems, Inc.//DTD Facelet Taglib 1.0//EN http://java.sun.com/dtd/faclet-taglib_1_0.dtd; facelet-taglib namespacehttp://myfaces.apache.org/extensions/namespace tag tag-nametree2/tag-name component component-typeorg.apache.myfaces.HtmlTree2/component-type renderer-typeorg.apache.myfaces.HtmlTree2/renderer-type /component /tag /facelet-taglib and use the viewhandler from faclets (com.sun.facelets.FaceletViewHandler) btw. here is a short and simple myfaces/faclets helloworld app. http://people.apache.org/~matzew/myfacesFacelets.war HTH, Matthias On 8/1/05, Claudio Tamietto [EMAIL PROTECTED] wrote: i would like to use facelets with myfaces but i don't know if it is compatible and how to setup it . Thanks for any answer . -- Matthias Wessendorf
Re: Combining components
You can take a look at the thread entitied composite controls from 4 days ago for more alternatives and discussion. On 8/1/05, ir. ing. Jan Dockx [EMAIL PROTECTED] wrote: On 1 Aug 2005, at 12:14, Martin Marinschek wrote: You do that by simply instantiating components in your Renderer.encodeEnd method, set the appropriate attributes and call encodEnd on this components. See HtmlInputCalendar as an example, or other custom components in MyFaces... We'll have a look. We expect it to be a little more complicated than that, though, but we will get back on that. Anyway, it still would be a lot complexer than creating a tagx, though. If you want to do it JSP based (no real component architecture): Let's not get into that one ;-). For several years, the semantics of the word component, component based programming, etc., was the main topic of OOPSLA and ECOOP papers and workshops. As Dijkstra said about the topic in 1968, there should be a Journal of Half-baked Ideas … ;-). use alias beans (x:aliasBean) and jsp:include tags together (you cannot use the standard param technology of jsp:include and/or tiles, as JSF won't be able to resolve those params correctly for example in the decode phase)... Well, yes, indeed. The aliasBean works much like global variables for original FORTRAN and COBOL, although a bit better. And I suppose we should nest several aliasBean tags if we want to convey more than 1 parameter? This is no more than a stopgap. We'll use it for now, but we're akin for something better. So, does anybody know whether JSF 1.2 will make the use of tagx files possible? And does anybody have inside information on how 1.2 is proceeding? (We know some have, but are they free to say? ;-) ). regards, Martin On 8/1/05, ir. ing. Jan Dockx [EMAIL PROTECTED] wrote: encapsulated, parameterized entity? On of the features of component oriented development, in my view, is that it is easy to define new components as combinations of existing components. Take for instance the combination label, input field, and error message. h:outputText id=myProperty_label value=#{myHandler.myPropertyLabel} / h:inputText id=myProperty value =#{ myHandler.myProperty} / h:message id=myProperty_messages for=myProperty / This occurs many times in any JSF application, and it is bad practice to copy-paste this pattern all over your application. The pattern should be encapsulated (I'm actually talking about more complex combinations, but as an example, this will do). The encapsulation mechanism should allow for variation, of course. The easiest way of variation is parameterization. In the example, we want the handler and the property name to be parameterized. We have been this way with JSP, following the history of programming languages. Static includes gives us the possibility to reuse code (macro languages). Dynamic includes give more flexibility, but parameterization is not supported. We can communicate from calling code to called code through request, session or application scope variables, the way original COBOL and FORTRAN allowed communication into subroutines only via global variables (there was only 1 kind). With ALGOL we finally got procedures that feature formal parameters. In JSP 2, wefinally thanked the gods for .tagx files: an easy way to combine existing tags, that can be parameterized. Before .tagx files, we had to write a new tag in Java code to get parameterization. Doable, but hardly as flexible. Now in JSF, we have the same problem. Again, we can include stuff (don't forget to use subview / though), but this is not parameterizable. And we don't see a way to use .tagx files with JSF, since we cannot mix JSP EL with JSF EL. We would want to write the following myTag.tagx file: ?xml version=1.0 encoding=ISO-8859-1 ? jsp:root xmlns:jsp=http://java.sun.com/JSP/Page; version=2.0 xmlns:h=http://java.sun.com/jsf/html; jsp:directive.attribute name=handler type=java.lang.Object required=true / jsp:directive.attribute name=propertyName type=java.lang.String required=true / h:outputText id=${propertyName}_label value=#{handler[propertyName + 'Label']} / h:inputText id=${propertyName} value =#{handler[propertyName]} / h:message id=${propertyName}_messages for=${propertyName} / /jsp:root and use it in the calling page as q:myTag handler=#{myHandler} propertyName=myProperty / The above sadly doesn't work. To start with, it wouldn't access the managed bean facility. And if you take a look at the latest installment of JSF for nonbelievers ( http://www-128.ibm.com/developerworks/java/library/j-jsf4/index.html? ca=drs-, final section), you see that Rich Hightower just rewrites all functionality of the output text, input text, and message tag in Java for his combination tag. There is no reuse of the existing
Converters with null-capable and disabled SelectItems support
For anyone that might be interested, I've created a wiki page on creating converters with null-capable and disabled SelectItems support, which I've found to be of use when hooking database tables to a pulldown list. http://wiki.apache.org/myfaces/NullCapableConverter
Re: Problem with commandButton and required form fields
I don't have any answers yet, but I'm having the same issue. On 8/4/05, Eric Kelm [EMAIL PROTECTED] wrote: Hi all, I am having a problem with a form in an application I am working on and was wondering if anyone else had the problem. I have a large form that is part of a tabbed pane, where there are many form fields that are required (required=true). Within this form I have a place where a user can enter information in 2 of the form fields and click an Add button which adds values from the 2 form fields to a backing bean. The problem lies in that if any of the other fields on the form are required, this add function will fail due to failed form validations. I cannot make the Add button immediate=true because this bypasses the apply request values phase if I understand correctly. Any suggestions would be appreciated. Thanks in advance. Hope this makes sense. - Eric Kelm Developer, VSG Worldwide LLC 510 Spur 63 Longview, TX 75601
Re: Problem with commandButton and required form fields
Yeah, it looks like the two options are: 1) parse out the form values yourself 2) create an alternate lifecycle that conditionally skips the validation phase. Have you found any shortcuts for pulling in and populating the form values? Seems like a lot of duplication of JSF functionality. On 8/4/05, Eric Kelm [EMAIL PROTECTED] wrote: I figured out a way to get this to work. I have the immediate value for the button set to immediate=true and then I created an actionListener that populates the backing bean with the values manually. Hope this helps. - Eric Kelm Developer, VSG Worldwide LLC 510 Spur 63 Longview, TX 75601 --Original Message- -From: Mike Kienenberger [mailto:[EMAIL PROTECTED] -Sent: Thursday, August 04, 2005 4:07 PM -To: MyFaces Discussion -Subject: Re: Problem with commandButton and required form fields - -I don't have any answers yet, but I'm having the same issue. - -On 8/4/05, Eric Kelm [EMAIL PROTECTED] wrote: - Hi all, - - I am having a problem with a form in an application I am working on and -was - wondering if anyone else had the problem. I have a large form that is -part - of a tabbed pane, where there are many form fields that are required - (required=true). Within this form I have a place where a user can -enter - information in 2 of the form fields and click an Add button which adds - values from the 2 form fields to a backing bean. The problem lies in -that - if any of the other fields on the form are required, this add function - will fail due to failed form validations. I cannot make the Add -button - immediate=true because this bypasses the apply request values phase if -I - understand correctly. Any suggestions would be appreciated. Thanks in - advance. Hope this makes sense. - - - - - Eric Kelm - Developer, VSG Worldwide LLC - 510 Spur 63 - Longview, TX 75601 - - - - -
Re: Problem with commandButton and required form fields
Just came across something that might make this a lot easier: === Components that implement EditableValueHolder (such as UIInput), and whose immediate property is set to true, will cause the conversion and validation processing (including the potential to fire ValueChangeEvent events) that normally happens during Process Validations phase to occur during Apply Request Values phase instead. === On 8/4/05, Eric Kelm [EMAIL PROTECTED] wrote: I figured out a way to get this to work. I have the immediate value for the button set to immediate=true and then I created an actionListener that populates the backing bean with the values manually. Hope this helps. - Eric Kelm Developer, VSG Worldwide LLC 510 Spur 63 Longview, TX 75601 --Original Message- -From: Mike Kienenberger [mailto:[EMAIL PROTECTED] -Sent: Thursday, August 04, 2005 4:07 PM -To: MyFaces Discussion -Subject: Re: Problem with commandButton and required form fields - -I don't have any answers yet, but I'm having the same issue. - -On 8/4/05, Eric Kelm [EMAIL PROTECTED] wrote: - Hi all, - - I am having a problem with a form in an application I am working on and -was - wondering if anyone else had the problem. I have a large form that is -part - of a tabbed pane, where there are many form fields that are required - (required=true). Within this form I have a place where a user can -enter - information in 2 of the form fields and click an Add button which adds - values from the 2 form fields to a backing bean. The problem lies in -that - if any of the other fields on the form are required, this add function - will fail due to failed form validations. I cannot make the Add -button - immediate=true because this bypasses the apply request values phase if -I - understand correctly. Any suggestions would be appreciated. Thanks in - advance. Hope this makes sense. - - - - - Eric Kelm - Developer, VSG Worldwide LLC - 510 Spur 63 - Longview, TX 75601 - - - - -
Re: Problem with commandButton and required form fields
Gary, It seems like a good idea, but there are still some gotchas. There's no guarantee that the CommandButton's ActionEvent will be broadcast after the ValueChangeEvent from the UIInput. The value bindings also won't be performed since those happen in the update model phase. So, it'll help somewhat so long as you only directly read the values from the component. That's a step up from reading the form request values. Probably the best that can be done in the current JSF model. -Mike On 8/4/05, Gary VanMatre [EMAIL PROTECTED] wrote: I don't have any answers yet, but I'm having the same issue. On 8/4/05, Eric Kelm [EMAIL PROTECTED] wrote: Hi all, I am having a problem with a form in an application I am working on and was wondering if anyone else had the problem. I have a large form that is part of a tabbed pane, where there are many form fields that are required (required=true). Within this form I have a place where a user can enter information in 2 of the form fields and click an Add button which adds values from the 2 form fields to a backing bean. The problem lies in that if any of the other fields on the form are required, this add function will fail due to failed form validations. I cannot make the Add button immediate=true because this bypasses the apply request values phase if I understand correctly. Any suggestions would be appreciated. Thanks in advance. Hope this makes sense. I think that section 2.2.2 in the JSF 1.1 Specification talks about this. If I'm reading this correctly, components that implement the EditableValueHolder interfaces and have the immediate attribute set to true will cause the conversion and validation to happen in the Apply Request Values phase where it is normally triggered in the Process Validations. I knew the effect of the immediate flag on components realizing ActionSource but had not realized it was on the EditableValueHolder too. Maybe you could use the immediate=true on the command button and your 2 input fields? Gary - Eric Kelm Developer, VSG Worldwide LLC 510 Spur 63 Longview, TX 75601
Re: a book to learn jsf
I liked the presentation of JSF in Action, but there were a lot of errors in the example code. On 8/4/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I used JavaServer Faces by Hans Bergsten and Sun Core JSF, both were good. You can read both if you sign up for the oreilly.com safari service. It's a lot cheaper if you read a lot of technical books. -Original Message- From: hicham abassi [mailto:[EMAIL PROTECTED] Sent: Thursday, August 04, 2005 3:39 PM To: users@myfaces.apache.org Subject: a book to learn jsf Hello, I want to buy a book on JSF but i can't make a choice between theses books : http://www.amazon.com/exec/obidos/search-handle-form/002-4097544-3300815 I hesitate between Sun Core JSF and JSF in action Thanks.
Re: Re: Problem with commandButton and required form fields
I was thinking of a similar solution. Open a new window with a new form, and move everything that's on the tabbed view to this popup panel. Have this triggered with a control on the first form. I don't know much javascript, but I think this is possible. On 8/5/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I had a similar problem. I use UIInput components with NO value binding. Instead the components have a valueChangedListern (function) of a bean. So the values are added there internally. Setting immediate=true on the input components helps, but if you have serveral parts of a form, e.g. a second add button and input fields you are getting into troubles again. One solution is to split the form. But you would lose all other entered values and if client state saving is on you get much overhead. To solve the validation issue I have created a component to simulate a partial form submit (or better partial validation). With this component I can divide the form ito serveral parts where the validation and update model phase is only invoked on the components if a command component was clicked of this part. Maybe this would help you, too?
Re: a book to learn jsf
On 8/5/05, Sean Schofield [EMAIL PROTECTED] wrote: Kito Mann's book is excellent. Most of the people I work with in my day job prefer this one. Bill Dudney's book is also good and is probably the best starting point for someone new to web application frameworks in general (its also a little more conceptual than most.) The Core book is also very good but I read this last out of the four of them so it didn't show me much (that's not David and Cay's fault, just the order I read them.) I've got Kito's JSF in Action, Bergsten's JSF, and Dudney's Master JSF on my desk. I started with JSFia a couple of months ago, and I haven't felt the need to read the other two yet. Occasionally I will look up an obscure topic in all three, but generally JSFia has it covered. The things I liked about JSFia is that it doesn't present everything from Struts perspective, which seems to be so common these days (I used Struts for my last project, but I don't consider it to be a good building point for teach JSF unless Struts is all you knew), and it doesn't require you to read the entire book cover-to-cover to get started working.
custom String converters disallowed in myfaces implementation?
I notice that Myfaces disallows custom String (and Object) converters. === static Converter findUIOutputConverter(FacesContext facesContext, UIOutput component) if (String.class.equals(valueType)) return null;//No converter needed for String type if (Object.class.equals(valueType)) return null;//There is no converter for Object class === I don't see anything in the spec that requires this restriction. My use case is that I would like to create a java.lang.String converter that automatically converts all empty strings to null.
Re: Set SelectItem Selected Programmatically
Is that answering the same question he asked? Isn't the way to do this to make sure that the target of your value binding for your select box is set to the same value as the desired SelectItem's getValue()? On 8/5/05, Martin Marinschek [EMAIL PROTECTED] wrote: just use the constructor with the disabled attribute - or the setters. regards, Martin On 8/5/05, Ted Jones [EMAIL PROTECTED] wrote: Is there a way to programmatically set a SelectItem object selected so when the page renders it is highlighted in it's select box? Thanks, Ted Jones
Re: RE: Antwort: Re: Problem with commandButton and required form fields
Thanks for pointing that out. I'm now watching MYFACES-277. I'm currently using the immediate=true methodology, but I'm convinced that a separate form is the best solution for my use case. On 8/8/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: At the moment there is a problem with it, because of the canged behavior of the UIInput component (through MYFACES-277). Now it does not make much sense to use it, because all not validated fields will lose their value and the user has to reenter all the data. My opinion is that this new behaviour is not correct. Maybe we solve this in the next days.
Re: great article
On 8/7/05, Werner Punz [EMAIL PROTECTED] wrote: In my opinion x:saveState is superior to every dialog approach on the web, because it keeps things small and simple. You do not need another set of page flow syntax files, you just add an x:saveState and use the existing page flow syntax of JSF to do your stuff. The only culprit I have with x:saveState is, that you definitely have your components serializable and thus you have to do extra work for complex objects. I agree. I considered implementing a page-scoped Managed Bean extension, but when I finished defining what I wanted it to do, it was performing the same operations as x:saveState, yet wasn't as flexible. However, it was frustrating and time-consuming to learn how to serialize my page's backing bean (2 hours), but it'll be easier and faster in the future now that I understand the issues better. One issue I still haven't adequately solved is how to recreate the linkages between my backing bean and the other beans. Currently, I'm doing things like this. ValueBinding binding = facesContext.getApplication().createValueBinding(#{authenticationBean}); authenticationBean = (AuthenticationBean)binding.getValue(facesContext); binding = facesContext.getApplication().createValueBinding(#{adminDbDataStore}); adminDbDataStore = (AdminDbDataStore)binding.getValue(facesContext); Maybe it's an indication that I need refactor my page-scope backing bean into multiple beans so that dependencies on other beans no longer exist. -Mike
Re: Help with DataScroller
From my limited use of DataScroller, it's simply a decorator. You design as if it doesn't exist (ie, work everything through your DataTable). Then you stick a couple DataScroller components on your page to modify what's actually rendered and displayed, and add a rows parameter to dataTable. Here are the two datascrollers I'm using (modified from the datascroller example program in myfaces. There's nothing to it other than this code -- no backing bean support, configuration files, or java code behind it. x:dataScroller id=scroller_controls for=datatable fastStep=10 pageCountVar=pageCount pageIndexVar=pageIndex styleClass=scroller paginator=true paginatorMaxPages=9 paginatorTableClass=paginator paginatorActiveColumnStyle=font-weight:bold; f:facet name=first h:graphicImage url=/images/arrow-first.gif border=1 / /f:facet f:facet name=last h:graphicImage url=/images/arrow-last.gif border=1 / /f:facet f:facet name=previous h:graphicImage url=/images/arrow-previous.gif border=1 / /f:facet f:facet name=next h:graphicImage url=/images/arrow-next.gif border=1 / /f:facet f:facet name=fastforward h:graphicImage url=/images/arrow-ff.gif border=1 / /f:facet f:facet name=fastrewind h:graphicImage url=/images/arrow-fr.gif border=1 / /f:facet /x:dataScroller x:dataScroller id=scroller_information for=datatable rowsCountVar=rowsCount displayedRowsCountVar=displayedRowsCountVar firstRowIndexVar=firstRowIndex lastRowIndexVar=lastRowIndex pageCountVar=pageCount pageIndexVar=pageIndex h:outputFormat value={0} records found, displaying {1} records, from {2} to {3}. Page {4} / {5} styleClass=standard f:param value=#{rowsCount} / f:param value=#{displayedRowsCountVar} / f:param value=#{firstRowIndex} / f:param value=#{lastRowIndex} / f:param value=#{pageIndex} / f:param value=#{pageCount} / /h:outputFormat /x:dataScroller On 8/9/05, Trevor Griffiths [EMAIL PROTECTED] wrote: Hi, I'm somewhat of a newbie with JSF and I'm attempting to use the data scroller with a data table. I've tried to set a jsp page up in the same way as the example. When the table has more then 10 entries the pagination widget displays correctly. If I select the next page I end up with an empty table display (header only). The widget still displays but the buttons simply refresh the existing empty page. When I set up the jsp the only link that I could see between the table and the scroller(s) was the for parameter which I set to the id of x:datatable The scroller and table are a complete black box to me. I have no idea what's going on inside (and that's the way it should be for a component). Unfortunately, I also don't know whether my backing bean is supposed to do something (couldn't find the src for an example backing bean). Similarly what do the other parameters pageCountVar and pageIndexVar actually do? The explanation in the component definition didn't help me. Do I need to relate them to the table in some way? Any help (or pointers to other documentation) would be much appreciated. Thanks Trev...
Re: Help with DataScroller
This might not be an issue with DataScroller or Datatable, but instead is just a scoping issue with your table backing data. Is your data still there after you process a second request? If you're only accessing it in a request-scoped bean, then it's gone afterwards. A quick way to check is to set the bean to session-scoped. If that's the case, you'll probably want to use the x:saveState component to preserve your data between requests. -Mike On 8/9/05, Trevor Griffiths [EMAIL PROTECTED] wrote: Thanks for the quick response :-) That's exactly what I did. I set the rows in the data table parameter to 10. I then set up a table with 14 rows of data. It correctly displays the first page of the data table. The scrollers show that I have 2 pages with a total of 14 entries and It is currently displaying 10/14 of the entries. When I click to display the next page (using any of the appropriate buttons or links), it refreshes to an empty table showing only the header and scroller widgets. I was expecting to see the remaining four rows. Once on the second page the widget will not let me return to the first page. It simply re-displays an empty table. weird. Trev... At 09:18 AM 8/9/2005, you wrote: From my limited use of DataScroller, it's simply a decorator. You design as if it doesn't exist (ie, work everything through your DataTable). Then you stick a couple DataScroller components on your page to modify what's actually rendered and displayed, and add a rows parameter to dataTable. Here are the two datascrollers I'm using (modified from the datascroller example program in myfaces. There's nothing to it other than this code -- no backing bean support, configuration files, or java code behind it. x:dataScroller id=scroller_controls for=datatable fastStep=10 pageCountVar=pageCount pageIndexVar=pageIndex styleClass=scroller paginator=true paginatorMaxPages=9 paginatorTableClass=paginator paginatorActiveColumnStyle=font-weight:bold; f:facet name=first h:graphicImage url=/images/arrow-first.gif border=1 / /f:facet f:facet name=last h:graphicImage url=/images/arrow-last.gif border=1 / /f:facet f:facet name=previous h:graphicImage url=/images/arrow-previous.gif border=1 / /f:facet f:facet name=next h:graphicImage url=/images/arrow-next.gif border=1 / /f:facet f:facet name=fastforward h:graphicImage url=/images/arrow-ff.gif border=1 / /f:facet f:facet name=fastrewind h:graphicImage url=/images/arrow-fr.gif border=1 / /f:facet /x:dataScroller x:dataScroller id=scroller_information for=datatable rowsCountVar=rowsCount displayedRowsCountVar=displayedRowsCountVar firstRowIndexVar=firstRowIndex lastRowIndexVar=lastRowIndex pageCountVar=pageCount pageIndexVar=pageIndex h:outputFormat value={0} records found, displaying {1} records, from {2} to {3}. Page {4} / {5} styleClass=standard f:param value=#{rowsCount} / f:param value=#{displayedRowsCountVar} / f:param value=#{firstRowIndex} / f:param value=#{lastRowIndex} / f:param value=#{pageIndex} / f:param value=#{pageCount} / /h:outputFormat /x:dataScroller On 8/9/05, Trevor Griffiths [EMAIL PROTECTED] wrote: Hi, I'm somewhat of a newbie with JSF and I'm attempting to use the data scroller with a data table. I've tried to set a jsp page up in the same way as the example. When the table has more then 10 entries the pagination widget displays correctly. If I select the next page I end up with an empty table display (header only). The widget still displays but the buttons simply refresh the existing empty page. When I set up the jsp the only link that I could see between the table and the scroller(s) was the for parameter which I set to the id of x:datatable The scroller and table are a complete black box to me. I have no idea what's going on inside (and that's the way it should be for a component).
Re: Web designers want to work with there favorite web design tools
You can do this in facelets right now. Shale's Clay will probably also let you do this, but I haven't tried it. These are your best bets at this time. -Mike On 8/9/05, Lindholm, Greg [EMAIL PROTECTED] wrote: My biggest concern (right now) with switching to JSF is having to teach our web designers JSF tags. They want to work in HTML and JavaScript and use there favorite web design tools (e.g. Dreamweaver). They also often have to begin designing the pages and flow etc before any of the application is ready. If our web designers can't use there favorite tools they become significantly less productive and a fair bit cranky. This seems to me like a significant obstacle to adoption. I heard about an HTML template mechanism using Shale (doesn't seem like it's quite ready yet.) I've seen an occasional reference to HTML/JSF templates here without much detail. Can anyone tell me what is available now in the JSF world that will keep the web designers happy and productive? (Are these ready for real use now?) (Sorry for the cross-posting, I posted a similar message to the Struts list regarding Shale but I really wanted to hear what the MyFaces group has to say.)
Re: Web designers want to work with there favorite web design tools
The tapestry approach is the same approach that both Shale Clay and Facelets take. For facelets, take a look at this URL: https://facelets.dev.java.net/nonav/docs/dev/docbook.html#taglib-use-jsfc For Clay, take a look at Tapestry, as I'm pretty sure they're going to use the Tapestry template parser, according to this Shale issue: http://issues.apache.org/bugzilla/show_bug.cgi?id=35839 -Mike On 8/9/05, albartell [EMAIL PROTECTED] wrote: I attended OSCON last week and was introduced to Tapestry, JSF's competitor. Tapestry doesn't have the exact same problems as JSF because instead of creating a whole new line of tags it uses existing HTML tags (i.e. input) and marks them up further by adding new attributes to them. This aids in graphical development for non-JSF compliant editors because the input tag will still render as it should when going into preview mode. Note that there was talk on the Dreamweaver site of having support for JSF in the future. I haven't looked at it in several months, so I don't know the status of it. On my last project I was fortunate enough to have a designer that was looking forward to the challenge of doing JSF in Dreamweaver, and it all worked out. But I know where you are coming from. Aaron Bartell -Original Message- From: Lindholm, Greg [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 09, 2005 2:47 PM To: users@myfaces.apache.org Subject: Web designers want to work with there favorite web design tools My biggest concern (right now) with switching to JSF is having to teach our web designers JSF tags. They want to work in HTML and JavaScript and use there favorite web design tools (e.g. Dreamweaver). They also often have to begin designing the pages and flow etc before any of the application is ready. If our web designers can't use there favorite tools they become significantly less productive and a fair bit cranky. This seems to me like a significant obstacle to adoption. I heard about an HTML template mechanism using Shale (doesn't seem like it's quite ready yet.) I've seen an occasional reference to HTML/JSF templates here without much detail. Can anyone tell me what is available now in the JSF world that will keep the web designers happy and productive? (Are these ready for real use now?) (Sorry for the cross-posting, I posted a similar message to the Struts list regarding Shale but I really wanted to hear what the MyFaces group has to say.)
Re: Saving state with custom UIComponents
Does your custom component have any state to save? If not, I would think that the default UIComponentBase behavior would handle saving state for any facets and children without you needing to do anything further. On 8/10/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Fellow MyFacelings, I have a custom tag (child of UIComponentTagBase) and a custom UIComponent (child of UIComponentBase) . In setProperties of the tag handler, I'm creating a bunch of UIComponents (such as HtmlInputText) and I am adding them as children to the UIComponent . After quite a bit of research, I am still having problems preserving the state of the controls. Can anyone explain the interworking of saveState, restoreState, processSaveState, etc. ? I am already aware of the order in which these are called. Dennis Byrne
Re: Saving state with custom UIComponents
What both Craig and I are saying is that if you do nothing with state saving for a component, by default you'll inherit state saving code for your children. If you define state saving code for your component, then you simply call super.saveState()/restoreState() (like t:aliasBean and t:saveState) in order to inherit this behavior. What you've described below should work to my limited knowledge. I've done something similar in the past, and it's worked for me. However I created the children in the Component's constructor: public RowAndColumnRelationshipsHtmlDataTable() { super(); Application app = getFacesContext().getApplication(); // If this is the first time we've shown the page, create the children and facets. boolean isInitialRequest = getFacesContext().getRenderResponse(); if (isInitialRequest) { addChildrenAndFacets(); } } -Mike On 8/10/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Replies to both of you inline. On 8/10/05, Mike Kienenberger [EMAIL PROTECTED] wrote: Does your custom component have any state to save? If not, I would think that the default UIComponentBase behavior would handle saving state for any facets and children without you needing to do anything further. I simplify my scenario - When the page is first requested, the tag handler is instantiated and setProperties is called. In setProperties I am giving the UIComponent an HtmlInputText child, passing 'foo' to HtmlInputText.setValue(). An input text box with 'foo' is rendered. Because classic tags are recycled, the tag handler is not instantiated on subsequent page requests, setProperties is not called, and 'foo' is lost. A blank input text box is rendered. Perhaps this is a better question: what, if anything, must my UIComponent (a direct decendant of UIComponentBase) do to insure the state of it's child is saved? As long as you either: * Don't override the saveState() and restoreState() methods, or * Call super.saveState() and super.restoreState() appropriately. Still missing something. Looking at myfaces/custom/aliasbean/AliasBean.java, saveState and restoreState both call the super.saveState and super.restoreState . I imagined component persistence to be the opposite - something that is called on the root of the UIComponent tree and cascaded down to every leaf. If such a chain reaction were to start from the leaves, wouldn't those components higher up in the hierarchy be saved and restored more than once? I haven't overidden saveState() or restoreState() ... this time. I am not calling super.saveState() or super.restoreState() ... this time. On past occastions, I have done both ;) On 8/10/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Fellow MyFacelings, I have a custom tag (child of UIComponentTagBase) and a custom UIComponent (child of UIComponentBase) . In setProperties of the tag handler, I'm creating a bunch of UIComponents (such as HtmlInputText) and I am adding them as children to the UIComponent . After quite a bit of research, I am still having problems preserving the state of the controls. Can anyone explain the interworking of saveState, restoreState, processSaveState, etc. ? I am already aware of the order in which these are called. Dennis Byrne
Re: Saving state with custom UIComponents
I can't remember where I learned this methodology. Might have been from Kito's JSF in action book. It does work, though. On 8/10/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Not trying to start an argument on this one, I just have some questions. Wouldn't getRenderResponse always return true at the point in the request processing cycle when UIComponents are created? If so, wouldn't addChildrenAndFacets always be called? If so, wouldn't this mean that the values of the children were being recreated, rather than being restored? Dennis Byrne
Re: A few newbie questions
On 8/11/05, Colin Chalmers [EMAIL PROTECTED] wrote: 1. I have a couple of managed beans in session scope. After making the purchase definate I want to remove them, or reset them in session. Is there a recomended way of doing this or it simply, find them in the context and invoke a reset method clearing all data in that object? Or can I remove the object from facescontext in some way? You can look at using request-scoped beans and the x:saveState component. The x:saveState component will preserve a target (like your bean) so long as the x:saveState component specification for that bean appears on a page. As soon as your user navigates to a page without such an x:saveState component, it'll be lost. 2. I have to show data from several different lists in tabular format, in one table to be exact. I tried 3 seperate dataTables under each other which shows the correct data but looks ugly. Something along the lines of panelgrid with embedded datatable would probably be appropriate but is not giving correct result. I need some help on this one Have your dataTable binding point to a getter method that combines the three lists into one. 3. Is there some way to show a datatable only if the list data being provided is greater than zero or does one have to revert to JSTL to solve this, checking for 0 in an if statement before writing the table? Use the rendered attribute. ie, rendered=#{listDataIsNonEmpty} 4. Is there any way to pass arguments to methods being invoked? I read somewhere that this was a restriction in EL and was not possible. Is that the case? There's a lot of ugly workarounds for this, but there's no direct support for it. You can also use an alternate EL.
Re: x:dataScroller ArithmeticException
You need to add a rows attribute to your dataTable. like rows=10 On 8/11/05, Matthew Pease [EMAIL PROTECTED] wrote: Hi everyone - I'm getting the following exception when trying to use x:dataScroller after a x:dataTable with matching id / for. Am I doing something dumb? Thank you- Matt my scroller: x:dataScroller id=scroll_1 for=data fastStep=10 pageCountVar=pageCount pageIndexVar=pageIndex paginator=true paginatorMaxPages=9 f:facet name=first h:graphicImage url=images/arrow-first.gif border=1 / /f:facet ... (facets snipped) /x:dataScroller my datatable x:dataTable id=tabledata var=item value=#{searchBean.resultList} preserveDataModel=true sortColumn=#{searchBean.sort} sortAscending=#{searchBean.ascending} preserveSort=false My Exception java.lang.ArithmeticException: / by zero at org.apache.myfaces.custom.datascroller.HtmlDataScrollerRenderer.getPageIndex(HtmlDataScrollerRenderer.java:505) at org.apache.myfaces.custom.datascroller.HtmlDataScrollerRenderer.encodeChildren(HtmlDataScrollerRenderer.java:189) at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:329) at javax.faces.webapp.UIComponentTag.encodeChildren(UIComponentTag.java:380) at javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:288) at jsp_servlet.__searchresults._jspService(__searchresults.java:1820) at weblogic.servlet.jsp.JspBase.service(JspBase.java:33) at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:971) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:402) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:305) at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:307) at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:405) at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:280) at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:300) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:110) at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:971) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:402) at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:28) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27) at org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsFilter.java:112) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6356) at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:317) at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118) at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3635) at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2585) at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197) at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
Re: JSF Specs issue: Custom error message for required fields
Alexander Jesse and I have just finished a component that will allow you to use a required validator rather than the required attribute. Lucky you! :) Basically, it's a standard validator, and a requiredValidatorChecker/ component that you add to the bottom of your form. The component goes through the component tree at the apply-request-value and decode value phases and runs the requiredValidator validator on all EditValueHolders that contain one as appropriate. It works great with MyFaces, but I don't know how it'll work with other JSF implementations. MyFaces runs it after it runs all other validators (since it's the last element on the form) and that's not behavior that's guaranteed. I'll probably commit something to sourceforge.net.jsf-comp in an hour or so. And yes, future implementations of JSF should dump the required attribute and make it a standard validator. However, there's going to be issues to be issues with validators that can't handle null or empty values. -Mike On 8/12/05, Marc Fonteijn [EMAIL PROTECTED] wrote: I'm looking for ways to assign a specific error message for required fields. Setting the javax.faces.component.UIInput.REQUIRED isn't a solution because I want a specific message for different fields. I thought of implementing an custom validator (method) and doing my own required check instead of using the required=true tag. Unfortunately this is stated in section 3.5.5 in the JSF Specification 1.1: Unless otherwise specified, components with a null local value cause the validation checking by this Validator to be skipped. If a component should be required to have a non-null value, a component attribute with the name required and the value true must be added to the component in order to enforce this rule. My conclusion is that the only way to enable this behaviour whould be to overwrite the validate method in UIInput in an custom component. You can see what that leads to, you'd have to make a custom implementation of every component that extends UIInput. Real solutions to this issue: - Make the default validation behaviour of UIInput optional in order to be able to write a custom validator that does the empty/null checking. - Implement an additional attribute on UIInput requiredMessage=. Did I miss an alternative solution? Is this a flaw in the specification? Marc. -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Re: saveState mystery
You can also implement the StateHolder interface if that's easier for you than using Serailizable. On 8/12/05, Martin Marinschek [EMAIL PROTECTED] wrote: It does exactly what serialization does - so it goes through the object tree and tries to save it, except you modify this by applying transient to attributes or overwriting the methods for serialization/deserialization of the Bean itself. regards, Martin On 8/12/05, Dennis Byrne [EMAIL PROTECTED] wrote: Sorry to be one of those who ask something they could just do themselves, but does it just recursively crawl an object graph? All my business beans are hibernate proxies, and I would hate for x:saveState to trigger a lazy loading of the entire database. Original message Date: Fri, 12 Aug 2005 08:57:07 +0200 From: Martin Marinschek [EMAIL PROTECTED] Subject: Re: saveState mystery To: MyFaces Discussion users@myfaces.apache.org saveState serializes the property of the bean (or the bean itself) to - depending on your settings for state saving in the web.xml, CLIENT_SIDE or SERVER_SIDE - to the browser or the server session... regards, Martin On 8/12/05, Dennis Byrne [EMAIL PROTECTED] wrote: Thank you for the reply. I take it the @value typically points to a property of a managed bean? I am currently reconstructing an object graph for each request by hammering the DB. Worse, this is in the constructors of the backend beans, rather than bound methods, for some user actions in order to avoid NullPExs that occur when request values are applied to an null object model. I lose navigation options in the event of problems because contructors have no return values. It sounds as though saveState can serialize it? Just curious, where's the bean go? Serialized to the browser, or some place on the file system? Original message Date: Fri, 12 Aug 2005 07:55:20 +0200 From: Mads Henderson [EMAIL PROTECTED] Subject: Re: saveState mystery To: MyFaces Discussion users@myfaces.apache.org x:saveState solves many problems by letting you save the state of a request scope bean between requests. That is, it feels like having a session scope bean as long as you need it. But you don't need to worry about cluttering the session with unused data, As soon as you leave the pages containing the x.savestate, the object is removed. We are using x.savestate all over our website, and has reduced the number of session scope beans to one. That is the object holding the user identification. /madsph On 8/12/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: My shop is standardizing on a CRUD model; the arguments center around request vs. session scope. What does x:saveState do? The javadocs for this element are incredibly informative. http://myfaces.apache.org/tlddoc/tomahawk/ Dennis Byrne Dennis Byrne Dennis Byrne
Re: A few newbie questions
Not really sure. Nested data tables? It's more of a presentation problem than a programming problem. I don't do well in those areas :) On 8/12/05, Colin Chalmers [EMAIL PROTECTED] wrote: Hi Mike, Thx for the answers, I'll be looking into the solutions and trying them out. Certainly the one for x:saveState is going to be very beneficial! However your answer to my dataTable problem still leaves me with a problem. The reason that I split the data up in the first place is because I need to place header text between the different data, specifying the different costs associated with the purchace. see below Travel costs 2-room appartment 340.00 reservation costs 30.00 Total travel costs 370.00 Administration Costs foo1 10.00 foo2 20.00 Insurances foo1 50.00 foo2 60.00 Total costs510.00 Thoughts on this? Colin Mike Kienenberger wrote: On 8/11/05, Colin Chalmers [EMAIL PROTECTED] wrote: 1. I have a couple of managed beans in session scope. After making the purchase definate I want to remove them, or reset them in session. Is there a recomended way of doing this or it simply, find them in the context and invoke a reset method clearing all data in that object? Or can I remove the object from facescontext in some way? You can look at using request-scoped beans and the x:saveState component. The x:saveState component will preserve a target (like your bean) so long as the x:saveState component specification for that bean appears on a page. As soon as your user navigates to a page without such an x:saveState component, it'll be lost. 2. I have to show data from several different lists in tabular format, in one table to be exact. I tried 3 seperate dataTables under each other which shows the correct data but looks ugly. Something along the lines of panelgrid with embedded datatable would probably be appropriate but is not giving correct result. I need some help on this one Have your dataTable binding point to a getter method that combines the three lists into one. 3. Is there some way to show a datatable only if the list data being provided is greater than zero or does one have to revert to JSTL to solve this, checking for 0 in an if statement before writing the table? Use the rendered attribute. ie, rendered=#{listDataIsNonEmpty} 4. Is there any way to pass arguments to methods being invoked? I read somewhere that this was a restriction in EL and was not possible. Is that the case? There's a lot of ugly workarounds for this, but there's no direct support for it. You can also use an alternate EL.
Re: x:dataScroller ArithmeticException
My guess is your backing bean containing your table data is in request scope, and it no longer contains the data on the following request. You can probably verify that this is the issue by temporarily adding it in as session scope. The real solution is probably to use x:saveState to perserve your request-scoped bean until you no longer need it. On 8/11/05, Matthew Pease [EMAIL PROTECTED] wrote: dur... thanks Mike. Now that it shows the buttons, when I click on Next, it jumps to a page with no data. Any ideas here? Must there be special logic in the backing bean for this to work? Thanks- Matt On 8/11/05, Mike Kienenberger [EMAIL PROTECTED] wrote: You need to add a rows attribute to your dataTable. like rows=10 On 8/11/05, Matthew Pease [EMAIL PROTECTED] wrote: Hi everyone - I'm getting the following exception when trying to use x:dataScroller after a x:dataTable with matching id / for. Am I doing something dumb? Thank you- Matt my scroller: x:dataScroller id=scroll_1 for=data fastStep=10 pageCountVar=pageCount pageIndexVar=pageIndex paginator=true paginatorMaxPages=9 f:facet name=first h:graphicImage url=images/arrow-first.gif border=1 / /f:facet ... (facets snipped) /x:dataScroller my datatable x:dataTable id=tabledata var=item value=#{searchBean.resultList} preserveDataModel=true sortColumn=#{searchBean.sort} sortAscending=#{searchBean.ascending} preserveSort=false My Exception java.lang.ArithmeticException: / by zero at org.apache.myfaces.custom.datascroller.HtmlDataScrollerRenderer.getPageIndex(HtmlDataScrollerRenderer.java:505) at org.apache.myfaces.custom.datascroller.HtmlDataScrollerRenderer.encodeChildren(HtmlDataScrollerRenderer.java:189) at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:329) at javax.faces.webapp.UIComponentTag.encodeChildren(UIComponentTag.java:380) at javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:288) at jsp_servlet.__searchresults._jspService(__searchresults.java:1820) at weblogic.servlet.jsp.JspBase.service(JspBase.java:33) at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:971) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:402) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:305) at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:307) at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:405) at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:280) at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:300) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:110) at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:971) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:402) at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:28) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27) at org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsFilter.java:112) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6356) at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:317) at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118) at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3635) at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2585) at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197) at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
Re: x:dataScroller ArithmeticException
Make that t:saveState under the new naming rules. On 8/12/05, Mike Kienenberger [EMAIL PROTECTED] wrote: My guess is your backing bean containing your table data is in request scope, and it no longer contains the data on the following request. You can probably verify that this is the issue by temporarily adding it in as session scope. The real solution is probably to use x:saveState to perserve your request-scoped bean until you no longer need it. On 8/11/05, Matthew Pease [EMAIL PROTECTED] wrote: dur... thanks Mike. Now that it shows the buttons, when I click on Next, it jumps to a page with no data. Any ideas here? Must there be special logic in the backing bean for this to work? Thanks- Matt On 8/11/05, Mike Kienenberger [EMAIL PROTECTED] wrote: You need to add a rows attribute to your dataTable. like rows=10 On 8/11/05, Matthew Pease [EMAIL PROTECTED] wrote: Hi everyone - I'm getting the following exception when trying to use x:dataScroller after a x:dataTable with matching id / for. Am I doing something dumb? Thank you- Matt my scroller: x:dataScroller id=scroll_1 for=data fastStep=10 pageCountVar=pageCount pageIndexVar=pageIndex paginator=true paginatorMaxPages=9 f:facet name=first h:graphicImage url=images/arrow-first.gif border=1 / /f:facet ... (facets snipped) /x:dataScroller my datatable x:dataTable id=tabledata var=item value=#{searchBean.resultList} preserveDataModel=true sortColumn=#{searchBean.sort} sortAscending=#{searchBean.ascending} preserveSort=false My Exception java.lang.ArithmeticException: / by zero at org.apache.myfaces.custom.datascroller.HtmlDataScrollerRenderer.getPageIndex(HtmlDataScrollerRenderer.java:505) at org.apache.myfaces.custom.datascroller.HtmlDataScrollerRenderer.encodeChildren(HtmlDataScrollerRenderer.java:189) at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:329) at javax.faces.webapp.UIComponentTag.encodeChildren(UIComponentTag.java:380) at javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:288) at jsp_servlet.__searchresults._jspService(__searchresults.java:1820) at weblogic.servlet.jsp.JspBase.service(JspBase.java:33) at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:971) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:402) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:305) at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:307) at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:405) at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:280) at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:300) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:110) at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:971) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:402) at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:28) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27) at org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsFilter.java:112) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6356) at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:317) at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118) at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3635) at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2585) at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197) at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
Re: method binding not working correctly
If you post your stripped-down example + the method itself (maybe there's a typo there), we'll probably be better able to suggest something. On 8/12/05, Gregg D Bolinger [EMAIL PROTECTED] wrote: If I strip the page down to only include the 2 buttons (no datatable or any other components on the page), I get the same result. Gregg On 8/12/05, Gregg D Bolinger [EMAIL PROTECTED] wrote: The dataTable's data is fine. Why would that make a difference though? On 8/12/05, Mathias Broekelmann [EMAIL PROTECTED] wrote: Is it possible that the returned list for the datatable contains no values in the decode phase? Regards, Mathias Gregg D Bolinger schrieb: As I stated in my first post, it doesn't matter if it is in request or session. I get the same results. saveState didn't solve the problem and rendered=#{categoryAdmin.updateMode} does resolve to true after the Edit button is pressed. That was clear in my code I posted. Any other ideas? Gregg On 8/12/05, Mathias Broekelmann [EMAIL PROTECTED] wrote: take a look at rendered=#{categoryAdmin.updateMode} which must be true to process the actionlistener when the request is decoded. Save the state of categoryAdmin with t:savestate or make the bean session scope. Hope that helps. Regards, Mathias Gregg D Bolinger schrieb: FYI - the missing # from the actionListener in x:commandButton id=updateButton actionListener={categoryAdmin.update} value=Update rendered=#{categoryAdmin.updateMode}/ was corrected as I was typing in a hurry. The problem still persists. Thanks for any help. And I am using MyFaces 1.0.9. Using the latest nightly snapshot did not resolve this issue either. Gregg On 8/11/05, Gregg D Bolinger [EMAIL PROTECTED] wrote: I'm not sure if this is an issue with MyFaces or with how I am doing what I am doing or what. I have a very simple page with a a dataTable. I am wanting to edit the data in the dataTable inline. That is to say, not navigating to a seperate page. I have it setup with an edit button for each item and when that button is pressed I render inputText components and an update button for the associated row. This works. The problem is that the update button's actionListener method binding isn't working. When I press the update button, nothing happens. The update(ActionEvent event) method is never called. It doesn't matter if the bean is in the session or request. It just doesn't call the method. I have stripped the code down to the simplest working example that demonstrates this problem which I will post below. As it is right now, I am merely showing and hiding the update/edit buttons. When I press Edit the edit method is being called and the update button is rendered where the edit button is now not rendered. If I hit update button, the update method is never called and the edit button is displayed again, hiding the update button. I realize that with each button press a new request is being sent to the server. However, it JSF is supposed to save the state of the bean for actionListeners since it does not navigate from the page. However, I don't believe this is working correctly. Any ideas? Thanks. f:view html headtitleSimple jsp page/title/head body jsp:include page=includes/admin_header.jsp/ h:form x:dataTable var=cat binding=#{categoryAdmin.categoryData} value=#{categoryAdmin.categoryList} border=1 forceIdIndex=#{cat.categoryId} h:column f:facet name=header h:outputText value=Description / /f:facet h:outputText value=#{cat.description}/ /h:column h:column f:facet name=header h:outputText value=Cost/ /f:facet h:outputText value=#{cat.cost}/ /h:column h:column x:commandButton id=editButton actionListener=#{categoryAdmin.edit} value=Edit rendered=#{not categoryAdmin.updateMode} / x:commandButton id=updateButton actionListener={categoryAdmin.update} value=Update rendered=#{categoryAdmin.updateMode}/ /h:column h:column x:commandButton actionListener=#{categoryAdmin.delete} value=Delete/ /h:column /x:dataTable f:verbatimbr//f:verbatim h:panelGrid columns=2 border=1 h:outputText value=Description/ h:inputText value=#{categoryAdmin.category.description} / h:outputText value=Cost/ h:inputText value=#{categoryAdmin.category.cost}/ h:commandButton actionListener=#{categoryAdmin.add} value=Save/ h:commandButton actionListener=#{categoryAdmin.cancel} value=Cance/ /h:panelGrid /h:form /body /html
Re: method binding not working correctly
Some things to try: What happens if you use an h:commandButton instead? What happens if you dump the render statement? Is #{not categoryAdmin.updateMode} legal? I've always used ! to this point. On 8/12/05, Gregg D Bolinger [EMAIL PROTECTED] wrote: No problem. Here it is. %@ taglib uri=http://java.sun.com/jsf/html; prefix=h% %@ taglib uri=http://java.sun.com/jsf/core; prefix=f% %@ taglib uri=http://myfaces.apache.org/extensions; prefix=x% f:view html headtitleSimple jsp page/title/head body h:form x:commandButton id=editButton actionListener=#{categoryAdmin.edit} value=Edit rendered=#{not categoryAdmin.updateMode} / x:commandButton id=updateButton actionListener=#{categoryAdmin.update} value=Update rendered=#{categoryAdmin.updateMode}/ /h:form /body /html /f:view public class CategoryAdmin extends BaseBean { private boolean updateMode = false; public boolean isUpdateMode() { return updateMode; } public void setUpdateMode(boolean updateMode) { this.updateMode = updateMode; } public void edit(ActionEvent event){ System.out.println(Edit); setUpdateMode(true); } public void update(ActionEvent event){ System.out.println(Updating); } } On 8/12/05, Mike Kienenberger [EMAIL PROTECTED] wrote: If you post your stripped-down example + the method itself (maybe there's a typo there), we'll probably be better able to suggest something. On 8/12/05, Gregg D Bolinger [EMAIL PROTECTED] wrote: If I strip the page down to only include the 2 buttons (no datatable or any other components on the page), I get the same result. Gregg On 8/12/05, Gregg D Bolinger [EMAIL PROTECTED] wrote: The dataTable's data is fine. Why would that make a difference though? On 8/12/05, Mathias Broekelmann [EMAIL PROTECTED] wrote: Is it possible that the returned list for the datatable contains no values in the decode phase? Regards, Mathias Gregg D Bolinger schrieb: As I stated in my first post, it doesn't matter if it is in request or session. I get the same results. saveState didn't solve the problem and rendered=#{categoryAdmin.updateMode} does resolve to true after the Edit button is pressed. That was clear in my code I posted. Any other ideas? Gregg On 8/12/05, Mathias Broekelmann [EMAIL PROTECTED] wrote: take a look at rendered=#{categoryAdmin.updateMode} which must be true to process the actionlistener when the request is decoded. Save the state of categoryAdmin with t:savestate or make the bean session scope. Hope that helps. Regards, Mathias Gregg D Bolinger schrieb: FYI - the missing # from the actionListener in x:commandButton id=updateButton actionListener={categoryAdmin.update} value=Update rendered=#{categoryAdmin.updateMode}/ was corrected as I was typing in a hurry. The problem still persists. Thanks for any help. And I am using MyFaces 1.0.9. Using the latest nightly snapshot did not resolve this issue either. Gregg On 8/11/05, Gregg D Bolinger [EMAIL PROTECTED] wrote: I'm not sure if this is an issue with MyFaces or with how I am doing what I am doing or what. I have a very simple page with a a dataTable. I am wanting to edit the data in the dataTable inline. That is to say, not navigating to a seperate page. I have it setup with an edit button for each item and when that button is pressed I render inputText components and an update button for the associated row. This works. The problem is that the update button's actionListener method binding isn't working. When I press the update button, nothing happens. The update(ActionEvent event) method is never called. It doesn't matter if the bean is in the session or request. It just doesn't call the method. I have stripped the code down to the simplest working example that demonstrates this problem which I will post below. As it is right now, I am merely showing and hiding the update/edit buttons. When I press Edit the edit method is being called and the update button is rendered where the edit button is now not rendered. If I hit update button, the update method is never called and the edit button is displayed again, hiding the update button. I realize that with each button press a new request is being sent to the server. However, it JSF is supposed to save the state of the bean for actionListeners since it does not navigate from the page. However, I don't believe this is working correctly. Any ideas? Thanks
Re: method binding not working correctly
The difference is that showNext doesn't depend on values in the request-scoped bean. It depends on values in the component tree (which is the same as adding a value to the component tree using t:saveState). On 8/12/05, Gregg D Bolinger [EMAIL PROTECTED] wrote: Ok, I've been doing a little bit more research and I don't think it's as simple as it doesn't work that way. I was going through JSF In Action looking for something else and ran across this example. You'll have to forgive the crappy formatting. I copied this from the PDF. However, if you'll notice, the bean is in request scope. There are previous and next buttons that are rendered depedning on if there are records before or after the current index. They use method binding to actionListener methods in the backing bean. So according to the statements from you this shouldn't work either. But I know it does. managed-bean descriptionPages through history list./description managed-bean-nameshowHistoryBean/managed-bean-name managed-bean-class org.jia.ptrack.web.ShowHistoryBean /managed-bean-class managed-bean-scoperequest/managed-bean-scope managed-property property-namerowsPerPage/property-name value3/value /managed-property managed-property property-namevisit/property-name value#{sessionScope.visit}/value /managed-property managed-property property-nameprojectCoordinator/property-name value#{applicationScope.projectCoordinator}/value /managed-property managed-property property-namestatusCoordinator/property-name value#{applicationScope.statusCoordinator}/value /managed-property managed-property property-nameuserCoordinator/property-name value#{applicationScope.userCoordinator}/value /managed-property /managed-bean h:dataTable cellpadding=5 styleClass=table-background value=#{showHistoryBean.currentProjectHistory} var=operation binding=#{showHistoryBean.historyDataTable} rows=#{showHistoryBean.rowsPerPage} h:column h:panelGrid columns=1 width=100% border=1 styleClass=table-even-row ... h:outputText value=#{operation.timestamp} f:convertDateTime dateStyle=full timeStyle=short/ /h:outputText h:outputText value=#{operation.fromStatus} - #{operation.toStatus}/ h:outputText value=(#{operation.user.role})/ ... h:outputText value=Comments:/ h:outputText value=#{operation.comments} styleClass=project-data/ ... /h:panelGrid /h:column f:facet name=footer h:panelGroup h:commandLink actionListener=#{showHistoryBean.previous} rendered=#{showHistoryBean.showPrevious} style=padding-right: 5px; h:outputText value=Previous/ /h:commandLink h:commandLink actionListener=#{showHistoryBean.next} rendered=#{showHistoryBean.showNext} h:outputText value=Next/ /h:commandLink /h:panelGroup /f:facet /h:dataTable public class ShowHistoryBean extends BaseBean { private int rowsPerPage = 5; private UIData historyDataTable; public ShowHistoryBean() { } public UIData getHistoryDataTable() { return historyDataTable; } public void setHistoryDataTable(UIData historyDataTable) { this.historyDataTable = historyDataTable; } public int getRowsPerPage() { return rowsPerPage; } public void setRowsPerPage(int rowsPerPage) { this.rowsPerPage = rowsPerPage; } public List getCurrentProjectHistory() { return getVisit().getCurrentProject().getHistory(); } public boolean getShowNext() { return (historyDataTable.getFirst() + rowsPerPage) getCurrentProjectHistory().size(); } public boolean getShowPrevious() { return (historyDataTable.getFirst()— rowsPerPage) = 0; } public void next(ActionEvent actionEvent) { int newFirst = historyDataTable.getFirst() + rowsPerPage; if (newFirst getCurrentProjectHistory().size()) { historyDataTable.setFirst(newFirst); } } public void previous(ActionEvent actionEvent) { int newFirst = historyDataTable.getFirst() - rowsPerPage; if (newFirst = 0) { historyDataTable.setFirst(newFirst); } } } On 8/12/05, Martin Marinschek [EMAIL PROTECTED] wrote: You are welcome! regards, Martin On 8/12/05, Gregg D Bolinger [EMAIL PROTECTED] wrote: BTW - I used saveState for the updateMode and it works good. I can't think you all enough for digging through this for me. Gregg On 8/12/05, Gregg D Bolinger [EMAIL PROTECTED] wrote: Ok guys. Thanks for the help, although it wasn't what I was looking for. I really appriciate it. I'll look into using saveState to fix my issue. I really don't want this in session scope because when I come back to the page, it requires too much cleanup. Thanks again. Gregg On 8/12/05, Mike Kienenberger [EMAIL PROTECTED] wrote: If you create the bean request scope, the value of rendered for your update button is always false, from what code you've posted. So even though it was true long enough to draw the button on your html response, it's now out of sync when you resubmit a request. Your html treats it as if it were
Re: method binding not working correctly
Yeah, it's really kinda strange that JSF didn't ship with a component tree scope. All the components fall into this scope automatically, so it's a bit silly that the backing beans can't be configured the same way. On the other hand, t:saveState is incredibly flexible, and we might not have seen that component developed if there had been a component scope. On 8/12/05, Gregg D Bolinger [EMAIL PROTECTED] wrote: A, ok. I see now. Thanks. Gregg On 8/12/05, Mike Kienenberger [EMAIL PROTECTED] wrote: The difference is that showNext doesn't depend on values in the request-scoped bean. It depends on values in the component tree (which is the same as adding a value to the component tree using t:saveState). On 8/12/05, Gregg D Bolinger [EMAIL PROTECTED] wrote: Ok, I've been doing a little bit more research and I don't think it's as simple as it doesn't work that way. I was going through JSF In Action looking for something else and ran across this example. You'll have to forgive the crappy formatting. I copied this from the PDF. However, if you'll notice, the bean is in request scope. There are previous and next buttons that are rendered depedning on if there are records before or after the current index. They use method binding to actionListener methods in the backing bean. So according to the statements from you this shouldn't work either. But I know it does. managed-bean descriptionPages through history list./description managed-bean-nameshowHistoryBean/managed-bean-name managed-bean-class org.jia.ptrack.web.ShowHistoryBean /managed-bean-class managed-bean-scoperequest/managed-bean-scope managed-property property-namerowsPerPage/property-name value3/value /managed-property managed-property property-namevisit/property-name value#{sessionScope.visit}/value /managed-property managed-property property-nameprojectCoordinator/property-name value#{applicationScope.projectCoordinator}/value /managed-property managed-property property-namestatusCoordinator/property-name value#{applicationScope.statusCoordinator}/value /managed-property managed-property property-nameuserCoordinator/property-name value#{applicationScope.userCoordinator}/value /managed-property /managed-bean h:dataTable cellpadding=5 styleClass=table-background value=#{showHistoryBean.currentProjectHistory} var=operation binding=#{showHistoryBean.historyDataTable} rows=#{showHistoryBean.rowsPerPage} h:column h:panelGrid columns=1 width=100% border=1 styleClass=table-even-row ... h:outputText value=#{operation.timestamp} f:convertDateTime dateStyle=full timeStyle=short/ /h:outputText h:outputText value=#{operation.fromStatus} - #{operation.toStatus}/ h:outputText value=(#{operation.user.role})/ ... h:outputText value=Comments:/ h:outputText value=#{operation.comments} styleClass=project-data/ ... /h:panelGrid /h:column f:facet name=footer h:panelGroup h:commandLink actionListener=#{showHistoryBean.previous} rendered=#{showHistoryBean.showPrevious} style=padding-right: 5px; h:outputText value=Previous/ /h:commandLink h:commandLink actionListener=#{showHistoryBean.next} rendered=#{showHistoryBean.showNext} h:outputText value=Next/ /h:commandLink /h:panelGroup /f:facet /h:dataTable public class ShowHistoryBean extends BaseBean { private int rowsPerPage = 5; private UIData historyDataTable; public ShowHistoryBean() { } public UIData getHistoryDataTable() { return historyDataTable; } public void setHistoryDataTable(UIData historyDataTable) { this.historyDataTable = historyDataTable; } public int getRowsPerPage() { return rowsPerPage; } public void setRowsPerPage(int rowsPerPage) { this.rowsPerPage = rowsPerPage; } public List getCurrentProjectHistory() { return getVisit().getCurrentProject().getHistory(); } public boolean getShowNext() { return (historyDataTable.getFirst() + rowsPerPage) getCurrentProjectHistory().size(); } public boolean getShowPrevious() { return (historyDataTable.getFirst()— rowsPerPage) = 0; } public void next(ActionEvent actionEvent) { int newFirst = historyDataTable.getFirst() + rowsPerPage; if (newFirst getCurrentProjectHistory().size()) { historyDataTable.setFirst(newFirst); } } public void previous(ActionEvent actionEvent) { int newFirst = historyDataTable.getFirst() - rowsPerPage; if (newFirst = 0) { historyDataTable.setFirst(newFirst); } } } On 8/12/05, Martin Marinschek [EMAIL PROTECTED] wrote: You are welcome! regards, Martin On 8/12/05, Gregg D Bolinger [EMAIL PROTECTED] wrote: BTW - I used saveState for the updateMode and it works good. I can't think you all
Switching from a javascript-triggered HtmlCommandButton to HtmlCommandLink
I've got a number of controls that trigger a hidden refresh CommandButton when the value changes (pulldowns, primarily). I've been using: script language=javascript // ![CDATA[ function pulldownChanged(){ document.getElementById(form:refreshButton).click(); } // ]] /script where form:refreshButton is a CommandButton. Now I need to switch from a CommandButton to a CommandLink so I can add some f:param attributes to the request. Unfortunately, it doesn't seem to be a matter of just pointing the javascript at the new UICommand. Is there something different I need to do to activate a JSF-backed link? Thanks, -Mike
Re: Displaying Error Messages
You can either use null to specify a global error message, or you can set a binding on your elementForm:elementTable so that's it's available as a UIComponent element to your backing bean. Once you've set up a binding, you can get the client id that way. h:dataTable id=elementTable binding=#{page.elementTableUIComponent} facesContext.addMessage(elementTableUIComponent.getClientId(facesContext), new FacesMessage(... On 8/15/05, Balaji Saranathan [EMAIL PROTECTED] wrote: Hi, I'm trying to understand how to display error messages that are indication of some exception cases in the Backing Bean. There is no validation involved, but I would like to show up an error message telling the user that a Delete action on the table row has failed. I use the FacesContext.addMessage - but this takes the clientID as the argument. Is it always necessary to harcode this id in the Backing Bean? My code looks like this h:form id=elementForm h:message for=elementTable showDetail =true showSummary= true errorStyle=color:red / h :dataTable id= elementTable …… And in the handler where the exception is thrown catch (NoObjectFoundException exception) { FacesContext.getCurrentInstance().addMessage(elementForm:elementTable, new FacesMessage(The Object does not exist .Unable to delete the specified row. Please check the \n + logs for detailed error message !!! )); return null; } Thanks Balaji Confidentiality Notice The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain confidential or privileged information. If you are not the intended recipient, please notify the sender at Wipro or [EMAIL PROTECTED] immediately and destroy all copies of this message and any attachments.
t:panelTabbedPane tab change seems to lose some values between tab pages switch
I have a two-panelTab panelTabbedPane in the middle of my input page. A t:panelTabbedPane tab change seems to lose some values external to the panelTabbedPane component between tab pages switch. For instance, my t:inputCalendar values above it get lost. And the value in an h:inputTextarea below it is sometimes lost, and sometimes shows back up when the tab is changed again. Sometimes the value is lost and doesn't reappear. (but it's completely external to the panelTabbedPane), depending on what other actions I trigger first. The h:inputText fields on the panelTabs do preserve values, however. I'm using today's MyFaces snapshot. -Mike