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

The Archive Base Latest Questions

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

I’ve been fortunate enough to inherit a project which uses a platform that only

  • 0

I’ve been fortunate enough to inherit a project which uses a “platform” that only allows JSP. The platform is basically tomcat and we get our own directory where we place our JSPs and JARs. There’s no servlet support for us (we don’t have access to a web.xml) and even JSTL isn’t supported. I tried adding the JSTL jars and <c:out value="blah" /> works, but expressions don’t work. Using <c:set var="test" value="blah" /> isn’t helpful since I cannot access the var using EL (<c:out value="${test}" /> just prints “${test}”).

The project currently consists of only JSPs with Java expressions throughout and it’s quite a mess. I’m trying to clean it up by moving the Java code to classes, but am wondering if there’s some easy way to mimic the servlet/MVC behavior.

All I can think of right now is to have the following. Does this seem like the best solution? I’m used to using Spring or at least servlets…

  1. HTML form clicked
  2. JSP file (call Java Controller)
  3. Controller (handle content, redirect/forward to view)
  4. JSP view

somePage.jsp

<form action="control/someController.jsp" method="post">
    <input type="submit" />
</form>

someController.jsp

<%
    SomeController sc = new SomeController(request, response);
    sc.doSubmit();
%>

SomeController.java

public class SomeController extends AbstractController {

    public SomeController(HttpServletRequest request,
            HttpServletResponse response) {
        super(request, response);
    }

    protected void handleSubmit() {
        // do stuff ...
        redirect("nextPage.jsp");
    }
}
  • 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-23T00:42:06+00:00Added an answer on May 23, 2026 at 12:42 am

    This is doable. But the recreation of the classes on every request is pretty expensive. I would also just extend them from HttpServlet the usual way. I’d create a factory class which loads all servlets statically. You’re then basically taking over the job the servletcontainer is doing based on web.xml.

    public final class ServletManager {
    
        private static final Map<String, HttpServlet> servlets = new HashMap<String, HttpServlet>();
    
        static {
            servlets.put("controller1", new Controller1());
            servlets.put("controller2", new Controller2());
            servlets.put("controller3", new Controller3());
            // ...
        }
    
        public static HttpServlet get(String name) {
            return servlets.get(name);
        }
    
    }
    

    This way you can implement servlets the usual way by creating classes which extends HttpServlet.

    Let your forms submit to a generic JSP

    <form action="controller.jsp?controller=controller1" method="post">
    ...
    <form action="controller.jsp?controller=controller2" method="post">
    ...
    

    where the controller.jsp look like this

    <% 
        HttpServlet servlet = ServletManager.get(request.getParameter("controller"));
    
        if (servlet != null) {
            servlet.service(request, response);
        } else {
            // Handle non existing controller.
        }
    %>
    

    (note that you should not have any whitespace beyond the <% %> in this controller.jsp, also no newlines, otherwise the response may be committed and your servlets would be unable to forward/redirect the request/response)

    Or when your servletcontainer doesn’t extract the parameters from the query string in case of POST, instead use

    <input type="hidden" name="controller" value="controller1" />
    

    Finally, this way the app is more easier to transform whenever the web.xml is available for use. You just have to create the web.xml and change the form URLs.

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

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into

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.