You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Janne Mattila <ja...@hotmail.com> on 2004/08/16 15:59:56 UTC

Tiles breaks my page that uses logic:iterate

I have a simple page for editing some form properties. It works. There's a 
select box, a multibox, single-select select and a text input field. Now I 
tried to "Tiles-ify" it, just using Tiles to add some silly decorations 
around the actual form. Using tiles seems to break the form, the exception I 
get is

16:49:43,714 ERROR [Engine] ----- Root Cause -----
javax.servlet.ServletException: Cannot find bean choice in any scope
        at 
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:533)
        at 
org.apache.jsp.inputs_0002dcontent_jsp._jspService(inputs_0002dcontent_jsp.java:103)
        at 
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at 
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:210)
        at 
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at 
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
        at 
org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:575)
        at 
org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:498)
        at 
org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:822)
        at 
org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:398)
        at 
org.apache.struts.tiles.TilesUtilImpl.doInclude(TilesUtilImpl.java:137)
        at org.apache.struts.tiles.TilesUtil.doInclude(TilesUtil.java:177)
        at 
org.apache.struts.taglib.tiles.InsertTag.doInclude(InsertTag.java:756)
        at 
org.apache.struts.taglib.tiles.InsertTag$InsertHandler.doEndTag(InsertTag.java:881)
        at 
org.apache.struts.taglib.tiles.InsertTag.doEndTag(InsertTag.java:473)
        at 
org.apache.jsp.template_jsp._jspx_meth_tiles_insert_1(template_jsp.java:197)
        at 
org.apache.jsp.template_jsp._jspx_meth_html_html_0(template_jsp.java:109)
        at org.apache.jsp.template_jsp._jspService(template_jsp.java:63)
        at 
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at 
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:210)
        at 
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at 
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
        at 
org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:575)
        at 
org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:498)
        at 
org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:822)
        at 
org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:398)
        at 
org.apache.struts.tiles.TilesUtilImpl.doInclude(TilesUtilImpl.java:137)
        at org.apache.struts.tiles.TilesUtil.doInclude(TilesUtil.java:177)
        at 
org.apache.struts.taglib.tiles.InsertTag.doInclude(InsertTag.java:756)
        at 
org.apache.struts.taglib.tiles.InsertTag$InsertHandler.doEndTag(InsertTag.java:881)
        at 
org.apache.struts.taglib.tiles.InsertTag.doEndTag(InsertTag.java:473)
        at 
org.apache.jsp.inputs_jsp._jspx_meth_tiles_insert_0(inputs_jsp.java:99)
        at org.apache.jsp.inputs_jsp._jspService(inputs_jsp.java:57)

the JSP page for the form looks like:

<html:form action="/TilesSaveInputs" onsubmit="return 
validateInputsForm(this);">

  <bean:write name="inputsForm" property="counter" /><br>
  <html:hidden property="counter" />

  <p>Select + optionsCollection:<br>

  <html:select property="selectedChoicesForSelect" multiple="true" size="5">
  	<html:optionsCollection property="allChoices" value="key" label="name"/>
  </html:select><br>

  <p>Multibox:<br>
  <!-- THE FOLLOWING BREAKS THE PAGE -->

  <logic:iterate id="choice" name="inputsForm" property="allChoices">
    <html:multibox property="selectedChoicesForMultibox">
      <bean:write name="choice" property="key"/>
    </html:multibox>
    <bean:write name="choice" property="name"/><br>
  </logic:iterate>

  <p>Single select + optionsCollection:<br>

  <html:select property="selectedChoiceForSingleSelect">
  	<html:optionsCollection property="allChoices" value="key" label="name"/>
  </html:select><br>

  <p>Plain text field, validated using validator<br>
  e-mail:<html:text property="text"/><br>

  <p>
  <html:link action="/Start.do">Back</html:link><br>

  <p>
  <html:submit/>
</html:form>

The part which breaks the page is the multibox, it's iterator and use of 
iterator's choice object. If I take that part out the page works fine with 
Tiles, I can make the selections etc.

The page works fine also with the multibox as long as I do not use Tiles. 
With tiles I use the same Actions, JSP code for forming the output is 
straight copy-paste, there's no difference with the action definitions in 
struts-config.xml. The only difference is the use of Tiles. I wonder what 
about Tiles causes this to break?

_________________________________________________________________
Add photos to your e-mail with MSN 8. Get 2 months FREE*. 
http://join.msn.com/?page=features/featuredemail


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Tiles breaks my page that uses logic:iterate

Posted by Niall Pemberton <ni...@blueyonder.co.uk>.
I'm guessing you changed the action your form is pointing to
("/TilesSaveInputs") - so is the form name still "inputsForm"?

 ---->  <logic:iterate id="choice" name="inputsForm" property="allChoices">

Niall

