Avatar billede fredand Forsker
19. februar 2006 - 11:31 Der er 1 løsning

How to use a bodytag inside an other bodytag??

Hello!

I'm trying to use an body tag from Struts inside the body in one of my own body tags.

In my mytags.tld I have specified the tag like:

    <tag>
        <name>TaskFormTag</name>
        <tagclass>attentionizer.taglib.TaskFormTag</tagclass>
        <bodycontent>JSP</bodycontent>
    </tag>

In my JSP-page I use it like:
(code snippet)
<mytags:TaskFormTag>
<table>
    <tr>
        <td></td>
    </tr>
    <tr>
        <td>
            Select task type
        </td>
        <td class="TEXT_VERDANA_BLACK_10">
       
            <html:select property="tasklist">
                <html:options collection="tasks" property="id" labelProperty="name"/>
            </html:select>
        </td>
    </tr>
</table>
</mytags:TaskFormTag>

But when I run it I get this error:
javax.servlet.jsp.JspException: ServletException in '/tiles/product.jsp': Cannot find bean under name org.apache.struts.taglib.html.BEAN
    at org.apache.struts.taglib.tiles.InsertTag$InsertHandler.doEndTag(InsertTag.java:923)


I guess it means that during the evaluation of the body of the tag the tag org.apache.struts.taglib.html.BEAN is not found.

I have also tried to add this line of code inside the body:
<%@ taglib uri="/tags/struts-html" prefix="html" %>

This line is used earlier as well in the code of the jsp-page, but I get the same error.

So if you guys could advise me how to solve it it would be great.

Best regards
Fredrik
Avatar billede fredand Forsker
19. februar 2006 - 18:28 #1
The error was that:
<html:select property="tasklist">
                <html:options collection="tasks" property="id" labelProperty="name"/>
            </html:select>

...needs to be nested inside a form.

Best regards
fredrik
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Kurser inden for grundlæggende programmering

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester