Solved

Changing font in JSP scripts

Posted on 2009-04-07
15
2,042 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
immutable object concept 5 143
difference between projection and projection list in hibernate 1 130
jdbc error in jsp application 20 91
eclipse buid path vs tomcat lib path 10 49
Had a business requirement to store the mobile number in an environmental variable. This is just a quick article on how this was done.
In this series, we will discuss common questions received as a database Solutions Engineer at Percona. In this role, we speak with a wide array of MySQL and MongoDB users responsible for both extremely large and complex environments to smaller singl…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

752 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