Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6913031
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:09:58+00:00 2026-05-27T09:09:58+00:00

I got a simple form validation and submission that works great Here is my

  • 0

I got a simple form validation and submission that works great

Here is my struts.xml :

    <action name="register" class="registerAction">
        <interceptor-ref name="defaultWithoutAuthenticationStack"/>
        <result type="tiles" name="input">
            <param name="titleKey">global.title.register</param>
            <param name="location">register</param>
        </result>
        <result type="tiles" name="success">register.success</result>
    </action>

My jsp form :

<s:form method="post" action="register.action" validate="true">
    <s:textfield name="usernameRegister" id="usernameRegister" key="global.username" labelposition="left" />
    <s:password name="passwordRegister" id="passwordRegister" key="global.password" labelposition="left" />
    <s:password name="passwordConfirmRegister" id="passwordConfirmRegister" key="global.password.confirm" labelposition="left" />
    <s:textfield name="emailRegister" id="emailRegister" key="global.email" labelposition="left" />
    <s:submit key="global.register" name="submitRegister" method="goRegister"></s:submit>
</s:form>

And my submit function :

public String goRegister(){
    user.setUsername(getUsernameRegister());
    user.setPassword(getPasswordRegister());
    user.setEmail(getEmailRegister());
    userService.addUser(user);

    ArrayList<String> successMessageUsername = new ArrayList<String>();

    successMessageUsername.add(getUsernameRegister());
    this.addActionSuccess(getText("global.register.success", successMessageUsername));
    return SUCCESS;
}

Nothing fancy !

The problem is I got a windows asking for resubmit form informations when I refresh my page on success page or form page (when validation failed)

How can I prevent that ?

Thx

EDIT : I add the action messages and fields messages preservation to my question
How to preserve the actions messages and fields messages (validation) with a redirection ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T09:09:59+00:00Added an answer on May 27, 2026 at 9:09 am

    Use the post-redirect-get pattern.

    On success, redirect to the “you’ve registered” page. That way if the user refreshes, they just get that same page again.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a simple form like so (illustrative purposes only)... <form> <div class=input-row> <label>Name</label>
I've got a simple form in Django, that looks something like this: class SearchForm(forms.Form):
I've got a simple form that creates Categories with a name and a List
I've got a simple form on a User page that allows a User, once
I've got a very simple Windows Form app that hits an IIS 7 site
I've got a very simple cfform with a single form field: <cfform action=asdf.cfm method=post>
I have a PHP form that needs some very simple validation on submit. I'd
I've got a simple form that enables users to enter a promotional code and
I've got a simple form where I'm trying to align two fields horizontally that
I've got a simple form on a webpage (that doesn't actually submit any info),

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.