String variables in HTML/JSP

Posted on 2006-03-22
Last Modified: 2010-04-01
Is is possiblt to have a variable in a HTML/JSP tag instead of a hard coded value.

For example (This is a Servlet snippet)

out.println ("<p><font size=\"3\" color=\"red\"> <b> Hello <br /> </font></b> </p>"  );

Is there a way for me to make the ' Hello' into a variable? so I could change and display the message
according to my requirement?

Question by:prain
    LVL 10

    Accepted Solution

    Hi prain,

    I don't know if you are looking after such a simple solution!

        String msg = "Hello";
    <p><font size="3" color="red"><b><%=msg%><br/></font></b></p>


    Author Comment


    Opps. Thanks radarsh. Sorry, you have to excuse me for asking that question. You know sometimes licensed drivers also do mistakes. :-) . To say the truth, I am totally new to this HTML/JSP business and about 2 weeks ago only I started serious programming on these. So until I get a good handle on the wheel, I would do traffic violations.

    Thanks any ways for all your help, including the previous answers. That helps me a lot.
    Crusing well and learning well.

    LVL 10

    Expert Comment


    Good Luck in your adventure! :)


    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    Join & Write a Comment

    Exchange server is not supported in any cloud-hosted platform (other than Azure with Azure Premium Storage).
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now