| Author |
Call servlet in a href tag
|
Deepak Chawla
Ranch Hand
Joined: Nov 19, 2003
Posts: 50
|
|
I have this code writtn in JSp, it list me all the files and i want that when i click on these files, it should invoke a servlet which displays the contents of files, the name f the servlet is viewAttachment, i don't how to invoke servet inside a href tag. plz help <% int filesdisplay = filenames.length; for(int i =0;i<filesdisplay;i++) { out.write( "<a href='docs/" + filenames[i] + "'>" + filenames[i] + "</a>" ); } %>
|
 |
Sri Basavanahally
Ranch Hand
Joined: Oct 07, 2003
Posts: 75
|
|
Deepak, IS Docs your application context or root ? If so, you can say "Docs/servlet/viewAttachment" in your A HREF. -Sri
|
UP THE IRONS !
|
 |
Tim Baker
Ranch Hand
Joined: Oct 04, 2003
Posts: 541
|
|
if docs is the context i think you want something like out.write( "<a href='docs/servlet/viewAttachment?file=" + filenames[i] + "'>" + filenames[i] + "</a>" );
|
Kim Jong II (North Korea's Dear Leader) said:Nuclear weapons don't kill people, people kill people.
|
 |
 |
|
|
subject: Call servlet in a href tag
|
|
|