aspose file tools*
The moose likes Servlets and the fly likes problem in servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "problem in servlet" Watch "problem in servlet" New topic
Author

problem in servlet

preethi Ayyappan
Ranch Hand

Joined: Oct 04, 2007
Posts: 518
Hi,

Following is my code.


Here,In the while loop,if the variable extnum contains 2 variables from the database,when i print the extnum in the onManagerEvent,it just prints the last variable of the two variables instead of printing 2 variables.How should i solve this problem.Please assist me to do this.

Thanks
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

This should be managed in two separate classes, the responsibilities are separate and you'll just confuse yourself (as in this case) if you try to write it in one class.
Jhakda Velu
Ranch Hand

Joined: Feb 26, 2008
Posts: 166
Hi
Your code is messy. As David said, split your code a bit. Then you should(and we will ) be able to read and understand your code properly. About your question of only one value getting printed, i believe that you mean to ask that you get 2 records, but only one is printed, if this is your question, then check how you are assigning the value from result set, that should lead you to the answer.

Hope it helps

Jhakda


If I become filthy rich, I'll sponsor research for painless dental treatment at Harvard Medical School. Thats why,I'm learning Java.I have 32 teeth, 22 are man made.
preethi Ayyappan
Ranch Hand

Joined: Oct 04, 2007
Posts: 518
Thankyou for your replies.
i believe that you mean to ask that you get 2 records, but only one is printed, if this is your question


yes.This is my question.

check how you are assigning the value from result set


I dont get you.I am assigning the records from the resultset to a string variable extnum.

I have splitted my codes into two classes like :


The above code is to dial the particular numbers whose flag are 0 from the database .

In the following code , I am just getting the extnum and trying to print.But null is printed.


Please locate me where am i wrong?

Thanks
Jhakda Velu
Ranch Hand

Joined: Feb 26, 2008
Posts: 166
Hi
I think you are not exactly getting the purpose of a Servlet.
In you onManager method, you are just instantiating the Servlet, you don't instantiate a servlet yourself, the container does it.

Now, the question, do you need a servlet or just a POJO?
Please revert with what you exaclty need to do. That way people on the forum will be able to help you better.

In your old code, you were assigning the value to the same string object 2 times, that why only the last value was getting printed. Now you are just instantiating the servlet, so the value is bound to be null

Jhakda

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: problem in servlet