Hello guys,

I'm using Tiles 2.0.3, with MyFaces 1.1.5 and Tomahawk 1.1.5 into JBoss
4.0.5.
I'm trying to build a h:selectOneMenu, using f:selectItems to define it's
options, like in the following code:

<t:selectOneMenu id="compId" value="#{MyBean.objectId}"
required="true" >
<f:selectItems value="#{MyBean.objectItems}"/>
</t:selectOneMenu>


With the following code for my backingBean, it works fine:

public class MyBean {

   private int objectId = 0;

  private List<SelectItem> objectItems = null;

   public MyBean() throws Exception {
      objectItems = new ArrayList<SelectItem>();
      objectItems.add( new SelectItem( 0, "" ) );
      objectItems.add( new SelectItem( 1, "Object1 ) );
      objectItems.add( new SelectItem( 2, "Object2 ) );
      objectItems.add( new SelectItem( 3, "Object3 ) );
      objectItems.add( new SelectItem( 4, "Object4 ) );
    }

    public List<SelectItem> getObjectItems() {
       return objectItems;
    }

    public int getObjectId() {
       return objectId;
    }

    public void setObjectId(int objectId) {
       this.objectId = objectId;
    }
}



But, if I change the objtecItems initialization, performing a Db search, and
using the results to populate it, like in the following:


public MyBean() throws Exception {
                List<MyObject> objects = dbObject.doSearch();
                    objectItems = new ArrayList<SelectItem>();
                    for( MyObject obj : objects ) {
                      /* obj.getInt() returns an int, and obj.getString()
a String */
                      objectItems.add( new SelectItem( obj.getInt(),
obj.getString() ) );
                    }

}


I got an error when trying to load the page into jboss log:

15:01:03,610 ERROR [[jsp]] Servlet.service() for servlet jsp threw exception
javax.faces.el.EvaluationException: Cannot get value for expression '#{
PalmBatch.varietyItems}'
       at org.apache.myfaces.el.ValueBindingImpl.getValue(
ValueBindingImpl.java:405)
       at javax.faces.component.UISelectItems.getValue(UISelectItems.java
:58)
       at
org.apache.myfaces.shared_tomahawk.util.SelectItemsIterator.hasNext(
SelectItemsIterator.java:105)
       at
org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.internalGetSelectItemList
(RendererUtils.java:450)
       at
org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.getSelectItemList
(RendererUtils.java:428)
       at
org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlRendererUtils.internalRenderSelect
(HtmlRendererUtils.java:294)
       at
org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlRendererUtils.renderMenu
(HtmlRendererUtils.java:267)
       at
org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlMenuRendererBase.encodeEnd
(HtmlMenuRendererBase.java:59)
       at org.apache.myfaces.renderkit.html.ext.HtmlMenuRenderer.encodeEnd(
HtmlMenuRenderer.java:60)
       at javax.faces.component.UIComponentBase.encodeEnd(
UIComponentBase.java:539)
       at
org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.renderChild(
RendererUtils.java:419)

But checking the tiles log, I've got the following exception:
2007-05-30 16:57:18,341 2388021 DEBUG [org.apache.tiles.jsp.context.JspUtil]
(http-0.0.0.0-8180-1:) Unable to execute JSP 2.0 include method.  Trying old
one.
java.lang.reflect.InvocationTargetException
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(
NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.apache.tiles.jsp.context.JspUtil.doInclude(JspUtil.java:82)
       at org.apache.tiles.jsp.context.JspTilesRequestContext.include(
JspTilesRequestContext.java:88)
       at org.apache.tiles.jsp.context.JspTilesRequestContext.dispatch(
JspTilesRequestContext.java:82)
       at org.apache.tiles.impl.BasicTilesContainer.render(
BasicTilesContainer.java:460)

And also the following exception (that I think it's thrown after tiles try
the old include method)

2007-05-30 16:57:18,978 2388658 ERROR [
org.apache.tiles.jsp.context.JspTilesRequestContext] (http-0.0.0.0-8180-1:)
JSPException while including path '/solicLotePalm.jsp'.
javax.servlet.jsp.JspException: ServletException while including page.
       at org.apache.tiles.jsp.context.JspUtil.doInclude(JspUtil.java:98)
       at org.apache.tiles.jsp.context.JspTilesRequestContext.include(
JspTilesRequestContext.java:88)
       at org.apache.tiles.jsp.context.JspTilesRequestContext.dispatch(
JspTilesRequestContext.java:82)
       at org.apache.tiles.impl.BasicTilesContainer.render(
BasicTilesContainer.java:460)
       at org.apache.tiles.jsp.taglib.InsertAttributeTag.render(
InsertAttributeTag.java:141)
       at org.apache.tiles.jsp.taglib.InsertAttributeTag.render(
InsertAttributeTag.java:118)
       at org.apache.tiles.jsp.taglib.RenderTagSupport.execute(
RenderTagSupport.java:172)
       at org.apache.tiles.jsp.taglib.RoleSecurityTagSupport.doEndTag(
RoleSecurityTagSupport.java:76)
       at org.apache.tiles.jsp.taglib.ContainerTagSupport.doEndTag(
ContainerTagSupport.java:82)

I've removed the jsf-libs that comes with jboss, packed all the needed jar
into my .war, and the error is still the same. Someone could give me a hint
on that?

Thanks in advance,
Alexandre
--
Alexandre Corrêa Barbosa
http://mydevelopmentjournal.blogspot.com (meu blog de tecnologia)
http://log4dev.wordpress.com (blog de tecnologia de Miguel Galves, onde sou
colaborador)

Reply via email to