If I had a managed bean as follows:
@ManagedBean
@RequestSchoped
public class Example {
private List<String> stringList;
private List<Long> longList;
// getters, setters, etc. down here
}
and had a custom component which accepted a List as an attribute:
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:cc="http://java.sun.com/jsf/composite"
xmlns:h="http://java.sun.com/jsf/html">
<!-- INTERFACE -->
<cc:interface>
<cc:attribute name="aList" type="java.util.List" />
</cc:interface>
<cc:implementation>
<!-- code is in here -->
</cc:implementation>
</html>
How could I make sure that this worked:
<myComp:previousComponent aList="#{example.stringList}" />
but this didn't:
<myComp:previousComponent aList="#{example.longList}" />
In other words, what I want to do for the cc:attribute
is as follows:
<cc:attribute name="aList" type="java.util.List<java.lang.String>" />
However, as we know xhtml doesn't take kindly to using > or <. Also, with Generics only being checked at compile time, I'm not sure how this would be done. Does anyone know if this is possible?