File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes please advise me on this Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "please advise me on this" Watch "please advise me on this" New topic
Author

please advise me on this

Prasenjit Das
Greenhorn

Joined: Aug 12, 2003
Posts: 10
hi folks,
I really dont know why this is coming and what to do about this.
I have a jsp page..a simple registration form...on clicking the submit button, i am setting a hidden parameter in a js function and reloading the page....
in the body of the page i have given an if condition using the hidden paramter to upload the db table ...
<code>
if(request.getParameter("param")!=null && request.getParameter("param").equals("1"))
{
str_FirstName=adjquotes(request.getParameter("txt_FirstName"));
str_MiddleName=adjquotes(request.getParameter("txt_MiddleName"));
str_LastName=adjquotes(request.getParameter("txt_LastName"));
int_age=Integer.parseInt(request.getParameter("txt_Age"));
str_address = adjquotes(request.getParameter("txt_Address"));
str_city = adjquotes(request.getParameter("txt_City"));
str_state = adjquotes(request.getParameter("txt_State"));
int_zip = Integer.parseInt(request.getParameter("txt_Zip"));
str_country = adjquotes(request.getParameter("txt_Country"));
str_email = adjquotes(request.getParameter("txt_Email"));
//construct the insert statement
str_insert="insert into tr_registration(first_name,middle_name,last_name,age,address,city,state,zip,country,reg_dt,email) values('"+str_FirstName+"','"+str_MiddleName+"','"+str_LastName+"','"+int_age+"','"+str_address+"','"+str_city+"','"+str_state+"',"+int_zip+",'"+str_country+"',to_char(sysdate,'dd/mm/yyyy'),'"+str_email+"')";
System.out.println(str_insert);
i=stmt.executeUpdate(str_insert);
if(i!=0)
{%>
<script language="javascript:alert('Congratulations!!! You have been successfully registered');"/>
<%
response.sendRedirect("home.jsp");
System.out.println("After the sendRedirect");
}
else
{
%>
<script language="javascript"> alert("Sorry there was a problem with the registration, Please try again");</script>
<%}
// mail.send(str_email);

}

Now i am facing 2 problems
i) those javascript alerts are not coming. is there something wrong there?
ii) when i do a response.sendRedirect to that home.jsp; the page is opening fine, but even after the page has opened in the status bar i am getting...
opening home.jsp.....
PLzz help ....
Regards,
Prasenjit
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
this is not right:
<script language="javascript:alert('Congratulations!!! You have been successfully registered');"/>
code it like the other one!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: please advise me on this