Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Changing font in JSP scripts

Posted on 2009-04-07
15
Medium Priority
?
2,054 Views
Last Modified: 2012-05-06
How changing font in JSP scripts and make it bold and italic

I need an example for that
0
Comment
Question by:bworld
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 3
  • +1
15 Comments
 
LVL 19

Accepted Solution

by:
Kuldeepchaturvedi earned 750 total points
ID: 24094398
Fonts are handled in HTML and not in jsp ( i.e. in the HTML that gets generated from your jsp)..

for bold you can but your text inside <B>

like

<B>this text will be bold</B>

similarly for italics you can use <i>

<i>this will be italic</i>

other than that you can make use of CSS and styling elements as well..
0
 
LVL 36

Assisted Solution

by:Loganathan Natarajan
Loganathan Natarajan earned 750 total points
ID: 24094428
You mean like this,


<%@ page errorPage="errorpage.jsp" %>
 
<html>
  <head>
    <title>Use Out</title>
  </head>
  <body>
    <%
      out.println("<center><b>Hello!</b></center>");
    %>
  </body>
</html>

Open in new window

0
 
LVL 36

Expert Comment

by:Loganathan Natarajan
ID: 24094436
As a JSP standard, you suppose to separate the html from the java code,

ref. http://www.javaworld.com/javaworld/jw-11-2001/jw-1130-jsp.html
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:bworld
ID: 24094500
What about changing font name and size ?

Can you complete your example ?
0
 
LVL 36

Expert Comment

by:Loganathan Natarajan
ID: 24094511
Ok,

try now

<html>
  <head>
    <title>Use Out</title>
  </head>
  <body>
    <%
      out.println("<center><b><font face='Arial, Helvetica, sans-serif' size='10'>Hello!</font></b></center>");
    %>
  </body>
</html>

Open in new window

0
 
LVL 19

Expert Comment

by:Kuldeepchaturvedi
ID: 24094512
as I said you can use Style for it

<P style="font:Arial, Helvetica, sans-serif; font-size:10px; font-style:italic" >your text here</P>
0
 
LVL 11

Expert Comment

by:Manish
ID: 24094855
If you have static HTML, you can directly paste in jsp, it will work fine.
If you need to change dynamically with using of java,
then you need to write code.
0
 

Author Comment

by:bworld
ID: 24095217
I using this code but I can't resize the font size


<%@page contentType="text/html; charset=windows-1256" errorPage="errorpage.jsp" %>
 
<html>
  <head>
    <title>Use Out</title>
  </head>
  <body dir=rtl>
    <%  
      out.println("<p style=\"font:Arial, Helvetica, sans-serif' font-size:'40px' font-style:italic\">Hello</p>");
    %>
  </body>
</html>

Open in new window

0
 
LVL 11

Expert Comment

by:Manish
ID: 24095764
No need of out.println. You can directly write html syntax in jsp.
    <p style=\"font:Arial, Helvetica, sans-serif' font-size:'40px' font-style:italic\">Hello</p>;

0
 
LVL 11

Expert Comment

by:Manish
ID: 24095797
sorry remove \
<p style="font:Arial, Helvetica, sans-serif' font-size:'40px' font-style:italic">Hello</p>;
0
 

Author Comment

by:bworld
ID: 24108949
There a paroblem the font size not change please check attach code in your machine
<%@page contentType="text/html; charset=utf-8" errorPage="errorpage.jsp" %>
 
<html>
  <head>
    <title>Use Out</title>
  </head>
  <body>
    <%
      //out.println("<center><b>Hello!</b></center>");
      //out.println("<center><b>ÞØÇÚ ÇáßåÑÈÇÁ</b></center>");	  
      out.print("<p style=font:'Arial, Helvetica, sans-serif' font-size:'20px' font-style:'italic'>Hello</p>");
    %>
	<p style=font:'Arial, Helvetica, sans-serif' font-size:'40px' font-style:'italic'>Hello</p>
	<strong><p style="font:Arial, Helvetica, sans-serif' font-size:'60px' font-style:italic">Hello</p></strong>
  </body>
</html>

Open in new window

0
 
LVL 19

Expert Comment

by:Kuldeepchaturvedi
ID: 24109356
iI believe both myself and karnaw have provided enough pointers and even code snippet. Now not everything can be given on a platter..
Furthermore, the original poster seems to expect everything to be done by experts here ( as evident from other questions). Most of the times he comes across as rude ( which may be a language barrier so I dont hold it against him).
0
 

Author Comment

by:bworld
ID: 24129970
I found the answer with my self thanks
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Read on to get a few ideas on how to promote your next corporate event.
While opting for any web-to-print solution, you need to discuss with your team and some of your end users and know their opinions about your decisions. In this article we list down some questions you need to ask yourself.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

719 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