Solved

jsp br tag is not working

Posted on 2013-01-29
4
836 Views
Last Modified: 2013-01-29
I am trying below jsp page

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>

<%!
public int add(int a, int b ){
return a+b;
}

 %>

<%
int i=10;
int j=11;
int k=i+j;

 %>
k value isssss <%=k %>


<%
int z=add(33,44);

 %>
 z value isssss <%=z %>
 
 
 <% for(i=0;i<5;i++){
 out.println("<br> i="+i);
 } %>
</body>
</html>

I am getting output like

k value isssss 21 z value isssss 77
i=0
i=1
i=2
i=3
i=4

I expected to see below lines

i=0
i=1
i=2
i=3
i=4

in bold letters.

I am not getting them in bold letters. Please advise. Any ideas, sample code, resources highly appreciated. Thanks in advance.
0
Comment
Question by:gudii9
  • 2
  • 2
4 Comments
 
LVL 9

Expert Comment

by:user_n
ID: 38831712
Try System.out.println("<br> i="+i);
0
 
LVL 7

Author Comment

by:gudii9
ID: 38831864
can i see some reference at
C:\Users\ganesha\Workspaces\MyEclipse 10_workspace\.metadata\.me_tcat\work\Catalina\localhost\JspProject\org\apache\jsp
0
 
LVL 7

Author Comment

by:gudii9
ID: 38831895
that did not help.


Now it is printing in console as below
INFO: Jk running ID=0 time=0/28  config=null
Jan 29, 2013 11:16:58 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 915 ms
<br> i=0
<br> i=1
<br> i=2
<br> i=3
<br> i=4


 which I do not want. I want it instead to be printed on the rendered page. please advise
0
 
LVL 9

Accepted Solution

by:
user_n earned 500 total points
ID: 38832002
k value isssss <%=k %>


<%
int z=add(33,44);

 %>
 z value isssss <%=z %>
prints
k value isssss 21 z value isssss 77
If you want to print in bold letters
try
out.println("<br><b> i="+i+"</b>");
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
even odd program using while loop 3 40
eclipse with Angularjs2.0 3 35
Custom Java Application connects to database: Which one of the 20? 4 27
servlet example 17 29
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
The viewer will learn how to implement Singleton Design Pattern in Java.

775 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