• Post Reply Bookmark Topic Watch Topic
  • New Topic

Display problems  RSS feed

 
Lucky Singh
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ninkuma
Marshal
Posts: 66304
152
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66304
152
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<%
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
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
play with this........
out.println("<a href='#'>" + abc.getStudentNames(studId[i]) + "</a><br>");
 
Lucky Singh
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks.
 
Lucky Singh
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But, why is the link not visible?
Its showing the name without the hyperlink.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!