Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java coding problem ~ system.out.println

 
Alvin chew
Ranch Hand
Posts: 834
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi, good day, i have a problem, which is normal java class and calling from struts action class, the coding as below :



problem : when i check the result from tomcat console, it appear double output result ..why is it so ? anyone know it ?

result display in console:

test.jsp not create
test.jsp not create
test.jsp create
test.jsp create

thank you very much for your time !!
 
Ko Ko Naing
Ranch Hand
Posts: 3178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Alvin,
I doubt that the problem is not in the code that you provided above and it could be in the page that make use of this class... Could you provide some more info where you use this class and from where this class is called?

I do hope we can help you more, if more info are provided...
 
Alvin chew
Ranch Hand
Posts: 834
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for reading, ko ko , my action class as following :

 
Ko Ko Naing
Ranch Hand
Posts: 3178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It seems like there is nothing wrong in your action class also... What about the HTML page that is calling your action class?

I used to face this kind of problem before... It was the problem with HTML FORM tag. I was trying to call the action class both from HTML FORM tag and JavaScript action, which results in calling the same action two times...

I doubt that your case is similar to my case... Could you check your HTML page again?
 
Alvin chew
Ranch Hand
Posts: 834
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ko ko , this is my html page coding ..and it is popup form, the popup form consist of 3 page, this is the last page and calling the action

 
Ko Ko Naing
Ranch Hand
Posts: 3178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Alvin,
I can see the error now...

It's similar to the problem I got before... You are using submit input type, surrounding with a href tag... That could be the problem... Could you use simple button input type? I hope it's solved then...

There are redundant codes in your JavaScript also... In submitFunction(i), you are checking the value of i... I see only one call submitFunction(2) to get back to previous page... So why don't you fix the method only for getting back to previous page? Other actions have their own fixed method to go...

Hope it helps...
 
Alvin chew
Ranch Hand
Posts: 834
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi, ko ko , if i do not use href tag , i couldn't put multiple button which call multiple action ...how i solve this problem ?

do you mind to modify my existing html code base on your explanation ? i have little confusing then ...

thank you in advance for your valuable time , really appreciated !!
 
Alvin chew
Ranch Hand
Posts: 834
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi, ko ko , i have modify as below but it seem not help :

 
Ko Ko Naing
Ranch Hand
Posts: 3178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Alvin chew:
hi, ko ko , if i do not use href tag , i couldn't put multiple button which call multiple action ...how i solve this problem ?


Yes, Alvin, you can do that... Put multiple normal buttons, not submit buttons, which might cause double submitting...

Change every input type = "submit" into input type="button"

Hope it might help you...
 
somkiat puisungnoen
Ranch Hand
Posts: 1312
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think, move this topic into Web Application Framework.
 
Alvin chew
Ranch Hand
Posts: 834
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks , ko ko ...i solve it .....highly appreciated your sharp eye on my mistake...fantastic ...

anyway, since the popup form have 3 page .. i change in all pages but i using input="submit" ..it still function ...anyway ...i try input="button" now ....once again ...thank you !!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic