-
1. Re: Can <s:validate> be used with facelets compositions?
pmuir Jul 20, 2006 8:24 AM (in response to phicorp)I've raised this before and there didn't seem to be much interest in fixing it. I modified the ModelValidator class to take a property attribute. If the property attribute is supplied it is used instead of the value attribute. I also use the 'property' as the key for localised labels for fields and as an id for attaching messages.
E.g.<p:myTag fieldValue="#{user.name}" property="user.name"/>
<ui:composition> <h:inputText value="#{fieldValue}"> <p:validate property="#{property}" /> </h:inputText> </ui:composition>
See http://jroller.com/page/pmuir?entry=modelvalidator -
2. Re: Can <s:validate> be used with facelets compositions?
phicorp Jul 20, 2006 6:33 PM (in response to phicorp)Getting a permanent long-term solution into the Seam codebase is a great solution, but for me patches outside the Seam codebase are not a solution.
Are we sure that there is no way around the problem without changing Seam? -
3. Re: Can <s:validate> be used with facelets compositions?
pmuir Jul 21, 2006 4:54 AM (in response to phicorp)AFACIS no. The ModelValidator in Seam uses ValueBinding.getExpressionString() to work out the seamComponent.property (i.e. getName() on the seam component user) and hence get the validator to use. When using a facelets source tag the ExpressionString is not a seamComponent.property but 'fieldValue' (which has no validator attached). There is no way (AFAIK) of working up the chain of EL expressions to get the root one.
(Btw. My solution isn't really a patch, just a replacement component, so rather than doing s:validate you do model:validate. There is no patching of Seam source required, just adding another jar to the library directory.) -
4. Re: Can <s:validate> be used with facelets compositions?
phicorp Jul 26, 2006 7:21 AM (in response to phicorp)Thanks for your reply and I will think about what you said.
Nevertheless I wish that the main Seam players recognised the importance of the issue we are discussing, as I don't think that anyone using facelets would give up its composition facilities in order to use <s:validate>. -
5. Re: Can <s:validate> be used with facelets compositions?
pmuir Jul 26, 2006 7:52 AM (in response to phicorp)There was some discussion on the facelets list a couple of days ago about this. A couple of possibilities were mentioned, and Jacob Hookom said that he hoped that future versions of EL would allow this to work. When I have a moment I will see if I can get either of the possibilities to work.
-
6. Re: Can <s:validate> be used with facelets compositions?
gavin.king Jul 26, 2006 1:24 PM (in response to phicorp)Nevertheless I wish that the main Seam players recognised the importance of the issue we are discussing, as I don't think that anyone using facelets would give up its composition facilities in order to use <s:validate>.
AFAICT, this is not a limitation of Seam but a limitation of Facelets, and so there is nothing much I can do about it.