Solved

Changing font in JSP scripts

Posted on 2009-04-07
15
2,031 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
  • 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
ScreenConnect 6.0 Free Trial

Want empowering updates? You're in the right place! Discover new features in ScreenConnect 6.0, based on partner feedback, to keep you business operating smoothly and optimally (the way it should be). Explore all of the extras and enhancements for yourself!

 

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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
console vs log file 16 81
caughtSpeeding java challenge 16 136
Is possible to make a jsp script work with oracle wallet? 7 101
runtime exception and error differences 4 78
This tutorial shows how to create a greeting card by combining two image layers and a text layer on a PC using a free image editing app.
Color can increase conversions, create feelings of warmth or even incite people to get behind a cause. If you want your website to really impact site visitors, then it is vital to consider the impact color has on them.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

770 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