Colin Shine

Greenhorn
+ Follow
since Aug 12, 2005
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 Colin Shine

I was wondering why the APIs in the javax.naming.* packages haven't been updated with Generics. Is there a reason for this?
16 years ago
Hi All,

I have a question about where it is considered acceptable to place your DAOs. I have a number of domain objects that belong to an object graph. I am using Spring RowMappers to create these objects from data taken from tables in a relational database.

The problem is that I'd like to use these objects' constructors to create valid, fully instantiated objects before they get called by the objects creating them, but I can't pass information such as other object references into the rowmappers. This means that I must partially construct the object and return it, and let the calling object finish creation by calling the appropriate setters. I would like to restrict access to these mutator methods to the default level (i.e. package visibility) to help minimise the effect on encapsulation. This, in turn, means that I must place all my DAOs in the same package as the objects that they are creating.

Will this lead to a maintenance headache if, for example, I end up with a large number of DAOs in the same package as my domain objects? Is there any accepted practice in this area?
Hi Bear,

I've solved it! There was a servlet-2.3.jar and a jsp-api-2.0.jar file on my project classpath, and the compiler was loading the PageContext from the servlet jar, which seems to be incompatible with the jsp-api JspContext. Thanks for your help.
17 years ago
JSP
The error I'm getting from the compiler is:
"Cannot cast from JspContext to PageContext"

I'm totally stumped, I've checked out the javadocs on the sun website at http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/jsp/PageContext.html which say exactly what you say, but yet my compiler doesn't allow it.
17 years ago
JSP
I've tried the following:



but the compiler complains, saying I can't cast from a JspContext to a PageContext.
17 years ago
JSP
Hi All,

I'm trying to come up with a workaround for the lack of any method in the SimpleTagSupport API for getting the current Servlet Request. I read a hint on a website that the EL expression evaluation API can be used, and I'm trying to get it to work using a variation of the following approach. Is what I'm trying even possible?

17 years ago
JSP
I don't think it's possible to disable cookies programmatically, it's a setting in the user's browser.
17 years ago
As far as I know, there's no appreciable performance advantage to JSTL, but, unlike Struts, it is a standard, so if you use the JSTL tags you're guaranteed to have support for them far into the futue.

An equivalent tag would be

17 years ago
Servlets have far better scalability and performance, because each request is handled with a lightweight thread instead of spawning a new process.
17 years ago
With regard to the other points, have you configured an SSL connector for Tomcat? Check out

http://tomcat.apache.org/tomcat-5.5-doc/connectors.html

and

http://tomcat.apache.org/tomcat-5.5-doc/realm-howto.html#JDBCRealm
17 years ago
With regard to point 4, you can configure Tomcat to use a JDBC realm, which is an implementation of Tomcat's 'Realm' interface. The default implementation that comes 'out of the box' will read user info from a flat text file (tomcat-users.xml), but a JDBC realm will read from a db of your choice.

Configure it in server.xml as follows:



userTable - the table containing the user info
userNameCol - the column name containing usernames
userCredCol - the coumn name containing passwords
roleNameCol - the column name containing the roles
userRoleTable - the table mapping users to roles
17 years ago
You could use a class implementing the ServletContextListener interface. It can be a regular class. Configure it in web.xml as:

17 years ago
It turns out we'll have to wait for Struts 1.3. Oh well...
17 years ago
Hi,

I recently downloaded the new html2 tag library from http://www.rabago.net/struts/html2/. It looks great, it allows you to call the ActionForm's validate() method from your HTML form with an AJAX-style XmlHttpRequest.

When I tried it out, I got a 'NoSuchFieldError' from the runtime. It's classes seem to be incompatible with my version of Struts (1.2.4)

I added the source code to my project to have a look, and it seems it's importing classes from the non-existent package:



There's very little documentation on the site about the correct version of Struts to use, can anyone suggest what to do?
17 years ago
Solved it!

A bean:write tag was being used further down the page to generate some javascript to update the value of the text box. Evidently, bean:write encodes characters such a quotes, which is fine in the body of a html page, but is displayed exactly 'as is' in the text field.



This javascript overrides the initial value, even my hard-coded one :roll:
18 years ago
JSP