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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T09:56:08+00:00 2026-05-25T09:56:08+00:00

Here is the scenario: I am developing a web application written in servlet JSP.

  • 0

Here is the scenario:

I am developing a web application written in servlet JSP.

Basically the controller looks at the action, invokes correct model class which dispatches to a particular JSP.

So for each distinct view there is a JPS. And there are many different UI views. (user’s dashboard, discussion forums, a particular thread in a discussion forum, inbox for PMs etc etc)

I am using jQuery and the way I have organized my code is as follows:

rootdir
   |______ jsp
   |_______ javescript

jsp directory has all the jsp file. For each jsp file there is a corresponding javascript file which holds my jQuery stuff ($.ready() … and everything related to that page). And every jsp file has a refermnce to that javascript file.

Now I have 50 jsp files, and hence 50 .js files.

Is there a better way to organize my javascript files.

–Jatin

  • 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-25T09:56:09+00:00Added an answer on May 25, 2026 at 9:56 am

    I usually build my javascript with general purpose uses in mind. For example, all navigation links that require javascript can more than likely be handled using a single .live() event that performs actions based on what the href of the link is or whatever data attributes are present.

    When it comes to jquery ui widgets such as datepicker and autocomplete, those can be defined globally using .live() aswell. If they need additional options, place them in a data attribute.

    <input type="text" class="autocomplete" name="someautompletename"
           data-options="{source: ['jQuery','Coldfusion','Railo','JavaScript']}" />
    

    …

    $(".autocomplete:not(.live)").live("click",function(e){
      var data = $(this).data("options");
      $(this).autocomplete(data ? data : {}).addClass('live').focus();
    });
    

    You could also build form handling to work the same way. By building your scripts this way, you can end up with a single js file that handles 90% of those jsp pages, while including additional files on the pages that need a little more(such as dialogs).

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

Sidebar

Related Questions

I am planning on developing my specific voip app for android. Here's the scenario:
Tackling a strange scenario here. We use a proprietary workstation management application which uses
Here's the scenario: A C# Windows Application project stored in SVN is used to
Here's the scenario: I have a textbox and a button on a web page.
We're developing a data heavy modular web application stack with java but have little
Here I came up with a scenario while developing a report, I need to
I'm developing a multilingual PHP web application, and I've got long(-ish) texts that I
Here's the situation: I'm developing a simple application with the following structure: FormMain (startup
Here's my scenario - I have an SSIS job that depends on another prior
Here is the scenario: I'm writing an app that will watch for any changes

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.