2016-10-15 14 views
0

属性を通常のテキストからURL(ハイパーリンク)に変更できるため、ユーザーはその属性をクリックして別のページにリダイレクトできます。文字列をクリック可能なURLに設定する

基本的に私は、サーブレットから入手属性がwww.stackoverflow.comですが、プレーンテキストでそう、私の質問は、私がクリック可能なリンクにそれを変更するにはどうすればよいですか?

どのようなエキスパートがそれを設定する方法を知っていますか?本当にありがとう、素敵な一日を!

<%@ 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> 
     <br> 
     <% 
      String testcontent=(String)request.getAttribute("testcontent"); 
      out.print("" + testcontent); 
     %> 
    </body> 
</html> 

答えて

1

<a>タグの中に入れます。

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

よろしく文字列testresults =(String)をrequest.getAttribute( "testresults")で

+0

よう
何か。 ?またはアウトプリントライン?申し訳ありません。 @Oldskultxo –

+0

申し訳ありません今、モバイルでIMを見てください。 htmlタグのhref属性の値を設定する必要があります。 – Oldskultxo

+0

ありがとう、素敵な一日を! @オールドスクリューソー –

関連する問題