chris leonardi

Greenhorn
+ Follow
since Feb 25, 2001
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by chris leonardi

Hi John,
You might look into using creating a TagExtraInfo class that allows you to set a scripting variable from the ZipCode tag extension that's accessible to your page (and ultimately, your bean, I believe).
I like William's idea, too - I use that technique a lot with tag extensions, as it affords some flexibility in using and manipulating the tag extension's 'return value'. In fact, the Jakarta Struts framework employs this approach for enabling communication between beans and tag extensions.
Hope that helps,
Chris
22 years ago
Hello -
I'm running into a really odd problem on Tomcat 3.2.1. Here goes: I've got a bean. The bean has a bunch of properties. Some of the fields look like this:
...
protected String aFieldName;
protected String bFieldName;
protected String cFieldName;
...
The corresponding accessor methods look like this:
...
public void setAFieldName(String v)
{
this.aFieldName = v;
}
public String getAFieldName()
{
return this.aFieldName;
}
...
Pretty straightforward stuff, it would seem. However, when using the standard jsp:setProperty and jsp:getProperty tags for the bean's properties, it appears the the JSP engine's introspection "breaks down" - it can't seem to locate the appropriate accessor method (throws "no get method for property 'aFieldName' found in bean ....". I get essentially the same result using Jakarta Struts tag extensions to manipulate the bean. Interestingly enough, I can access the method's directly using scriptlet code ("<% String foo = myBean.getAFieldName(); %>" ).
Now here's where it gets really bizare. Change the field names: instead of having a lower-case first position character, followed by an upper-case second position character, add in another lower-case character. So:
...
protected String aaFieldName;
...
And modify the accessor methods accordingly:
public void setAaFieldName(String v)
{
this.aaFieldName = v;
}
public String getAaFieldName()
{
return this.aaFieldName;
}
...
Now it works. Can anyone else reproduce this phenomenon - either on Tomcat or another JSP engine? Am I missing something? Any ideas would be much appreciated - while I'd like to simply rename the fields and put the whole issue to rest, the bean properties are being defined by a client's design documents. Thanks,
Chris
*** update ***
for anyone who's interested, it looks like this is a documented "bug" in tomcat 3.2.1: http://nagoya.apache.org/bugzilla/show_bug.cgi?id=322
[This message has been edited by chris leonardi (edited March 16, 2001).]
23 years ago
Hi Gaurav -
This may not be the most elegant approach, but it should work:
Element root = doc.getDocumentElement();
NodeList nodes = root.getElementsByTagName("match");
int count = nodes.getLength();
One thing to keep in mind with this tactic is that it will match all matching descendents of the current element. For instance:
<a1>
<b1><match /></b1>
<b2><match /></b2>
<b3><match /></b3>
<b4>
<c1><match /></c2>
<c2><match /></c2>
<c3>
<d1><match /></d1>
<d2><match /></d2>
</c3>
</b4>
</a1>
This would find 7 nodes. Hope that helps.
Chris