2016-10-15 2 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 = (문자열) request.getAttribute ("testresults")에서

+0

같은
뭔가; ? 또는 outprint 라인? 이 물건에 정말 미안. @Oldskultxo –

+0

죄송합니다. 지금 모바일에서보세요. html 태그에 href 속성의 값을 설정해야합니다. – Oldskultxo

+0

정말 고마워, 좋은 하루 보내! @ 올드 스켈 톤소 –

관련 문제