java - how to Display HTMLs, PDFs, Imges inside same JSP page -
java - how to Display HTMLs, PDFs, Imges inside same JSP page -
i new java/html/jsp. have jsp page(designed using eclipse running apache tomcat server) contain table. on left side of table have several href links htmls, pdfs, images. have created htmls folder, pdfs fodler , images folder within webcontent directory in project's workspace , stored respective files.
now when user clicks these links want respective file stored in directory displayed on right side within same page rather navigating other page or downloading it.
can suggest me how can accomplish that. here code
<body> <table style="width:1000px;" cellpadding="0" cellspacing="0"> <tr> <td colspan="2" style="background-color:#ffa500;"> <h1 style="margin:0;padding:0;">main title of web page</h1> </td> </tr> <tr> <td style="background-color:#ffd700;width:100px;vertical-align:top;"> <b><a href="/htmls/login.html" >html files</a></b><br> <a href="/pdfs/pdf file.pdf" >pdfs</a><br> <a href="/images/tulips.jpg" >images</a><br> <a href="/rar/a.zip" >rars</a> </td> <td style="background-color:#eeeeee;height:1000px;width:400px;vertical-align:top;"> </td> </tr> <tr> <td colspan="2" style="background-color:#ffa500;text-align:center;"> </td> </tr> </table> </body>
give iframe name
<iframe id="youriframe"name='youriframe' src=''></iframe>
and add together target='youriframe' links e.g.:
<a href='../html_folder/yourfile.html' target='youriframe' class="link">click!</a> <a href='../pdf_folder/yourfile.pdf' target='youriframe' class="link">click!</a>
give links need display class called link
have done in code above
dont think zip work.. in jquery
$('.link').click(function(e) { e.preventdefault(); // if have url in link var addressvalue = $(this).attr("href"); $("#youriframe").attr('src',addressvalue); }); });
this should work you
java html eclipse jsp href
Comments
Post a Comment