Bookmark Topic Watch Topic
  • New Topic

Can i avoid execution of action on page refresh(F5)..  RSS feed

 
Manoj Amrutkar
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Report post to moderator
I have one chat application, When user logs in he has the URL as
http://localhost:7001/sample/message.doThere is a text area(TA), text field(TF) and a button(Send). Now user enters text in TF and clicks on Send the text concats with existing text in TA. In the corrosponding action the Context String messageList variable get updated in the background.

Now the big problem:It's fine once time but if i refresh a page say by pressing F5. same action gets called and without any reason the empty string gets concatenated(with new line character) to the list which is not what i want. Basically it should not even if it is empty.

Partial Solution:I have one session varible say newUser set to "true". I will "false" it in action but again i have to make it true on click of Send just before the message.do or corrosponding action gets called. Can i do it in javascript, what will be the code for it?
Is there any other way to have difference in refresh and Send button click?
Can i have something in between Send click and Action class execution to access session variable?

Please have your expert advice....

Thanks in advance
Manoj Amrutkar
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Report post to moderator
Redirect After Post:
http://faq.javaranch.com/view?DoubleSubmitProblem
 
Jan Groth
Ranch Hand
Posts: 456
  • Mark post as helpful
  • send pies
  • Report post to moderator
it's considered not so nice to double post question... should be fair enough to post it once, people usually look in all the relevant forums...

would be better to continue this in the struts forum.

bye,
jan
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66154
146
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
Indeed. Topic closed.
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!