943,696 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Unsolved
  • Views: 2055
  • Java RSS
Feb 26th, 2008
0

<jsp:forward> problems

Expand Post »
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)

java Syntax (Toggle Plain Text)
  1. <%@ page import="java.sql.*" %>
  2. <%@ page import="java.util.*" %>
  3. <%@ include file="connection.jsp" %>
  4.  
  5.  
  6. <%String value = request.getParameter("category"); %>
  7. <%=value%>
  8.  
  9. //The code below here prevents the WHOLE page showing returning nothing to the page that called the <jsp:forward>
  10. //whereas without the above two lines work correctly
  11.  
  12. <%
  13.  
  14.  
  15.  
  16. ResultSet columns1 = statement.executeQuery("SELECT * FROM Questions");
  17.  
  18. while(columns1.next())
  19. {
  20. id = columns1.getString("ID");
  21. Question = columns1.getString("Question");
  22. Answer = columns1.getString("Answer");
  23. Updated = columns1.getString("Stamp");
  24. Author = columns1.getString("UserID");
  25.  
  26.  
  27. %>
  28. <a href="custarea.jsp?question=<%=Question %>"><%=Question %></a> <br />
  29.  
  30. <%
  31. if (Question.equals(key))
  32. {
  33. %>
  34.  
  35. <table border="1">
  36. <tr>
  37. <td>
  38. <%= Answer %>
  39. <% session.setAttribute("key", key); %>
  40. </td>
  41. </tr>
  42.  
  43. <tr>
  44. <td align="right">
  45.  
  46. <form name="useful" action="addrating.jsp" method="get">
  47. Was this answer useful?
  48. <select name="useful" onChange="send()">
  49.  
  50. <option>-</option>
  51. <option value="Yes">Yes</option>
  52. <option value="No">No</option>
  53. </select>
  54. </form>
  55.  
  56. </td>
  57. </tr>
  58. </table>
  59.  
  60.  
  61. <%
  62. }
  63.  
  64. } %>

This seems like such a novel problem, and I realise it probably has a simply solution.

Thanks for you help
Similar Threads
Reputation Points: 10
Solved Threads: 0
Light Poster
eddy556 is offline Offline
32 posts
since Jan 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: My First Tutorial in Java [Want your opinion]
Next Thread in Java Forum Timeline: How to make the command window not come up while running an .exe in Java





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC