infoglue taglib and evaluation

astik <[email protected]>
Newsgroups gmane.comp.cms.infoglue.devel
Message-ID <[email protected]>
Hi,

I don't know if I'm using the taglib the way it should but i've got  
some issues with some of them
My webapp is a version 2.4 webapp, defined in web.xml :
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance 
" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd 
"
	version="2.4">

i want to use a common:size taglib, i just follow documentation  
example :
	<structure:childPages
		id="level1ChildPages"
		siteNodeId="${home.siteNodeId}"
		hideUnauthorizedPages="true"
	/>
	<common:size id="size" list="${level1ChildPages}" />

Here is the stacktrace :
  [31 août 2009 16:03:59 - Infoglue Deliver Working] ERROR  
(ApplicationDispatcher.java:711) - "Servlet.service()" pour la servlet  
jsp a lancé une exception
javax.servlet.jsp.JspException: An error occurred while evaluating  
custom action attribute "list" with value "level1ChildPages": Attempt  
to convert String "level1ChildPages" to type "java.util.Collection",  
but there is no PropertyEditor for that type (null)
	at org.apache.taglibs.standard.lang.jstl.Evaluator.evaluate 
(Evaluator.java:109)
	at org.apache.taglibs.standard.lang.jstl.Evaluator.evaluate 
(Evaluator.java:129)
	at  
org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager.evaluate 
(ExpressionEvaluatorManager.java:75)
	at org.apache.taglibs.standard.tag.el.core.ExpressionUtil.evalNotNull 
(ExpressionUtil.java:48)
	at org.infoglue.deliver.taglib.AbstractTag.evaluate(AbstractTag.java: 
137)
	at org.infoglue.deliver.taglib.AbstractTag.evaluateCollection 
(AbstractTag.java:179)
	at org.infoglue.deliver.taglib.common.SizeTag.setList(SizeTag.java:84)
	at  
org.apache.jsp.jsp.Template_005fnavigation_005f_002d1288041021_jsp 
._jspx_meth_common_005fsize_005f0 
(Template_005fnavigation_005f_002d1288041021_jsp.java:302)
	at  
org.apache.jsp.jsp.Template_005fnavigation_005f_002d1288041021_jsp 
._jspx_meth_c_005fif_005f0 
(Template_005fnavigation_005f_002d1288041021_jsp.java:263)
	at  
org.apache.jsp.jsp.Template_005fnavigation_005f_002d1288041021_jsp 
._jspService(Template_005fnavigation_005f_002d1288041021_jsp.java:195)
	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
	at org.apache.jasper.servlet.JspServletWrapper.service 
(JspServletWrapper.java:331)
	at org.apache.jasper.servlet.JspServlet.serviceJspFile 
(JspServlet.java:329)
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)

When we look the taglib code we have call to evaluateCollection and  
evaluate which both use ExpressionUtil
Problem is, when i write list="${level1ChildPages}" ,  $ 
{level1ChildPages} is already evaluate and can't be given to the  
taglib setter method.
Is there a way to do it a different way ?

Is the evaluation still necessary ?

Here is the code for the equivalent of common:size :
@SuppressWarnings("unchecked")
public class SizeTag extends AbstractTag {
	/** SerialID */
	private static final long serialVersionUID = 3320090703295471100L;
	private Collection collection;
	private Map map;

	public int doEndTag() throws JspException {
		if (map != null) {
			setResultAttribute(new Integer(map == null ? 0 : map.size()));
		} else if (collection != null) {
			setResultAttribute(new Integer(collection == null ? 0 :  
collection.size()));
		} else {
			throw new JspException("You must set either map or collection  
attribute on kpark:size tag");
		}
		return EVAL_PAGE;
	}

	public void setCollection(final Collection collection) {
		this.collection = collection;
	}

	public void setMap(final Map map) {
		this.map = map;
	}
}

If the evaluation is not necessary anymore, maybe we could create a  
new version of Infoglue taglib : same taglib collection but with a  
different taglib key and without the evaluation. So that, both taglib  
would be available ...



__
Romain
http://blog.astik.info


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.