Win a copy of Rust Web Development this week in the Other Languages forum!

peter greaves

Ranch Hand
+ Follow
since Sep 27, 2002
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 peter greaves

you want to paste yr servlet code here? clearly the container is calling service() and service can't find doGet()

your servlet will compile with doGet() "incorrectly" over-riddden : there's no law against that.
i think a lot depends on the J2EE level of the app server you work with. we use WebSphere and although only the just-out version 6 is 1.4, and we are on 5, i think i'd rather have the knowledge how to exploit 6 so i can recommend an upgrade for example.
thanks for that note re: the compiler and nulls, peter. interesting.
17 years ago
some code purists might prefer:



on the basis that one return statement in a method makes the method's exit point easy to find. matter of style i guess.
[ September 30, 2004: Message edited by: peter greaves ]
17 years ago
hi all
i seems to me from my testing that my listener is not called if an attribute is added to the context with the same name and value as an existing attribute - so if i have this in doGet:

and i have this in attributeAdded where event is the ServletContextAttributeEvent :

i will only see the log output once - the first time the attribute is set. i guess that equals() is coming into play here? brings up the subject of the right place for attributes of varying scopes.
[ November 02, 2003: Message edited by: peter greaves ]
i would guess a compile time error is because the package name of the type can't be resolved? it is bookstore, not acme?
bill
thanks very much - your suggestion worked just fine for me. have to admit that i was finding the thicket of name/value pair possibilities in the request a bit inpenetrable. your suggestion was right on the money.
thanks for the books btw!!
regs
peter
[ July 07, 2003: Message edited by: peter greaves ]
18 years ago
hi everyone
i want to post an XML file to a servlet. i have this working by sending the entire file as the content of the servlet like this:

this seems to be working fine. but now i need to extend this by sending some parameters with the POST. i don't want to use the query string for these params. i have been reading that attributes are sent as name/value pairs in the POST's content so a=foo&b=bar etc. am atuck with the general approach.
should i make a string out of the params and send it at the front of the xml file, and make the XML content itself into an attribute of the post e.g.
a=b&c=d&content=<! etc
and how would i handle this on the server side? could i use HttpUtils.parsePostData(), even with what might be a big xml document? would i need to encode the string?
or is there a better approach? i have very limited implementation time so simple will win over comprehensive

thanks a lot for any advice and help,
peter
18 years ago
>The stack is used for objects that the computer knows the size of, I *think* all static types in Java are stored there
james - did you mean, "objects that the COMPILER knows the size of, " ??

peter
18 years ago

should be

the JVM looks for a method with that sig.
peter
18 years ago
to indicate something about a class, for something that can use the reflection API. good example is servlet implements SingleThreadModel if i declare "implements SingleThreadModel", an interface whiuchn is a marker (IE has no methods) i am telling the servlet container that my servlet is not thread-safe and that a new instance should be started to handle requests. so i am giving the user of the class a message which can be tested like this:

peter
18 years ago
not simple,this solution, but it is precise and it is a java solution.
while this is alovely site, the markup is not wellformed. however, if you download JTidy, you can run this tool in java and it will give you a well-formed XHTML representation of a page. then you can use a simple XPath expression in an XSL stylesheet that selects all the text from the <body> tag downwards <xsl:value-of select="//body/text()" />
i know - a complicated option. but still an option
peter
18 years ago
grrr... cost me an hour staring at this before i realised that the method was the constructor...i was doing something like this:

and kept getting NoSuchMethodError at runtime. was looking at all sorts of reasons in method calls. but the problem was occuring because i had not declared a no-args constructor!! the "method" that was not there was the constructor ().
a painful lesson
peter
18 years ago
packages are created (logically)as they are declared, using the "package" keyword. the JLS governs that. the compiler will create a directory structure that "reflects" your package names. maybe you could post the errors you are getting with yr code, so we could help out?
regs
peter
18 years ago
hmm - debugging technologies are part of IDEs. and there are lots of other things to consider when we choose those. for example, in my company we use the IDE that we make commercially (WebSphere Studio Application Developer, an Eclipse product), so we have little choice in the matter of what debugging is offered. maybe you are asking what are the debugging features of IDEs that people on the list find most useful?
peter
[ June 27, 2003: Message edited by: peter greaves ]
18 years ago