facebook

Tags JavaBeans

  1. MyEclipse Archived
  2.  > 
  3. Old Posts
Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #196542 Reply

    takai
    Member

    Doubt about Tags JavaBeans. 😥

    #196545 Reply

    Scott Anderson
    Participant

    Ok, I’m going to need more to go on than this. 🙂

    –Scott
    MyEclipse Support

    #196546 Reply

    takai
    Member

    Hello.
    I am using tags java bean with MyEclipse. But, I am have any problems.
    1) This tags:
    <%@page import=”com.taglib.wdjsp.faqtool.*” %>
    <jsp:useBean id=”faq” class=”FaqBean”/>

    don’t work. It’s necessary full path in second tag:
    <%@page import=”com.taglib.wdjsp.faqtool.*” %>
    <jsp:useBean id=”faq” class=”com.taglib.wdjsp.faqtool.FaqBean”/>

    2) This tag:
    <jsp:getProperty name=”faq” property=”ID”/>
    don’t return a value correctly and the element [name=”faq”] is writing red.

    am I forget anything?
    Thanks.

    #196547 Reply

    Scott Anderson
    Participant

    It’s necessary full path in second tag:
    <%@page import=”com.taglib.wdjsp.faqtool.*” %>
    <jsp:useBean id=”faq” class=”com.taglib.wdjsp.faqtool.FaqBean”/>

    That’s because this is what the JSP 2.0 spec requires. A full path must be used in the useBean tag.

    1-97 PROPOSED FINAL DRAFT 3
    The attribute beanName specifies the name of a Bean, as specified in the JavaBeans specification. It is used as an argument to the instantiate method in the java.beans.Beans class. It must be of the form a.b.c, which may be either a class, or the name of a resource of the form a/b/c.ser that will be resolved in the current ClassLoader. If this is not true, a request-time exception, as indicated in the
    semantics of the instantiate method will be raised.

    2) This tag:
    <jsp:getProperty name=”faq” property=”ID”/>
    don’t return a value correctly and the element [name=”faq”] is writing red.

    Lack of support for the name attribute in the getProperty tag is a known bug and will be fixed in the next release. In the meantime, please ignore the red coloring.

    –Scott
    MyEclipse Support

    #196548 Reply

    takai
    Member

    Hello Scot.
    Ok. This meantime, I will use
    <%=faq.getID()%>
    instead of
    <jsp:getProperty name=”faq” property=”ID”/>.
    Isn’t it?
    Thanks.

    #196549 Reply

    Scott Anderson
    Participant

    That will work fine, or you can also continue to use <jsp:getProperty>. The JSP will still execute correctly even though in EA2 it is colored as an error by the JSP editor. It won’t cause a runtime problem; it is just slightly misleading at the moment.

    –Scott
    MyEclipse Support

    #196550 Reply

    takai
    Member

    Excuse me dear Scot.
    I used <jsp:getProperty name=”faq” property=”ID”/>, but it’s don’t returned any value!

    This scriptlets: <%=faq.getID()%> work, but replacing this scriptlets to this tag: <jsp:getProperty name=”faq” property=”ID”/>, don’t work.

    Thanks.

    #196551 Reply

    Scott Anderson
    Participant

    OK, thanks for clarifying it. Apparently the problem with recognizing the name attribute causes a runtime problem too. The scriplet is a good workaround for this, as you suggested.

    –Scott
    MyEclipse Support

    #196552 Reply

    Wayne Kidd
    Member

    I think it would be interesting to know what the field in
    com.taglib.wdjsp.faqtool.FaqBean is defined as.
    iif the field is “id” or “ID” then there may be a problem.
    If the field is id, then the right way to refer to it is with a method called
    getId not getID. Javabeans are based on introspection. Convention says to name fields beginning with lowercase letters and that the accessor should uppercase the first letter of the field and leave the rest alone. The javabeans introspection kind of depends on it.

    Wayne

    #196559 Reply

    Scott Anderson
    Participant

    Wayne,

    Very good catch. I believe this may be the exact problem that he’s experiencing with the getProperty tag.

    Thanks for the help.

    –Scott
    MyEclipse Support

    #196561 Reply

    takai
    Member

    Hello Wayne and Scott.
    My FaqBean method is:
    public int getID() {
    return this.id;
    }
    When press ctrl+space in <%=faq.
    myeclipe editor return getID.
    It’s correct, isn’t it?
    Thanks.

    #196562 Reply

    Scott Anderson
    Participant

    Just as an experiment, try adding the following method to your bean:
    public int getId() { return this.id; }

    Then, try this in your JSP page:
    <jsp:getProperty name=”faq” property=”id”/>

    These changes will make your bean conform to the naming convention used in the spec.

    –Scott
    MyEclipse Support

    #196580 Reply

    takai
    Member

    Hello Scot.
    I realized this test. Unfortunately, this don’t worked. The return value was 0 (zero).
    Thanks a lot.
    Takai.

Viewing 13 posts - 1 through 13 (of 13 total)
Reply To: Tags JavaBeans

You must be logged in to post in the forum log in