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 9137347
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:05:33+00:00 2026-06-17T09:05:33+00:00

Is it a good practice to create different action for page loading and form

  • 0

Is it a good practice to create different action for page loading and form submission? let’s say I want to view to register to a website. Upon clicking the link for registration it will just go to a simple action that just typically redirects the page and on the registration form, and upon click the submit button, and the same action will also process the data to send it to the database?

or is it better to have a different action for form submissions?

  • 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-06-17T09:05:34+00:00Added an answer on June 17, 2026 at 9:05 am

    There’s no real “better or worse” for this scenario. It’s similar complexity, but different locality of functionality. I tend towards many small classes in general, but there’s another option.

    I tend towards Single Action, Multiple Methods, along with an interceptor that differentiates between GET and POST requests. The interceptor returns a known result for GET requests (e.g., "input") and allows normal processing for POST results (i.e., normal action invocation).

    This normalizes form handling and eliminates manual configuration of multiple methods for simple form handling scenarios across the entire application.

    Using the Convention plugin makes this less interesting, although doing it automatically is kind of pleasant: once you know the app’s GET/POST “secret” you never have to think about it again.


    To address your comment:

    The different functionality has to live somewhere.

    In S2 you have two ways of doing this: an action with multiple methods, or multiple actions. This is what I thought your question was addressing–which is “better”. (Answer: It depends.)

    The below uses XML config; annotations would be essentially the same.

    Using multiple actions can be trivially easy; one could even be the default action:

    <action name="login">
      <result>WEB-INF/jsps/login.jsp</result>
    </action>
    

    If there’s no form preparation, you’re done. Then you configure an action that does the login:

    <action name="doLogin">
      <result name="input">WEB-INF/jsps/login.jsp</result>
      <result type="redirectAction">home</result>
    </action>
    

    Using multiple methods is almost identical:

    <!-- If LoginAction extends ActionDefault, the "input()" method -->
    <!-- is supplied by the base class, and just returns "input".   -->
    <action name="login" class="com.foo.bar.LoginAction" method="input">
      <result name="input">WEB-INF/jsps/login.jsp</result>
    </action>
    
    <!-- Default action method is "execute()". -->
    <action name="doLogin" class="com.foo.bar.LoginAction">
      <result name="input">WEB-INF/jsps/login.jsp</result>
      <result type="redirectAction">home</result>
    </action>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it good in practice to create two different classes in one ruby script
I know it is good practice to keep your website entirely 'http://www' or http://,
When designing a website what would be good practice for the url designing and
Let's say I have two Databases like so : DatabaseA create table Table1 (
I would like to know if it's a good practice to create a static
I am looking for good practice or pattern to write a lib in JS.
Is it a good practice to have multiple XXX : DbContext classes for each
Is it good practice to use custom error levels on trigger_error() ? For example,
Is it good practice to set all text fields to nvarchar(MAX)? if im not
Is it good practice to have one shared SqlConnection object in a .NET application

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.