This week's book giveaway is in the Testing forum.
We're giving away four copies of Practical Unit Testing with TestNG and Mockito and have Tomek Kaczanowski on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes Display problems Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Practical Unit Testing with TestNG and Mockito this week in the Testing forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply Bookmark "Display problems" Watch "Display problems" New topic
Author

Display problems

Lucky Singh
Ranch Hand

Joined: Jan 19, 2004
Posts: 125
I would like to display the following in my JSP. No compiling errors but the page doesnot display what I want.
<%
ABC abc = (ABC)(getServletContext().getAttribute("abc"));
int [] studId = abc.getStudentIDs();
for(int i=0; i<studId.length;i++)
{
out.println(bom.getStudentNames(studId[i]));
}
%>
How do I print in the following format in the JSP:
John
Mary
George
where John, Mary and George are hyperlinks.
Bear Bibeault
Author and opinionated walrus
Marshal

Joined: Jan 10, 2002
Posts: 50677

If you are going to be generating web pages, learning a bit about HTML markup might be a good idea.
Moving this to the HTML/Javascript forum.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Bear Bibeault
Author and opinionated walrus
Marshal

Joined: Jan 10, 2002
Posts: 50677

Along with the rest of the required HTML markup necessary to create a properly formatted web page, investigate the use of the <div> tag for formatting, and the <a> tag for creating hyperlinks.
Lucky Singh
Ranch Hand

Joined: Jan 19, 2004
Posts: 125
<%
ABC abc = (ABC)(getServletContext().getAttribute("abc"));
int [] studId = abc.getStudentIDs();
for(int i=0; i<studId.length;i++)
{
out.println(abc.getStudentNames(studId[i]));
}
%>
I tried-
out.println(< a href> abc.getStudentNames(studId[i]) </a> ; in the JSP Page.
It just prints abc.getStudentNames.
Please help.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15003
play with this........
out.println("<a href='#'>" + abc.getStudentNames(studId[i]) + "</a><br>");
Lucky Singh
Ranch Hand

Joined: Jan 19, 2004
Posts: 125
Thanks.
Lucky Singh
Ranch Hand

Joined: Jan 19, 2004
Posts: 125
But, why is the link not visible?
Its showing the name without the hyperlink.
 
 
subject: Display problems
 
Threads others viewed
Xpath with name space?
Program on Threads
Array Declaration
simple dating program
jsp:forward