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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T16:12:47+00:00 2026-05-11T16:12:47+00:00

Given the following Hello World servlet, how could you transfer the Hello World output

  • 0

Given the following Hello World servlet, how could you transfer the Hello World output out of the servlet code and put it in some kind of HTML templating format? I would like to simply call the template from the servlet and have it render the Java variables I refer to in the template – perhaps by referring to the “Hello World” string as a class variable in the SprogzServlet class?

package boochy;

import java.io.IOException;
import javax.servlet.http.*;

@SuppressWarnings("serial")
public class SprogzServlet extends HttpServlet
{
    public void doGet(HttpServletRequest req, HttpServletResponse resp)
            throws IOException
    {
        resp.setContentType("text/plain");
        resp.getWriter().println("Hello, world");
    }
}
  • 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-11T16:12:47+00:00Added an answer on May 11, 2026 at 4:12 pm

    It’s pretty rare to be doing Java Web development without using some kind of MVC framework that’ll delegate all views to JSPs (apart from PDF output and other corner cases) so you have:

    • JSPs;
    • Apache Velocity;
    • Freemarker.

    Some Web frameworks like Tapestry and JSF (“Java Server Faces”) are a little more like HTML views with extra tags.

    JSPs are ultimately just compiled to servlets anyway and tend to be a more convenient form for outputting HTML. Generally speaking I’d use them as a minimum rather than writing a heap of out.println() statements in a servlet directly.

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

Sidebar

Related Questions

I am looking for regular expression to get the match as HELLO and WORLD
Given the following which can be loaded into MS SAPI 5.1: <GRAMMAR LANGID=409> <RULE
Using jQuery 1.4.2 (IE8 in compatibility mode) Given the following structure: <div id='something'>something</div> <div
I have the following code to run python and get the result in scratch
I need to convert a QChar to a wchar_t I've tried the following: #include
I tried to use the read/write file descriptor in bash so that I could
I define a custom PowerShell type with New-Object. I would like a parameter to
I am making an attempt at building 64-bit native C++ applications under Visual Studio
I'm quite new to Ruby language (up to now I developed in Groovy +
this is my first time using Eclipse, and my first time programming in a

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.