Herbert Pfleger wrote:

> Hi All,
> I am trying to give the instance of a javaobject as an attribute to a self
> written Custom Tag.
> I put it in my Jsp with
> <jsp:useBean id="RS" class="try1.Jsp5Bean" scope="page"/>
> then run the Custom Tag with <xxx:yy rs="RS" />
> If in my Tag-Javaclass rs is a String, then i got no Error, but if rs is a
> javaclass i got
> javax.servlet.ServletException: argument type mismatch.....
>

To pass the bean itself, you would need to say

    <xxx:yy rs="<%= RS >"/>

instead.

However, I would recommend that the "rs" attribute of the custom tag class itself
should be a string -- and you can use it to pass the name of the bean that you are
interested in.  For example, if your custom tag class has this:

    private String rs = null;

    public void setRs(String rs) {
        this.rs = rs;
    }

then you can access the actual object like this:

    try1.Jsp5Bean myBean =
      (try1.Jsp5Bean) pageContext.getAttribute(this.rs);

The nice thing about it is you can refer to a different bean of the same class (say
you stored it under id "XY") by saying:

    <xxx:yy rs="XY"/>

>
> Can anybody please help me
>
> Thanks Herb
>

Craig McClanahan

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to