【问题标题】:Set one of the attribute become an URL (hyperlink)设置其中一个属性成为 URL(超链接)
【发布时间】:2016-10-15 12:10:53
【问题描述】:

我能否将属性更改为 URL(超链接),以便用户可以单击它并重定向到另一个页面。

有哪位专家可以帮助我吗?非常感谢,祝您有美好的一天!

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>

<%@page import="java.util.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link rel="stylesheet" type="text/css" href="2nd.css">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>THE SUPER SEARCH</title>
</head>
<body>
<h4>Here's the following results</h4>

<%
String testresults=(String)request.getAttribute("testresults");
out.print("" + testresults);
%>
<br>
<% 
String testcontent=(String)request.getAttribute("testcontent");
out.print("" + testcontent);
%>




</body>
</html>

【问题讨论】:

  • 哪一行是Hello.supersearchServlet.doGet(supersearchServlet.java:66) ...你能在你的帖子中评论那行吗..?
  • 是这条线。字符串内容 = (String) d.get("内容");非常感谢您! @Noushad

标签: java eclipse jsp servlets


【解决方案1】:

这行看起来像错误:

 String content = (String) d.get("content");

d.get("content") 是一个 ArrayList,而不是一个字符串。

【讨论】:

    【解决方案2】:

    这样就可以了。

    <a href="<%=testresults%>"><%=testresults%></a>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-07-20
      • 1970-01-01
      • 1970-01-01
      • 2011-08-02
      • 1970-01-01
      • 2013-07-15
      • 1970-01-01
      • 2011-07-02
      相关资源
      最近更新 更多