----- Original Message ----- 
From: "Janne Mattila" <ja...@hotmail.com>
To: <us...@struts.apache.org>
Sent: Monday, August 16, 2004 2:59 PM
Subject: Tiles breaks my page that uses logic:iterate


> I have a simple page for editing some form properties. It works. There's a
> select box, a multibox, single-select select and a text input field. Now I
> tried to "Tiles-ify" it, just using Tiles to add some silly decorations
> around the actual form. Using tiles seems to break the form, the exception
I
> get is
>
> 16:49:43,714 ERROR [Engine] ----- Root Cause -----
> javax.servlet.ServletException: Cannot find bean choice in any scope
>         at
>
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImp
l.java:533)
>         at
>
org.apache.jsp.inputs_0002dcontent_jsp._jspService(inputs_0002dcontent_jsp.j
ava:103)
>         at
> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>         at
>
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:2
10)
>         at
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
>         at
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>         at
>
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.
java:684)
>         at
>
org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatch
er.java:575)
>         at
>
org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher
.java:498)
>         at
>
org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:8
22)
>         at
>
org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:398)
>         at
> org.apache.struts.tiles.TilesUtilImpl.doInclude(TilesUtilImpl.java:137)
>         at org.apache.struts.tiles.TilesUtil.doInclude(TilesUtil.java:177)
>         at
> org.apache.struts.taglib.tiles.InsertTag.doInclude(InsertTag.java:756)
>         at
>
org.apache.struts.taglib.tiles.InsertTag$InsertHandler.doEndTag(InsertTag.ja
va:881)
>         at
> org.apache.struts.taglib.tiles.InsertTag.doEndTag(InsertTag.java:473)
>         at
>
org.apache.jsp.template_jsp._jspx_meth_tiles_insert_1(template_jsp.java:197)
>         at
> org.apache.jsp.template_jsp._jspx_meth_html_html_0(template_jsp.java:109)
>         at org.apache.jsp.template_jsp._jspService(template_jsp.java:63)
>         at
> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>         at
>
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:2
10)
>         at
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
>         at
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>         at
>
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.
java:684)
>         at
>
org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatch
er.java:575)
>         at
>
org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher
.java:498)
>         at
>
org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:8
22)
>         at
>
org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:398)
>         at
> org.apache.struts.tiles.TilesUtilImpl.doInclude(TilesUtilImpl.java:137)
>         at org.apache.struts.tiles.TilesUtil.doInclude(TilesUtil.java:177)
>         at
> org.apache.struts.taglib.tiles.InsertTag.doInclude(InsertTag.java:756)
>         at
>
org.apache.struts.taglib.tiles.InsertTag$InsertHandler.doEndTag(InsertTag.ja
va:881)
>         at
> org.apache.struts.taglib.tiles.InsertTag.doEndTag(InsertTag.java:473)
>         at
> org.apache.jsp.inputs_jsp._jspx_meth_tiles_insert_0(inputs_jsp.java:99)
>         at org.apache.jsp.inputs_jsp._jspService(inputs_jsp.java:57)
>
> the JSP page for the form looks like:
>
> <html:form action="/TilesSaveInputs" onsubmit="return
> validateInputsForm(this);">
>
>   <bean:write name="inputsForm" property="counter" /><br>
>   <html:hidden property="counter" />
>
>   <p>Select + optionsCollection:<br>
>
>   <html:select property="selectedChoicesForSelect" multiple="true"
size="5">
>   <html:optionsCollection property="allChoices" value="key" label="name"/>
>   </html:select><br>
>
>   <p>Multibox:<br>
>   <!-- THE FOLLOWING BREAKS THE PAGE -->
>
>   <logic:iterate id="choice" name="inputsForm" property="allChoices">
>     <html:multibox property="selectedChoicesForMultibox">
>       <bean:write name="choice" property="key"/>
>     </html:multibox>
>     <bean:write name="choice" property="name"/><br>
>   </logic:iterate>
>
>   <p>Single select + optionsCollection:<br>
>
>   <html:select property="selectedChoiceForSingleSelect">
>   <html:optionsCollection property="allChoices" value="key" label="name"/>
>   </html:select><br>
>
>   <p>Plain text field, validated using validator<br>
>   e-mail:<html:text property="text"/><br>
>
>   <p>
>   <html:link action="/Start.do">Back</html:link><br>
>
>   <p>
>   <html:submit/>
> </html:form>
>
> The part which breaks the page is the multibox, it's iterator and use of
> iterator's choice object. If I take that part out the page works fine with
> Tiles, I can make the selections etc.
>
> The page works fine also with the multibox as long as I do not use Tiles.
> With tiles I use the same Actions, JSP code for forming the output is
> straight copy-paste, there's no difference with the action definitions in
> struts-config.xml. The only difference is the use of Tiles. I wonder what
> about Tiles causes this to break?
>
> _________________________________________________________________
> Add photos to your e-mail with MSN 8. Get 2 months FREE*.
> http://join.msn.com/?page=features/featuredemail
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org