-
1. Re: custom component: using c:foreach in the template
nbelaevski Jan 31, 2010 6:57 PM (in response to looseleaf)I've copied your code and got the following correct statements:
Collection com_1 = (Collection)getStatesT(); for (Iterator iter = com_1 .iterator(); iter.hasNext();) { variables.setVariable("stateT", iter.next()); writer.writeText(convertToString(variables.getVariable("stateT")),null); }
It seems that "#{this:getStatesT()}" expression is not resolved correctly - can you please try defining separate variable via cdk:object tag to check this?
-
2. Re: custom component: using c:foreach in the template
looseleaf Feb 1, 2010 3:58 PM (in response to nbelaevski)Thanks for checking Nick!
{code:XML}
<c:object var="statesT" type="java.util.ArrayList" value="#{this:getStatesT()}" />
{code}
results in
{code:Java}
java.util.ArrayList statesT = getStatesT() ;
{code}
But using{code:xml}
<c:forEach var="stateT" items="#{statesT}">
#{stateT}
</c:forEach>
{code}
still produces
{code:Java}
for (
variables.setVariable("stateT", $from);
Integer.getInteger(variables.getVariable("stateT").toString()).intValue() < Integer.getInteger($to).toString()).intValue();
variables.addValueToVariable("stateT", new Integer(1) )
) {
writer.writeText(convertToString(variables.getVariable("stateT")),null);
{code}
Hm. We're using the RichFaces 3.3.2GA libraries and CDK, if that matters.
Ahhh, stupid - what's the correct namespace for the CDK tags as described in chapter 10 of the CDK developer guide? The namespace is not mentioned there. And it's probably not http://java.sun.com/jsf/core, which the c: prefix is used in our component. Is it?
Stefan
-
3. Re: custom component: using c:foreach in the template
looseleaf Feb 2, 2010 11:31 AM (in response to looseleaf)I searched the Richfaces SVN and found the implementation of "columns". The namespace there is xmlns:c="http://java.sun.com/jstl/core".
I tried that, no effect.
After taking a look at the CDK guide again, I simply tried returning a comma separated string, which should work as well:
{code:xml}
<?xml version="1.0" encoding="UTF-8"?>
<f:root
xmlns:f="http://ajax4jsf.org/cdk/template"
xmlns:c="http://java.sun.com/jstl/core"
xmlns:ui=" http://ajax4jsf.org/cdk/ui"
xmlns:u=" http://ajax4jsf.org/cdk/u"
xmlns:x=" http://ajax4jsf.org/cdk/x"
xmlns:h="http://ajax4jsf.org/cdk/h"
class="at.ac.meduniwien.hno.hnoonconet.faces.renderkit.html.InputTNMRenderer"
baseclass="at.ac.meduniwien.hno.hnoonconet.faces.renderkit.InputTNMRendererBase"
component="at.ac.meduniwien.hno.hnoonconet.faces.component.UIInputTNM"
>
<h:styles>/at/ac/meduniwien/hno/hnoonconet/faces/renderkit/html/css/inputTNM.xcss</h:styles>
<f:clientid var="clientId"/>
<c:object var="statesT" type="java.lang.String" value="#{this:getStatesT()}" />
<c:forEach var="st" items="#{this:getStatesT()}">#{st}
</c:forEach>
<c:forEach var="st" items="statesT">#{st}
</c:forEach>
</f:root>
{code}
and this in my InputTNMRendererBase
{code:Java}public String getStatesT() {
return "0,1,2";
}{code}
Same error as before.
I am becoming desperate with that...
Stefan
p.s.: The AJAX editor doesn't work properly in Firefox 3.0.4 neither...The cursor jumps around at will, when using Home, End and cursor keys. Whoever is responsible for the web forum: Please provide a simple <textarea> for posting messages. Or NNTP, pretty please
-
4. Re: custom component: using c:foreach in the template
looseleaf Feb 3, 2010 4:50 PM (in response to looseleaf)Today I tried using the 3.3.1.GA RichFaces libraries, as it is described in the Richfacses 3.3.2 CDK guide. It didn't work neither
[...]
I made it even simpler:
{code:xml}<c:forEach var="t" items="1,2,3">
#{t}
</c:forEach>{code}
Using xmlns:c="http://java.sun.com/jstl/core" as namespace still produces this output:
{code:Java}for (
variables.setVariable("t", $from);
Integer.getInteger(variables.getVariable("t").toString()).intValue() < Integer.getInteger($to).toString()).intValue();
variables.addValueToVariable("t", new Integer(1) )
)
{code}
Hm....
-
5. Re: custom component: using c:foreach in the template
nbelaevski Feb 3, 2010 5:29 PM (in response to looseleaf)Stefan,
Can you please create small example project, so I'll be able to reproduce the issue locally?
-
6. Re: custom component: using c:foreach in the template
looseleaf Feb 4, 2010 11:43 AM (in response to nbelaevski)OK, I followed the procedure in Chapters 3+4 of the CDK developer guide for version 3.3.2.GA.
The only differences: Sometimes the guide mentions 3.3.1.GA as version (in creating the archetype, and some pom.xml files). I changed those to 3.3.2.GA.
Maven is 2.2.1, Ant is 1.8.0RC1
I attached sandbox.zip which is a rudimentary project followed from the inputDate example but with the actual setup that we're using. I just skipped the UIInputTNM implementation and the RendererBase class apart from the desired ArrayList. And the template is also very basic.
The only changes to the template are the <c:*> elements.
setings.xml is Maven's configuration.
Stefan
-
settings.xml 11.8 KB
-
sandbox.zip 41.4 KB
-
-
7. Re: custom component: using c:foreach in the template
nbelaevski Feb 6, 2010 8:25 AM (in response to looseleaf)Hi Stefan,
Looks like a bug in 3.3.2 CDK. 3.3.3.BETA1 should work ok (you can still use 3.3.3.BETA1 CDK & RF 3.3.2).
-
8. Re: custom component: using c:foreach in the template
looseleaf Feb 6, 2010 2:57 PM (in response to nbelaevski)Thanks for checking, Nick!
Works like a charm with the maven-cdk-plugin 3.3.3.BETA1.
I really appreciate your help.