Kate Xu

Greenhorn
+ Follow
since Jul 28, 2003
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 Kate Xu

I got an output, but it was not what I expected:

dateString is: 9/1/2005
resultDate2 is: Wed Aug 31 20:00:00 EDT 2005

I expected resultDate2 to be: Thu Sep 1 04:00:00 GMT 2005
15 years ago
I am in U.S. Eastern Standard Time Zone (4 hours behind GMT during daylight savings time, or 5 hours behind GMT during eastern standard time).

My web application is running on Weblogic server, the server is using GMT system time zone.

I need to convert input from UI, which is in EST String format ( "9/1/2005 00:00"), to GMT Timestamp object (9/1/2005 04:00).

How can I do it? I tried this and it did not work:

import java.util.*;
import java.text.SimpleDateFormat;

public class TZ1 {
public static void main(String[] args) {

TimeZone tz = TimeZone.getTimeZone("US/Eastern");
TimeZone GMT_TIME_ZONE = TimeZone.getTimeZone("GMT");

Calendar estCalendar = Calendar.getInstance(tz);
Calendar gmtCalendar = Calendar.getInstance(GMT_TIME_ZONE);

String dateString = "9/1/2005";
String formatString = "MM/dd/yyyy";

SimpleDateFormat eptDateFormat = new SimpleDateFormat(formatString);
eptDateFormat.setTimeZone(tz);

SimpleDateFormat gmtDateFormat = new SimpleDateFormat(formatString);
gmtDateFormat.setTimeZone(GMT_TIME_ZONE);

try {
System.out.println("dateString is: " + dateString);

//Date resultDate1 = eptDateFormat.parse(dateString);
//System.out.println("resultDate1 is: " + resultDate1);

Date resultDate2 = gmtDateFormat.parse(dateString);
System.out.println("resultDate2 is: " + resultDate2);

} catch (Exception e) {

}

}
}
15 years ago
Let me add more details to this.. After the "File Download" IE popup is displayed, a user clicks "Save" button. Then instead of displaying the file brower, Internet Explorer will display "File Download" IE popup again. Then the user clicks "Save" button again, then file brower is displayed.

I am using IE 6.0.28.

A coworker got the same result on a different PC.

Any help is greatly appreciated.
16 years ago
I have a problem with implementing functionality that allow user to download a file. The file itself is created correctly and users can choose the "Save" option to save it on the hard disk to view it later. Those parts work fine.

The problem is that the user needs to click "Save" button TWICE on the "File Download" pop up window where you can choose "Would you like to open the file or save it to your computer?"

Here is the source code I use:

public void doPost(HttpServletRequest request, HttpServletResponse response)
{
try
{
String fileName="ABC.csv";
String line="test";

response.setContentType("text/plain");
PrintWriter writer = response.getWriter();

response.setHeader("Content-disposition",
"attachment; filename=" + fileName);

writer.println(line);

writer.flush();
writer.close();
}
catch (Throwable t)
{
t.printStackTrace();
}
finally {
//to do
}
}
16 years ago
Hello all,

I have a problem using Struts <html:text> tag.

How do I set maxlength property dynamically?

For example:

<html:text name="myForm" property="firstName" size="25" maxlength="30" />

I tried the following three ways:
(1) use <%= %>, it won't work.

import MyClass;
....
<html:text name="myForm" property="firstName" size="25" maxlength="<%=MyClass.FIRSTNAME_MAX_LENGTH%>" />

(2) Use <bean:message> tags, it won't work.
<html:text name="myForm" property="firstName" size="25" maxlength="<bean:message key="myPage.maxlength.firstnameMaxlength"/>" />

(3) Use <bean:write> tag, it also won't work.
<html:text name="myForm" property="firstName" size="25" maxlength="<bean:write name=\"myForm\" property="firstnameMaxLength"/>"/>

Any ideas?

Thank you!

Kate
16 years ago
Hi guys,

I have very little experience with web services. Could any one recommend a good book for the exam? or study materials?

Thanks!
Hi,
With EJB-QL, can I use ORDER BY clause? How to write the query?
Thank you all!
Can vitual getter/setter method be private in CMP entity bean class?
Kathy says it's a bad idea to expose them... why just make them private?
AM I missing something here?