aspose file tools*
The moose likes JSP and the fly likes JSP redirect problem. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "JSP redirect problem." Watch "JSP redirect problem." New topic
Author

JSP redirect problem.

Ikasari Widiyanto
Greenhorn

Joined: May 31, 2004
Posts: 29
Hi,

I got a problem in jsp I hope somebody can help me...
I have a form tag like this:

<form name="form1" method="post" action="request_action1.jsp?action=addmorerequest?requestNo=<%=requestNo%>">

then the request_action1.jsp is something like this:

if(action.equals("addmorerequest"))
{
System.out.println("I'm here");
String requestType = request.getParameter("requestType");
System.out.println("requestType:" + requestType);
String requestNo =request.getParameter("requestNo");
System.out.println("requestNo:"+requestNo);
String description = request.getParameter("description");
System.out.println("description:"+description);
String totalcost = request.getParameter("totalcost");
System.out.println("totalcost:"+totalcost);
String unitcost = request.getParameter("unit_cost");
System.out.println("unitcost:"+unitcost);
String quantity = request.getParameter("quantity");
System.out.println("quantity:"+quantity);
String supplier = request.getParameter("supplier");
System.out.println("supplier:"+supplier);
String verifyppl =request.getParameter("verifyppl");

try
{
sql = "UPDATE requestheader SET detail = 'Y' WHERE requestNo = "+requestNo;
stmt.executeUpdate(sql);
System.out.println("sql1");
sql = "insert into requestdetail (requestNo, supplier, createdBy, createdOn, quantity, unitcost, totalcost, description) values ('"+requestNo+"', '"+supplier+"', '"+userId+"',now(),"+quantity+", "+unitcost+", "+totalcost+", '"+description+"')";
stmt.executeUpdate(sql);
System.out.println("sql2");
sql = "insert into actionrecord (refid, category, actions, fromppl, toppl, remark, createdDate) values ('"+requestNo+"', 'Request', 'Require Verify', '"+userId+"', '"+verifyppl+"', '', now())";
stmt.executeUpdate(sql);
System.out.println("sql3");
stmt.close();
}catch (Exception e)
{
System.out.println("error:" + e.getMessage());
}
%>
<script>
var id = "<%=requestNo%>"
alert ('This request No '+id+' has been added')
</script>
<%
response.sendRedirect("addRequestDetails.jsp?form=addDetails&requestNo="+requestNo);
System.out.println("end of the script");
//}
//out.print(sql);
}
%>

when I try to run it then the page is blank... can any body help me to debug this?
Shailesh Chandra
Ranch Hand

Joined: Aug 13, 2004
Posts: 1081

there are number of system.out.println

which is last system.out.println you can see

is there any exception ???


Gravitation cannot be held responsible for people falling in love ~ Albert Einstein
Praful Thakare
Ranch Hand

Joined: Feb 10, 2001
Posts: 641


1) I guess the second ? must be replaced with &
2) As Shailesh said chek out which is the last System.out.pritln
executed sucessfuly
3) There is no out.println() in this code so nothing will be printed other
then an alert box,is it poping up ?
4) if this page works fine without exception then chek out
addRequestDetails.jsp as you are redirecting request to this page

Cheers
-Praful


All desirable things in life are either illegal, banned, expensive or married to someone else !!!
Ikasari Widiyanto
Greenhorn

Joined: May 31, 2004
Posts: 29
ok... thanks..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSP redirect problem.