Solved

Changing font in JSP scripts

Posted on 2009-04-07
15
2,020 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
 

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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
For cloud, the “train has left the station” and in the Microsoft ERP & CRM world, that means the next generation of enterprise software from Microsoft is here: Dynamics 365 is Microsoft’s new integrated business solution that unifies CRM and ERP fun…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) 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…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

757 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

18 Experts available now in Live!

Get 1:1 Help Now