Darien Cheung

Ranch Hand
+ Follow
since Aug 13, 2004
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 Darien Cheung

I'm looking for an efficient way to implement an equals() method for a complex object. My class contains Strings and integers and booleans, but also several List of other objects, which contain Strings and other Java objects. I think it would be slow to do a deep comparison, is there any way to generate a "checksum" so that I can use it to quickly compare? My objects might be built in different JVM so I'm worried that Hashcode may not be sufficient.
12 years ago
Hi,

I have a problem with Log4j using Websphere 6.0. My module is configured with a properties file and all the logs were being sent to the appropriate file appender. Then something in our software changed and the logs are now being sent to SystemOut. As far as I can tell, nothing in the configuration has changed (i.e. file appender is still there, log4j still parses it on startup..). Under what circumstances would something like this happen? Does this behaviour mean that my appender is no longer in memory? (any way I can check at runtime?) I'm at wits end trying to debug this issue!

Thanks very much
I'm getting an exception in my JSP when I use a custom tag library and it only happens when I deploy into a Linux Websphere AS 6.1. In the Windows Websphere AS 6.1, it works perfectly.



Is there some packaging or file access gotcha I am not aware of that is causing this? I wish the exception was more helpful...

Thanks
14 years ago
Yes, that's correct, but then immediately it seems to load those 2 again.
14 years ago
I'm running Tomcat 5.5 and have 1 struts application deployed under the WEBAPPS directory. Everytime I start up Tomcat in Windows XP, I see the TilesPlugin and ValidatorPlugin init messages twice. It makes startup a little slower but I'm wondering why is it doing that? Here is the startup messages:



Any help is appreciated! Thanks
14 years ago
Hi,

Is it possible to use a resource bundle located inside a JAR file? For example, I have a resource bundle called ApplicationResources.properties inside a JAR file called common.jar, and it is located in the package com/myApp/resources/. In the struts-config.xml, I defined the <message-resources parameter="com.myApp.resources.ApplicationResources"/> and placed the common.jar into the WEB-INF/lib directory.

When I start Tomcat and load the webpage, it complains the bundle is missing. Is WEB-INF/lib not part of the classpath?

Thanks
14 years ago
Yes, logs did not show any problems. Typically these should show up in the jasper.log?
15 years ago
JSP
Every so often, I have an error in the JSTL I write for my JSP's, such as a typo. This causes the page to not render properly. It's as if the browser decided to quit halfway (or even less). I don't see any meaningful error messages or any exception, just a half-rendered page.

Is this behaviour normal? It's a real pain to debug because I can only walkthrough the code carefully before finding my mistake. Is there a more efficient way to solve these problems?

(I'm using Tomcat 5.5, JSTL 1.2 and have set error pages, which work fine when my framework throws an exception)

Thanks.
15 years ago
JSP
If I wanted to display the actual value that is causing a Struts validator to fail, how would I do this? For example, if I use the depends="email" rule, and I have:

errors.email={0} is not a valid email address

as my error message resource, how can I pass the actual text value into the message?

<arg0 key=" ...? " resource="false"/> but what should go into to key? ${field.value} ?

Thanks.
15 years ago
I've searched on this forum and on Google and I just can't figure out why my validation messages are not showing up when I set it up for automatic validation (i.e. using the ValidatorPlugin and the XML's). If I do manual validation, everything works but I want to use automatic instead. What I want to do is check schedule name is not empty. When I submit my form, it brings me back to the page, leading me to believe that the validation is working, but no error message is displayed.

Here's what I have:

CreateScheduleForm:


struts-config.xml:


validation.xml


my createSchedule.jsp has:


I have a MessageResources.properties file defined in the WEB-INF/classes directory with
errors.required={0} is required.
schedule.name=Schedule name

Note I am using ValidatorActionForm here so that I can map validation to a specific action instead of a form-bean. I have also tried doing it the other way, extending ValidatorForm instead and using the form-bean-name in the validation.xml.

I get no exceptions from Tomcat or logs.

Please let me know if more information is required. Much appreciation and thanks in advanced, I always get amazing help from you guys
15 years ago
I'm using Struts 1.2, JSP 2.0 and Tomcat 5.5. Does the message resource bundle file name have to follow the convention "bundlename_language_country.properties"? I find that some examples such as on apache.org simply use "bundlename_xx.properties" but when I use that naming convention, my messages are not formatted, instead I get the usual ??US_keyname??
15 years ago
Yes, I guess a ticket is a session and it has a timeout value. The authentication is done externally.

Hmm.. you raise a good point. If the session has timed-out, I should probably make them go back to the form and re-enter all the data?
15 years ago
My application uses DispatchMappingAction objects to handle a variety of user functionality. Each DispatchMappingAction is actually extended from a BaseDispatchMappingAction where in the executeBefore() method, I test the user's ticket and redirect to a login page if necessary.

I'm finding that if the user was in the process of filling out a form and then their ticket expired, the form data is lost after they submit, because they are redirected to the login page and redirects start a new request. What are the general ways to handle this situation? If this is not the optimal way of doing things (unfortunately I didn't write this code so I'm trying to avoid rewriting if possible) what should be the proper way?

Thanks.
15 years ago
Thanks again! The last part was what I needed. I should have realized the object is stored there.
15 years ago