Solved

Changing font in JSP scripts

Posted on 2009-04-07
15
2,047 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 250 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 250 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
[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

 

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: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
This article is in regards to the Cisco QSFP-4SFP10G-CU1M cables, which are designed to uplink/downlink 40GB ports to 10GB SFP ports. I recently experienced this and found very little configuration documentation on how these are supposed to be confi…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

615 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