| | |
<jsp:forward> problems
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Jan 2008
Posts: 32
Reputation:
Solved Threads: 0
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)
This seems like such a novel problem, and I realise it probably has a simply solution.
Thanks for you help
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)
<%@ 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
![]() |
Similar Threads
- JSTL compare string (JSP)
- server transfering prolems for jsp application, plzzz help!!! (JSP)
- Help for learnign JSP (JSP)
- Opinions? javascript/php/etc and programming standards (JavaScript / DHTML / AJAX)
- hover over text tips (JavaScript / DHTML / AJAX)
Other Threads in the Java Forum
- Previous Thread: My First Tutorial in Java [Want your opinion]
- Next Thread: How to make the command window not come up while running an .exe in Java
| Thread Tools | Search this Thread |
2dgraphics account android api apple applet application array arrays automation banking binary binarytree bluetooth chat chatprogramusingobjects class classes client code component data database derby design eclipse encryption error event exception fractal game givemetehcodez graphics gui homework html ide if_statement image inheritance input integer interface j2me java javadesktopapplications javaprojects jlabel jni jpanel jtextfield julia linux list loop map method methods midlethttpconnection mobile monitoring netbeans newbie nullpointerexception open-source print printing problem program programming project property recursion reference ria scanner screen search server set size sms sort sourcelabs splash sql sqlite static stop string swing testautomation threads time tree ui unicode validation windows





