MyEclipse Forums
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
takai
Post subject: Tags JavaBeans  PostPosted: Jun 28, 2003 - 11:11 PM
Registered Member
Registered Member


Joined: Jun 05, 2003
Posts: 12

Doubt about Tags JavaBeans. :cry:
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
support-scott
Post subject:   PostPosted: Jun 28, 2003 - 11:19 PM
Moderator
Moderator


Joined: May 06, 2003
Posts: 6760

Ok, I'm going to need more to go on than this. :-)

--Scott
MyEclipse Support

_________________
--Scott
MyEclipse Support
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
takai
Post subject:   PostPosted: Jun 28, 2003 - 11:24 PM
Registered Member
Registered Member


Joined: Jun 05, 2003
Posts: 12

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.
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
support-scott
Post subject:   PostPosted: Jun 29, 2003 - 12:18 AM
Moderator
Moderator


Joined: May 06, 2003
Posts: 6760

Quote:

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.
Quote:

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.


Quote:

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
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
takai
Post subject:   PostPosted: Jun 29, 2003 - 01:19 AM
Registered Member
Registered Member


Joined: Jun 05, 2003
Posts: 12

Hello Scot.
Ok. This meantime, I will use
<%=faq.getID()%>
instead of
<jsp:getProperty name="faq" property="ID"/>.
Isn't it?
Thanks.
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
support-scott
Post subject:   PostPosted: Jun 29, 2003 - 01:34 AM
Moderator
Moderator


Joined: May 06, 2003
Posts: 6760

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

_________________
--Scott
MyEclipse Support
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
takai
Post subject:   PostPosted: Jun 29, 2003 - 02:25 AM
Registered Member
Registered Member


Joined: Jun 05, 2003
Posts: 12

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.
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
support-scott
Post subject:   PostPosted: Jun 29, 2003 - 02:51 AM
Moderator
Moderator


Joined: May 06, 2003
Posts: 6760

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

_________________
--Scott
MyEclipse Support
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
wk5657
Post subject:   PostPosted: Jun 29, 2003 - 05:54 AM
Registered Member
Registered Member


Joined: Jun 17, 2003
Posts: 88

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
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
support-scott
Post subject:   PostPosted: Jun 29, 2003 - 09:23 PM
Moderator
Moderator


Joined: May 06, 2003
Posts: 6760

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

_________________
--Scott
MyEclipse Support
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
takai
Post subject:   PostPosted: Jun 30, 2003 - 12:37 AM
Registered Member
Registered Member


Joined: Jun 05, 2003
Posts: 12

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.
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
support-scott
Post subject:   PostPosted: Jun 30, 2003 - 02:25 PM
Moderator
Moderator


Joined: May 06, 2003
Posts: 6760

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

_________________
--Scott
MyEclipse Support
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
takai
Post subject:   PostPosted: Jul 01, 2003 - 01:33 AM
Registered Member
Registered Member


Joined: Jun 05, 2003
Posts: 12

Hello Scot.
I realized this test. Unfortunately, this don't worked. The return value was 0 (zero).
Thanks a lot.
Takai.
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT - 6 Hours
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2004 The PNphpBB Group
Credits