Hi,
I have a JSP which searches through a database of categories and displays each one with a unique link if clicked. When the link is clicked it sends it to itself and saves it into a variable. <jsp:forward> is then called which should send the variable as a parameter to the next page.
This is working correctly and I can retreive the parameter on the net page.
The funny thing is the next page only returns to the calling page information if I have little code in it, otherwise it is completely blank! Hopefully you can see from the code that the first two lines work correctly ONLY if I ommit the rest (below the comments)
<%@ page import="java.sql.*" %>
<%@ page import="java.util.*" %>
<%@ include file="connection.jsp" %>
<%String value = request.getParameter("category"); %>
<%=value%>
//The code below here prevents the WHOLE page showing returning nothing to the page that called the <jsp:forward>
//whereas without the above two lines work correctly
<%
ResultSet columns1 = statement.executeQuery("SELECT * FROM Questions");
while(columns1.next())
{
id = columns1.getString("ID");
Question = columns1.getString("Question");
Answer = columns1.getString("Answer");
Updated = columns1.getString("Stamp");
Author = columns1.getString("UserID");
%>
<a href="custarea.jsp?question=<%=Question %>"><%=Question %></a> <br />
<%
if (Question.equals(key))
{
%>
<table border="1">
<tr>
<td>
<%= Answer %>
<% session.setAttribute("key", key); %>
</td>
</tr>
<tr>
<td align="right">
<form name="useful" action="addrating.jsp" method="get">
Was this answer useful?
<select name="useful" onChange="send()">
<option>-</option>
<option value="Yes">Yes</option>
<option value="No">No</option>
</select>
</form>
</td>
</tr>
</table>
<%
}
} %>
This seems like such a novel problem, and I realise it probably has a simply solution.
Thanks for you help :)