Donald Fung

Greenhorn
+ Follow
since Oct 27, 2004
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Donald Fung

I have the following validation rule for struts 1. But the contactName can't be checked. Moreover, the other part of the validatation fails, too.

Without the contactName , it can display message when I input "xx" into csmSms filed. Otherwise, it fails to validate.

Is there any syntax error in my code?


edit.jsp




validation.xml

[ March 20, 2008: Message edited by: Donald Fung ]
16 years ago
Thanks for your suggestion, Mark.

I had wrote a simple TypeHandler to convert the null field.
It returns null, which as a result that the iBatis set NULL in the returned Object.

Here it is:

[ April 27, 2007: Message edited by: Donald Fung ]
Hi all,

I am using iBatis with oracle database. I found that if the database date field is null, the iBatis throws nullPointerException.

--- Check the result mapping for the 'activationDate' property.
--- Cause: com.ibatis.common.beans.ProbeException: Could not set property 'activationDate' for java.util.Hashtable. Cause: java.lang.NullPointerException

I search the JavaDoc and seems the java.sql.Timestamp/Date does not allow null value.

1) How to solve this? I can write more steps to convert it back into date but I would like to know if there is other solution...

2) Does Hibernate have the same problem?
[ April 11, 2007: Message edited by: Donald Fung ]
Hi all,

I had wrote an executable jar that send mail by using the org.apache.commons.mail package (many other programs useing it). And I'd compiled it and tested it before jar. That's fine.

After I jar it and execute it. It displayed the following error: Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/mail/EmailException"

According to the sun document, it seems that I need to put the jar file of the mail package in relative path in the executable jar, rewrite the manifest.MF and jar all the file together.


As the package need to be shared by many programs, it's better for load the package in a common location. How can the jar to get the packge in environment CLASSPATH?
[ July 28, 2006: Message edited by: Donald Fung ]
18 years ago
I'm also an newbie to using struts. Here's my work in use.


Platform: Jrun4.0 + struts.




web.xml


[ June 16, 2006: Message edited by: Donald Fung ]
18 years ago
Hi all,

I wrote an action class to retrieve the records in an excel file and insert into database.
The action reads the records into an ArrayList of actiomform and check it by using validator in the action class.

If the actionform is invalid, I need to put the line number and the error into a log file and send back to the user.

However, the returned is ActionMessages which contains arguments. How can I convert it to a String to put into a file?

Hope someone can help. Thanks.
[ June 16, 2006: Message edited by: Donald Fung ]
18 years ago
It works now.

Thanks, Merrill.
18 years ago
Hi, all

I feel dizzy to solve this problem in few days. I had searched the forum and tried many solutions but not help.
I hope somebody can help me. Thanks.

The problem is I cannot display the messages in the jsp, it seems that <logic:messagesPresent> always returns false.
I have tried to use the common log to retrieve the saved messages from the request and sure that the message is present.

The web is using jdk1.4.11 + jrun4 + struts 1.2.9 .



Here is the action class:



web.xml


The jsp:


Log message(by common log):

1382 / 1414 06/07 18:43:40 info [axis] Tiles definition factory found for request processor ''.
1383 / 1414 06/07 18:43:44 info [axis] {org.apache.struts.action.GLOBAL_MESSAGE=[The customer does not define location yet. Please input them before.[]]}
1384 / 1414 06/07 18:43:45 info [axis] {org.apache.struts.action.GLOBAL_MESSAGE=[The customer does not define location yet. Please input them before.[]]}
1385 / 1414 06/07 18:43:46 info [axis] {org.apache.struts.action.GLOBAL_MESSAGE=[The customer does not define location yet. Please input them before.[]]}
1386 / 1414 06/07 18:43:48 info [axis] {org.apache.struts.action.GLOBAL_MESSAGE=[The customer does not define location yet. Please input them before.[]]}
[ June 07, 2006: Message edited by: Donald Fung ]
18 years ago
Thanks for your reply.

Finally, I'd updated the pattern to the following to extract the ().
And then I put the result into the matcher agin to get the result.

18 years ago
Hi everyone,

I have the following statement, "VARCHAR2 (a,2,c)", and the outputs I want are "a" , "2" and "c".

There're two problems.
1) How can I ignore the "VARCHAR2 (" and ")" by using the pattern?
2) Can the extracted "a", "2", "c" in the same group?

I can use subString & split to process it but I'm looking for idea by using pattern to do the same result.
Thanks.

18 years ago
Hi all,

I'm developing a web(servlet + JSP) for displaying the system. And I was told to create a web for user to create/update/delete UNIX OS account.

There are two ways to do:
1) Write a shell script and call runtime to execute it. However, it's very dangerous that everyone can use 'ps' to see the background process(eg, passing password to shell script in command).

2) Modify the telnet class from apache.org. However, I found it requires well-define all interaction(text stream output, such as duplicate user) from the UNIX.

Which one is better to achieve it?

[ May 03, 2005: Message edited by: Donald Fung ]
[ May 03, 2005: Message edited by: Donald Fung ]
19 years ago
Thanks for your suggestion.
I brief my question more clear.

I have to build a web that allow user to access some pages from the server. I had complete the basic function.

But I had some problem for my output.

Remark: A, B, D, F & G are directories

A
|
B ----- C.html
| |
| --- D ---- E.html
|------ F ---- G

My current output is:
A::A
B::A\B
C.html::A\B\C.html
D::A\B\D
E.html::A\B\D\E.html
F::A\B\F
G::A\B\F\G

My desired output:
A::A
B::A\B
C.html::A\B\C.html
D::A\B\D
E.html::A\B\D\E.html

The parent directory (contained desired file) should be included in the output.
I'm finding ways to remove the "F::A\B\F" & "G::A\B\F\G" from the output.
[ February 22, 2005: Message edited by: Donald Fung ]
19 years ago
That's what I want.I'll try the code.

One more question to ask, seems that filenameFilter will filter out file which does not fulfill the String and all directory. Isn't it?
[ February 21, 2005: Message edited by: Donald Fung ]
19 years ago

Originally posted by David Harkness:
You shouldn't need to change getDirectoryList's signature.

How about splitting apart your file testing so each method tests one aspect. Currently accept() returns true for directories or htm/html files. The File class has a method that performs the first test already, so simply remove it.




I'd already test it yet, but I observerd that if I do not return True for directory. The listFiles() will filter out all sub-directory. So, I need to add it there.


Did you just add the "isFolder = files[i].isDirectory();" line or did I accidentally delete it when I copying? Either way, simply use this boolean to decide whether or not to put "add the file info to an array of object." No sense adding it and then removing it later if it's a directory when you already know whether or not it's a directory.



As I need to construct the file tree, I need to put the folder as a file object before the child files.

banner::G:\template\banner
fbarA.htm::G:\template\banner\fbarA.htm
fbarB.htm::G:\template\banner\fbarB.htm


You can simplify your structure a bit by rearranging the lines you have. If you change checkFile() as I suggested, you'll need to. Simplify the following logic.



19 years ago