• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

please advise me on this

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
this is not right:
<script language="javascript:alert('Congratulations!!! You have been successfully registered');"/>
code it like the other one!
reply
    Bookmark Topic Watch Topic
  • New Topic