Bob Smalley

Greenhorn
+ Follow
since Aug 25, 2006
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 Bob Smalley

Dan Patsey wrote:

Larry Olson wrote:I know java allows final instance variables. But my question is what good is a final instance variable? If the value is final, it means all the objects of that class will have the same value for that instance variable. What purpose would it serve?

Why not replace it by a final static variable? Wouldn't it fit the requirement?

So why do we have a final instance variable in java?



An example from Spring:



If the above class variable was static instead of instance, the logger would reflect the wrong class in different subclasses. (I think it would be the first one that was instantiated.)



You actually could not use that if it was static since the getClass() method is not static.
14 years ago

Larry Olson wrote:I know java allows final instance variables. But my question is what good is a final instance variable? If the value is final, it means all the objects of that class will have the same value for that instance variable. What purpose would it serve?

Why not replace it by a final static variable? Wouldn't it fit the requirement?

So why do we have a final instance variable in java?



An example from Spring:



If the above class variable was static instead of instance, the logger would reflect the wrong class in different subclasses. (I think it would be the first one that was instantiated.)
14 years ago
If I wanted to use an open source library that I anticipate may change in the future -- Would there be any value in creating a set of custom interfaces and adapters to program to instead of using the library's interfaces directly or is this just unnecessary overhead?

Any experiences/opinions from open source library users?
14 years ago
There was a method I used a few years back that was similar to "HttpSession.invalidate()". The difference was that it destroyed all sessions in the user's browser, not just for my site. Maybe clearing their cache? Anyone remember this method??

Thanks,
Dan
15 years ago
Hello, I am creating a web application w/ servlets/JSPs and database access using JDBC. I have about 30 SQL queries that are going to be run against the database in this application. I want to know where I should put these queries so that I can have a servlet execute them. Should I store them all in the servlet? Should I have a separate servlet for each SQL query? Where do I put them?? Thanks =)
17 years ago
If you are using req.getParameter() in a servlet to gather data from a form... What methods could you use to guarantee that the data is coming from that form and not a malicious user who is typing the parameters in the url (ie. www.something.com/servletname?importantparameter=something)
17 years ago