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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T08:42:23+00:00 2026-05-12T08:42:23+00:00

I’m trying to create a web user interface for a Java application. The user

  • 0

I’m trying to create a web user interface for a Java application. The user interface is going to be very simple, consisting of a single page with a form for users to pose their queries, and a results page — sort of like Google’s search engine or Ask.com.

I’m quite familiar with the base API of Java, but I don’t have much experience in using Java for Web environments (though I’ve used ASP.NET), so I’m looking for some advice:

  • What web application server should I use? Note that my interface is very light, and I just want something that is fast, easy to start/reset/stop and (re)deploy my application. Also, I need it to work on multiple environments, namely, GNU/Linux, Mac OS X, and Windows XP/Vista. Additionally, I’m using ant and Eclipse, so it would be great if I could easily add some ant targets for server management, and/or manage the server using the IDE. I’ve looked into Tomcat and Jetty, and the latter seems to be very light and easy to install and deploy. This is ideal, because the GUI is just for demonstration purposes, and I’ll probably need to deploy it in different computers. However, Tomcat has been around for a very long time, and it seems more mature.

  • As for the web pages, Java Server Pages look like a good fit, as they seem sufficiently simple for what I’m trying to accomplish (processing a form and outputting the result), but I’m all ears for suggestions.

  • I also have another requirement, which requires me to explain the “basic” workflow of the application: Basically, I have a class Engine which has a method run(String) which will process the user’s input and return the results for display. This class is the core of the application. Now, I’d like to instantiate this class only once, as it requires a lot of memory, and takes a very long time to startup, so I’d like to create it when the application/server starts, and store that reference for the entire span of the application (i.e., until I stop the server). Then, for each user request, I’d simply invoke the run method of the Engine instance, and display its results. How can this be accomplished in Java?

  • 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-12T08:42:23+00:00Added an answer on May 12, 2026 at 8:42 am
    1. App Server. You see Tomcat as heavy in terms of runtime footprint, or amount of learning or …? I would tend to chose something that has well established integration with an IDE. So Eclipse + Tomcat or Apache Geronimo, perhaps in it’s WebSphere Community Edition guise would do the job. From what I’ve seen these are sufficient for what you want, and the learning curves are really pretty manageable.
    2. Yes JSPs. You may yet find that your presentation needs become a tad more complex. The extra effort of going to JSF might yet pay off – nice widgets such as Date pickers.
    3. In your processing you will have a servlet (or an action class if you’re using JSF) that class can have a member variable of type Engine initialised on startup and then used for every request. The thing to bear in mind is that many users will hit that servlet, and hence that engine at the same time. Is your Engine safe to be used from more than one thread at the same time?

    To expand in this point. When implementing JSPs, there are two models refered to as (with some inventiveness) as Model 1 and Model 2. See this explanation.

    In the case of model 1 you tend to put code directly into the JSP, it’s acting in a controller role. Persoanlly, even when dealing with small, quickly developed apps, I do not so this. I always use Model 2. However if you choose you can just put some Java into your JSP.

    <%  MyWorker theWorker = MyWorkerFactory.getWorker();
        // theWorker.work();
    %>
    

    I woudl favour having a factory like this so that you can control the creation of the worker. The factory would have something like (to give a really simple example)

    private static MyWorker s_worker = new MyWorker();
    public static synchronized getWorker() {
           return s_worker;
    }
    

    Alternatively you could create the worker when that method is first called.

    In the case of model 2 you naturally have a servlet into which you are going to put some code, so you can just have

    private MyWorker m_worker = MyWorkerFactory.getWorker();
    

    This will be initialised when the servlet is loaded. No need to worry about setting it to load on startup, you just know that it will be initialsed before the first request is run.
    Better still, use the init() method of the servlet. This is guranteed to be called before any requests are processed and is the servlet API architected place for such work.

    public class EngineServlet extends HttpServlet {
    
    private Engine engine;
    
    // init is the "official" place for initialisation
    public void init(ServletConfig config) throws ServletException {
         super.init(config);
         engine = new Engine();
    } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 202k
  • Answers 202k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer foreach() is implemented using iterators - thus it only calls… May 12, 2026 at 8:19 pm
  • Editorial Team
    Editorial Team added an answer This was a relatively easy one in the end. Just… May 12, 2026 at 8:19 pm
  • Editorial Team
    Editorial Team added an answer I have discussed this with the IIS product team and… May 12, 2026 at 8:19 pm

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
In order to apply a triggered animation to all ToolTip s in my app,
I have a French site that I want to parse, but am running into
I have text I am displaying in SIlverlight that is coming from a CMS

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.