0

Am I able to change one the attribute become an URL(hyperlink) so user will be able to click on it and redirect to another page.

Any expert out there able to help me? Thank you so much and have a nice day!

<%@ 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>
  • Which line is `Hello.supersearchServlet.doGet(supersearchServlet.java:66)` ... could you comment that line in your post..? – Noushad Oct 15 '16 at 12:14
  • 1
    Possible duplicate of [How does the Java cast operator work?](http://stackoverflow.com/questions/840322/how-does-the-java-cast-operator-work) – prophet1906 Oct 15 '16 at 12:26
  • Is this line. String content = (String) d.get("content"); below the for thank you so much! @Noushad – Have a lot of question Oct 15 '16 at 12:40

2 Answers2

1

It looks like the error in this line:

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

d.get("content") is an ArrayList, not a String.

Serge Nikitin
  • 1,628
  • 5
  • 19
  • 27
0

This will do.

<a href="<%=testresults%>"><%=testresults%></a>
Cedric.L
  • 11
  • 4