Peter Kleczka

+ Follow
since Feb 09, 2003
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Peter Kleczka

Suppose I have a single object and two threads calling the same unsynchronized method on that object. If the method operates only
local variables I imagine that the method would behave as if
it were synchronized. Is this correct?

The context of this question is in trying to understand declarations
in a jsp page. If I write, for instance:

two different JSP's calling this at the same time
won't get the results from the other JSP's arguments
passed to this method.

TIA for your answers.
Please help me understand ... this article says I can indicate a jsp to display upon exception, but there is also a setting in web.xml which (supposedly) lets you declare a page to go to whenever a particualr type of exception happens. Now my preference would be to throw my own custom exception objects in jsps and let the declaration in the web.xml handle it. But I guess I don't understand if that is "another" method from the one mentioned in the article above. And further, the web.xml thing doesn't seem to work in Webshpere v6 or Tomcat 5.

I'm grateful for explain or suggestions on your favorite way to handle jsp exceptions.

15 years ago
I'm trying to understand some suggestions for optimizing
code running on a mobile device. One of the suggestions
discouraged calling a method in the conditional
part of a for loop. So is there any difference between
a method call and calling a property? That is, in
in the case of an array is the second
loop more effecient than the first?

To be even more anal, is a public class variable
cheeper to call than calling a getter on a private
class variable?

Peter (
15 years ago
Java is puzzling? I've always found it straight forward <not>!

Can you give us a taste -- do you have an example of the single most misunderstood concept or process in Java programming?

16 years ago
I'm sorry for this post, you don't really have to read it.
But ok, if you really want to know, I'm posting to find out what my member numer is. I figue it will show up after I post this. I thought knowing my member number would be helpful to search against to locate some of my posts here and by extension, the replies to the posts since I sometimes don't recall the subject line. ... ok, so I told you, you didn't have to read this
16 years ago
Pat said

At first I was trying to use includes like this:

<jsp:include page="/includes/<%= memberID %>/header.html" flush="true" />

and it would not work. I decided to try putting the entire URL together in a String first, and then write my include like this:

<jsp:include page="<%= memberIDHeader %>" flush="true" />

and now it works! I don't quite understand why

I'm also trying to figure this out. Can someone explain?
16 years ago
Mr. Porter

I understand WebWork runs on OpenSymphony. Are these both "free" frameworks or is there licensing? Can you give a quick comparison between WebWork and Tapestry, and in particular what would you say the learning curve might be like compared to Tapestry? Or perhaps you could let us know if WebWork might be more extensible than Tapestry?

Excuses in advance if my questions are too many and too broad.

Thanks Ernest

This makes sense now. Since the static references are going to hang around "forever" there is nothing to be garbage collected. But I assume the
original assignment (String colorString = "") would leave the empty string in garbage collection territory since there is nothing to reference it.

Thanks again,
17 years ago

I'm working with code that changes the color of alternating
table rows on a JSP. The following code is in a loop:

String colorString = ""
if (count%2 == 0)
colorString = SomeClass.A_STATIC_CONSTANT_1;
} else {
colorString = SomeClass.A_STATIC_CONSTANT_2;

Even though colorString is pointing to a constant, is
this not creating a new string for garbage collection
in each iteration of the loop?

Peter (
17 years ago
Sorry the real problem was an SAPIU (Stupid API User) error

I was overcomplicating the callback methods in the ContentHandler
and that made it appear that the parser was not doing things properly.
All I need to do is keep track of the current tag, and if it is not
an end tag print its contents. So my new code looks like the following...

I'm using Xerces but I'm not sure which version I'm using.

I'm trying to parse a file that has no carriage returns
between the XML tags. In other words, the XML document is
all on one line. The parser doesn't seem to pick up
any of the content inside these tags unless I separate
the tags with hard returns.

Here is some of my code....

Is there something special I should be doing in the parser or
content handler? The XML string I'll be getting is comming from
another website, so I don't really have control of the XML document.

Pete (
Does your book contain a troubleshooting section? What versions of WSAD do you cover?
In WSAD 4.x tag libraries seem to get "cached" and there seems to be no way to recompile a tag once it gets in this state short of changing the class name. I haven't yet found an answer to this...although someone suggested I delete files in workspace/.metadata/...servertools/cache which actually seemed to work temporarily.
Peter (
18 years ago
Parsing simple strings can be difficult if you have variations in the text. For example, is the equals sign always against the 'name' attribute, or will there be spaces? But assuming that all the HTML has no spaces between the attributes and the values, your life is easy.
If you're worried about HTML markup that spans several lines, you might try
sticking everything in a StringBuffer and stripping out all carriage returns.
In general, you'll want to do something like this:

18 years ago
Member classes are written to a file of the form EnclosingClass$MemberClass.class
Anonymous inner clases are written in the form
EnclisingClass$1.class and are numbered sequentially
for multiple anonymous classes.
When anonymous inner classes appear inside of other
anonymous inner classes, the pattern is Outer$1.class
not Outer$Inner$1.class.
18 years ago