<%while(rs.next()){%>
<%String path;%>
<tr>&nbsp;&nbsp;&nbsp;
</tr>
<tr>
<td><a  href="#"><%="★ "+ rs.getString("STitle")%></a>
</td>
</tr>
<%}%>rs 是 ResultSet的对象
我这个是一个动态连接:<%="★ "+ rs.getString("STitle")%>这是连接的文字;
<a href="#">是需要连接的目的文件(暂定打开txt格式)地址;连接后能将该文件的内容能在跳转后的html页面上显示.下面的格式我试了,错误:
<a  href=" 'file:///'+<%=path=rs.getString("SCreatPath")%>"><%="★ "+ rs.getString("STitle")%></a>
谁知道,谢谢!

解决方案 »

  1.   

    不能用file:/// 这通常是本地文件。
    要用http://ip/appname/<%=path=rs.getString("SCreatPath")%>
      

  2.   

    <a  href=" 'file:///'+ <%=path%>+<%=rs.getString("SCreatPath")%>">
      

  3.   

    <a  href="./<%=path=rs.getString("SCreatPath")%>"> <%="★ "+ rs.getString("STitle")%> </a> 
      

  4.   

    楼主问的应该是一个绝对链接和相对链接的问题吧。如果用绝对链接的话,<a href="http://localhost/files/file.txt"> 或者 ,<a href="/files/file.txt"> 
    http://localhost/files/file.txt 是你要显示的txt文件的绝对路径,即你输入这个路径直接可以打开这个txt文档。如果用相对链接的话,<a href="files/file.txt">或者 ,<a href="../files/file.txt">
    files/file.txt 这个路径和你的当前页面的位置有关
      

  5.   

    那<a href="http://localhost/files/file.txt">中 files代表什么,能不能给我举个例子,谢谢!