File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Urgent Strange Problem, please help! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Urgent Strange Problem, please help!" Watch "Urgent Strange Problem, please help!" New topic

Urgent Strange Problem, please help!

Stephen Wei
Ranch Hand

Joined: Oct 09, 2001
Posts: 73
hello all.
I am encountering a strange problem, do not know what could be the cause. the user inputs some data and submits them to my mail servlet, then my mail servlet reads the input, and send out the mail. But I find that if my total size of input is greater than about 750 bytes, the server alsays returns me an error, and my servlet seems to be not able to read the input correctly.
Here is some of my rough codes, notice that I am doing code conferting, because the page contains Japanese characters.
On client side, here is my html.
<form action="../servlet/SurveyMail">
<p align="left"><font size="4"><strong>Subject:</strong></font><input
type="text" size="100" name="subject"></p>
<p align="left"><font size="4"><strong>Message:</strong></font><textarea
name="message" rows="20" cols="100"></textarea></p>
Here is some of my servlet code:
String subject = request.getParameter("subject");
subject = new String(subject.getBytes("ISO8859_1"), "JISAutoDetect");
String message = request.getParameter("message");
message = new String(message.getBytes("ISO8859_1"), "JISAutoDetect");
String fullMessage;
String to;
StringBuffer unsentList = new StringBuffer("");
int errorFlag = 0;
HttpSession session = request.getSession(true);
MailProcess mailer = new MailProcess();

DbProcess dbManage = new DbProcess();
Vector vector = dbManage.getSurveyMemberEmailList();
for(int i=0; i<vector.size(); i++){
to = vector.elementAt(i).toString();
fullMessage = message + "\n\n" + "here is the link: " + surveypage;
Thread.sleep(5000); //sleep for 5 seconds;
mailer.sendMail(from, to, subject, fullMessage, mailHost, unsentList);

I am using tomcat3.3, servlet 2.2, JDK1.3, what is wrong with my code? any thing wrong with the threads?
Please comment, thanks.

Sun Certified Programmer for Java Platform
Stephen Wei
Ranch Hand

Joined: Oct 09, 2001
Posts: 73
Hello all:
I think I may have found out what the problem is.
I did not specify the "POST" method for my form, so my form use the default "GET" method, which seems to limit the size of data to be submitted.
I will try to correct it, and test. If there is more problems, I will get back...
I agree. Here's the link:
subject: Urgent Strange Problem, please help!
jQuery in Action, 3rd edition