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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:28:08+00:00 2026-05-23T02:28:08+00:00

Currently coding a very simple web application where I am building the framework from

  • 0

Currently coding a very simple web application where I am building the framework from scratch ( MVC design) .
I do not have issues with the code, my questions is related to the design.

I will explain the scenario what I am trying to do.

Planning to do the following:

In a JSP I have a html form for user input and a button which will submit it.

Click the submit button:

An ajax call will be made to an Initial Processing Servlet, whose task is to go through every input paramter and validate them (server side validation).
The reason I want to use ajax, is because I want to be able to display the “error messages after input validation” without actually refreshing the page

In the Initial Processing Servlet:

If there are any input validation error (ex:wrong email format, invalid date etc), then send back response to the parent JSP with the error messages.

If no validation error was encountered, then forward request to the next Servlet which will in turn process the request and display the next JSP.

My Questions:
Assume there were no validation errors in the form input. (This is where my dilemma arises).

  1. Wouldn’t the first JSP’s ajax call be left hanging waiting for some kind of response?
  2. Is it OK that that we don’t plan on sending back a response to an ajax call?
    (I am assuming that these requests might eventually timeout. But I just feel uncomfortable about this.)

  3. Is there a better way to do what I am trying to do?

PS:
I don’t want to make two separate calls to the server when submit button is clicked. Explained below

  1. Ajax Call 1: validate form. (send back success or error message)
  2. if ajax call returns success then submit form normally. (I would have to do validations twice if I use this method which is inefficient.)
  • 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-23T02:28:09+00:00Added an answer on May 23, 2026 at 2:28 am
    1. Yes, it would be left hanging. Return a 1 or something from the Ajax call to give it the green light to proceed

    2. It is ok in the sense of server resources, but your user will be left hanging until a timeout is reached. Very bad practice.

    3. Struts or Spring validation layers will do exactly what you want to do. Most of the major frameworks provide this functionality

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

Sidebar

Related Questions

I am currently coding a simple Data Access Layer, and I was wondering which
I am currently coding a website for a band and i have a music
I am currently trying to stream content out to the web after a trans-coding
I'm currently working at home, but it's not always an ideal environment for coding.
I'm working on a very graphic-heavy application which uses content from a bunch of
I have been trying to integrate my very simple voice recorder app with the
Currently, my level of understanding is below all the coding examples on the web
I'm currently developing a Java-based library for network coding (http://en.wikipedia.org/wiki/Network_coding). This is very CPU-intensive
Currently my workflow with Emacs when I am coding in C or C++ involves
We are currently going through the long process of writing some coding standards for

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.