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

  • Home
  • SEARCH
  • 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 8193233
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T04:24:56+00:00 2026-06-07T04:24:56+00:00

The current application I’m working on is a traditional J2EE application from 2003!, with

  • 0

The current application I’m working on is a traditional J2EE application from 2003!, with a JSP based front-end, and some service tiers that are the usual suspects (Auth, DAOs etc.).

Trouble is, the front-end is a mess. No MVC, no templating, no nothing. Developers over the years have written code straight into JSPs (I mean massive chunks of Java code), and at some point in those chunks, the control flow passes into the service tiers. It’s a pain to read and debug.

I’m writing new functionality for this application, and have to do it in a fairly unobtrusive way. Anything that changes xml configs, or classpath settings etc., is generally discouraged.

My question is: Given nothing but JSPs as entry points into the application, how to best go about writing the cleanest possible code under these constaints?

I’m making ajaxian modules (jQuery available in project svn already), so my JavaScript and JSPs typically look like these:

JavaScript:

jsAjaxCall({
    url: 'myActionURL.jsp',
    method: 'post',
    params: {},
    success: function(data){
    },
    failure: function(data){
    }
});

myActionURL.jsp

<%
    //entry into server tiers
    SomeEntryPointClass entry = new SomeEntryPointClass(request);
    String responseString = entry.doYourJob();
    PrintWriter out = response.getWriter();
    out.print(responseString);
    out.flush();
%>

Questions:

  1. The idea is to keep Java Code inside JSPs at an absolute minimum,
    and handoff the request object to a front-facing (what an thing to
    name it!) object as soon as possible. Is this a reasonably correct
    approach given the constraints?
  2. What are the additional things I can do to keep things clean and
    well organized? (I’ve already rolled my own classes for binding
    request parameters to domain objects, so that’s a nice plus too).
  3. How do I do PAINLESS form validation in a situation like this? I’m
    missing Spring MVC’s validation! Just can’t imagine all the manual hoopla and routing and binding mess with nothing but JSPs! 🙁
  • 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-07T04:24:56+00:00Added an answer on June 7, 2026 at 4:24 am

    The good news is that jsp’s compile into servlets. This ofcourse is good news as it will allow you to use your jsp’s in the way you would normally use servlets.

    Keeping your java usage in the jsp’s and passing off to helper objects ( couldn’t bring myself to say front facing) is the correct call as:

    1) There is a hard limit to how big your jsp files can get

    2) writing unit tests from jsps is harder than pure classes

    3) most IDEs won’t give you the same level of code writing support for java embedded in a jsp that they do for normal classes

    4) debugging will be easier

    As for your second question if it is jsp 2 you could look at using custom tags, they can be a useful way to organise jsp heavy code.
    Additionally I guess if you want to go ajax the whole way and are feeling cunning you could write jsp pages designed to provide you Json objects. Effectively turning your jsp’s into front end services.

    As for the third option, I’m sorry but your system sounds anything but painless.
    With strut’s or jsr303 or spring mvc or even new servlets validation is going to be a bit painful.

    Ofcourse if you wrote a validation jsp which returned a validated json object (see suggestion above) it might make your life a little easier.

    Good luck

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

Sidebar

Related Questions

I'm deserializing some XML from an old application into an object in my current
Current Application Server Configuration: IIS 6.0 Windows 2003 Server Standard Edition SP2 .NET Framework
My current application needs to get data from a file to initialize its attributes.
The current application that I'm working on seems to recycle the application pool very
My current application I am working on has following line at response fields: Server:
The current application that I'm working on is a Client - Server C# application
A website that I'm working on is making extensive use of the HttpContext.Current.Application store
I'm working on an embedded system. The directory /root/txpa/images/current/application/bin contains the file qt.conf ,
In the current application I am working on I have a custom ControllerFactory class
Can I store something in HttpContext.Current.Application[MyData] accessing that from javascript?

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.