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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T00:06:55+00:00 2026-05-17T00:06:55+00:00

1) In my servlet program, I have a statement which will be printed using

  • 0

1) In my servlet program, I have a statement which will be printed using the code as follows,

    out.println("<b>This is servlet output</b>");

Instead of getting printed in bold, it just gets printed with the tag in the broswer itself.

How to rectify the same?

2) Also, in the servlet page after the submission of a jsp form, I want to add the below HTML tag inside the java code of the servlet program.

    <a href="upload.jsp">Go to JSP form</a>

How to achieve the same? Please advise.

  • 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-17T00:06:56+00:00Added an answer on May 17, 2026 at 12:06 am

    1) The browser is interpreting your output like text, try adding

    response.setContentType("text/html");
    

    This line tells the browser that you’re sending HTML and that it should be interpreted that way.

    2) The same as bold text

    out.println("<a href=\"upload.jsp\">Go to JSP form</a>");
    

    On a related note, I’d suggest that none of your Servlet class directly write HTML content to the response page. Servlet are made to handle forms, and aren’t easy to use when it comes to write HTML responses.

    Once thing you can try is to write the response in a JSP page, then forwarding the request to the JSP so it can handle user output.

    Here is a sample:

    1) servet_output.jsp

    <b>My bold test</b>
    <a href="upload.jsp">Go to JSP form</a>
    

    2) Your servlet redirects to the JSP page:

    request.getRequestDispatcher("servlet_output.jsp").forward(request, response);
    

    This way, your servlet handles the request, and the JSP takes care of writing the response to the browser.

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

Sidebar

Related Questions

I have a servlet program. This is my code: public class CompanionProxy extends HttpServlet
I have this servlet program and an external .jar file (written by someone else)
I have developed a simple server using Tomcat which runs a servlet. The servlet
I have a problem with my program. I have a servlet; in this servlet
Unix gurus! I have a Java program which passes some parameters to a Servlet
I have a web application developed using JSP and Servlet. This web application is
Using servlet 2.3 is there a way to log a user out when he
I have a web servlet that returns a json which is stored in my
I have connected Java program to Oracle database using JDBC. I want to store
I have written sample program which uses XSLT to generate HTML response. Check below

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.