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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T04:38:46+00:00 2026-05-19T04:38:46+00:00

In my struts 2 web app, there are several menu tabs on a webpage.

  • 0

In my struts 2 web app, there are several menu tabs on a webpage. These menu tabs fire ajax actions when clicked. All these actions come to a single action class. This action class routes the request to a helper class. The helper class has a method that does :
If action = this, do this
If action = that, do that
And so on….for each action(i.e each tab).
Can someone offer comments on this design….is this a correct use of struts 2? Or should we have separate action classes?
Also, any standard practices for the helper class?(i.e should it be static, singleton, thread safe etc.)

  • 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-19T04:38:46+00:00Added an answer on May 19, 2026 at 4:38 am

    Couple of thoughts:

    • There’s nothing wrong with using an Action class to handle multiple struts2 actions; struts2 allows you to route a particular action to a method of a class. That can be helpful if the class itself is a useful organizing device. For example, you might have a Widget that you want to Create, Read, Update, etc and rather than have a CreateWidgetAction, ReadWidgetAction, etc set of classes that will cause a lot of clutter, it’s nicer to simply have a WidgetAction class that has create(), update(), etc methods on it. I am guessing it’s less of a nice fit in your case, given what you describe (different menu tabs), but you can certainly do it. Less files to look at while maintaining code.

    • Note that you will need to map different actions to these different methods as well as different JSPs that render the results.

    • With regards to the helper class, my advice is to put view + controller related logic in the Action class(es), but leave the model logic in other classes (possibly your helper class). If your helper class is computing data independent of presentation, this is certainly legitimate. But if your helper class is simply preparing a view, put the logic in the Action itself.

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

Sidebar

Related Questions

I inherited this gigantic legacy Java web app using Struts 1.2.4. I have a
I inherited this gigantic legacy Java web app using Struts 1.2.4. I have a
I have recently inherited a J2EE Struts web app that was written back in
I am working on a Java web app that uses Struts 2 with the
I've recently inherited a internationalized and text-heavy Struts 1.1 web application. Many of the
I am developing a web application using Struts 2.1.2 and Hibernate 3.2.6.GA. I have
Almost every new Java-web-project is using a modern MVC-framework such as Struts or Spring
A friend of mine is now building a web application with J2EE and Struts,
I use struts-html to generate forms fields. For example: <%@ taglib prefix=html uri=/WEB-INF/taglibs/struts-html.tld %>
I am used to develop web applications in Java (Struts, Spring, JSP...). But now

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.