When once form is submitted successfully....
but When I click on "BACK" button and trying submit same form
its gives me an error
Source:
<g:form action="addData" name="addValues" controller="emp" method="Post">
</g:form>
Controller Source:-
def editProfile (Long id,Long version){
withForm {
// code
}.invalidToken {
response.status = 405
}
}
Its hard to infer the cause of the error with what you have posted. However, you asked about how to prevent a page from resubmitting in Grails. Take a look at documentation. Grails has a build in support for that.
Basically you define a form with a token and using withForm
you will check if the token still is valid or not.
<g:form useToken="true" ...>
/
withForm {
// good request
}.invalidToken {
// bad request
}