struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mead Lai <laiqi...@gmail.com>
Subject Re: How to create a costume struts2 tag? any demo?
Date Sat, 09 Oct 2010 13:36:27 GMT
Thank you very much.

JSP file:
<%@taglib prefix="s" uri="/struts-tags" %>
<%@taglib prefix="lab" uri="/lab" %>
<html>
<head>
<title>Hello World</title>
<s:head />
</head>
<body>
    <lab:hello name="Hello_in_Value"  theme="simple"/>
</body>
</html>


TLD file:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library
1.2//EN"
        "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
<taglib>
    <tlib-version>2.2.3</tlib-version>
    <jsp-version>1.2</jsp-version>
    <short-name>lab</short-name>
    <uri>/lab</uri>
    <display-name>"Lab Tags"</display-name>
    <description><![CDATA["lab"]]></description>
    <tag>
        <name>hello</name>
        <tag-class>lab.struts2.taglib.HelloTag</tag-class>
        <body-content>JSP</body-content>
        <description><![CDATA[Render a hello]]></description>
        <attribute>
            <name>id</name>
            <required>false</required>
            <rtexprvalue>false</rtexprvalue>
            <description>
                <![CDATA[id for referencing element]]></description>
        </attribute>
        <attribute>
            <name>name</name>
            <required>true</required>
            <rtexprvalue>false</rtexprvalue>
            <description><![CDATA[ Name]]></description>
        </attribute>
    </tag>
</taglib>



Regards,
Mead


On Sat, Oct 9, 2010 at 9:31 PM, Li Ying <liying.cn.2010@gmail.com> wrote:

> Hi Lai:
>
> The error message looks like the value of the attribute [theme] (in
> your jsp) is invalid.
>
> Can you show us your jsp and TLD file?
>
>
>
> 2010/10/9 Mead Lai <laiqinyi@gmail.com>:
> > I read the attribute "name" in the template, the Exception log:
> >
> > Attribute theme invalid for tag hello according to TLD
> >
>  org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
> >
>  org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
> >
>  org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:236)
> >
>  org.apache.jasper.compiler.Validator$ValidateVisitor.checkXmlAttributes(Validator.java:1235)
> >
> >
> >
> > Regards,
> > Mead
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message