|Home |Login |Registration |Struts Step by Step Tutorial |Hibernate Step by Step Tutorial |Spring Step by Step Tutorial |JSP Step by Step Tutorial |JDBC Step by Step Tutorial |Web Services Step by Step Tutorial |EJB fundamentals | ORACLE Step by Step Tutorial | SCJP 5.0 and SCJP 6.0 Study Guide | SCWCD 5.0 Study Guide | SCJP Tips
Java mock test | SCJP mock test | SCJP DUMP | SCBCD mock test |Java online test exam | JSP online test | ORACLE online test | Hibernate online test | Servlet online test | Struts online test | EJB online test | C online test | C++ online test | Aptitude online test

Java interview questions | JSP interview questions | ORACLE interview questions | Hibernate interview questions | Servlet interview questions | Struts interview questions | JDBC interview questions | C/C++ interview questions | Spring interview questions | JMS interview questions | Informatica interview questions | EJB interview questions | OOPS and Design Pattern interview questions
1600 PMP mock questions 1400 CAPM mock questions 800 SCJP 6 mock questions 600 OCAJP 7 mock questions 590 OCPJP 7 mock questions 556 SCWCD 5 mock questions 500 OCEJWCD 6 mock questions pdfDownload (java,struts, hibernet etc) JobsJobs and Walkins

 

Recent Questions

!!! Struts Frequently Asked Questions !!!

Q. How to prevent mutli-click using struts tokens ?

SCJP 1.5/1.6 Exam Kit

!!!Answer!!!- From Technical Expert

Struts has 3 methods use for the token, saveToken(), isTokenValid() and resetToken().
saveToken() - generate the token key and save to request/session attribute.
isTokenValid() - validate submitted token key against the 1 store in request/session.
resetToken() - reset the token key.

How it works:
1. Upon loading the form, invokes saveToken() on the action class to create and store the token key. Struts will store the generated key in request/session. If the token successfully created, when view source on the browser you will see something similar to the following, the token key is stored as a hidden field:
<form action="myaction.do" method="post">
<input type="hidden"
name="<%= Constants.TOKEN_KEY %>"
value="<%= session.getAttribute(Action.TRANSACTION_TOKEN_KEY) %>" >

2. Once the form submitted, invokes isTokenValid() on the action class, it will validate the submitted token key(hidden field) with the token key stored previously on request/session. If match, it will return true.

.
In Action Class.

public final ActionForward perform(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException
{
saveToken(request);
if (!tokenIsValid(request))
{
//forward to error page saying "your transaction is already being processed"
else
{
//process action
//forward to jsp
}

// Reset token after transaction success.
resetToken(request);

}

Details you can check
http://www.techfaq360.com/tutorial/multiclick.jsp

Answered By : null Replied Date : Feb 2 2012
Answer :


Answered By : null Replied Date : Jan 6 2012
Answer :


Answered By : null Replied Date : Oct 31 2011
Answer :


Answered By : null Replied Date : Oct 31 2011
Answer :


Answered By : null Replied Date : Oct 26 2011
Answer :


Answered By : null Replied Date : Oct 26 2011
Answer :


Answered By : null Replied Date : Oct 22 2011
Answer :


Answered By : null Replied Date : Oct 16 2011
Answer :


Answered By : null Replied Date : Jun 18 2011
Answer :


Answered By : null Replied Date : Jun 17 2011
Answer :


Answered By : null Replied Date : Jun 11 2011
Answer :


Answered By : null Replied Date : Jun 2 2011
Answer :


Answered By : null Replied Date : May 30 2011
Answer :


Answered By : null Replied Date : May 30 2011
Answer :


Answered By : null Replied Date : May 19 2011
Answer :


Answered By : null Replied Date : May 9 2011
Answer :


Answered By : null Replied Date : May 3 2011
Answer :


Answered By : null Replied Date : Mar 31 2011
Answer :


Answered By : null Replied Date : Mar 10 2011
Answer :


Answered By : null Replied Date : Mar 10 2011
Answer :


Answered By : null Replied Date : Feb 17 2011
Answer :


Answered By : null Replied Date : Feb 17 2011
Answer :


Answered By : null Replied Date : Jan 15 2011
Answer :


Answered By : null Replied Date : Dec 30 2010
Answer :


Answered By : null Replied Date : Dec 23 2010
Answer :


Answered By : null Replied Date : Dec 23 2010
Answer :


Answered By : null Replied Date : Dec 22 2010
Answer :


Answered By : null Replied Date : Dec 11 2010
Answer :


Answered By : null Replied Date : Nov 30 2010
Answer :


Answered By : null Replied Date : Oct 27 2010
Answer :


Answered By : null Replied Date : Oct 4 2010
Answer :


Answered By : null Replied Date : Sep 23 2010
Answer :


Answered By : null Replied Date : Aug 21 2010
Answer :


Answered By : null Replied Date : Aug 13 2012
Answer :


Answered By : null Replied Date : Sep 4 2012
Answer :


Answered By : null Replied Date : Oct 10 2012
Answer :


Answered By : null Replied Date : Nov 9 2012
Answer :


Answered By : null Replied Date : Nov 16 2012
Answer :


Answered By : null Replied Date : Nov 23 2012
Answer :


Answered By : null Replied Date : Feb 26 2013
Answer :


Answered By : null Replied Date : Apr 29 2013
Answer :


 

You can also contribute to this answer:

Your Name:
Answer:

 
Ask Question and get answer from Expert.
View Answers List from Expert.

The information you are posting should be related to java and ORACLE technology. Not political.