• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Display problems

 
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks.
 
Lucky Singh
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But, why is the link not visible?
Its showing the name without the hyperlink.
 
reply
    Bookmark Topic Watch Topic
  • New Topic