What is wrong in my JSP?

Hi, Please see the code below. The problem I am facing is when the User already exists in the database, I am letting the user know that there is already an user with that name and asks him / her to repeat filling up the form again(" using printContent() method"). But, I do get it working only when the user is already present in the database. If the user is not available then I am able to register him / her and show him the success page, The main problem lies here, I do not know why but the method printContent() is getting called always. Please see the code and correct me.
Uma
<%@ page import="java.sql.*,java.io.*,javax.servlet.*,javax.servlet.http.*,java.util.*" %>
<html>
<%!
     String iam,seeking,lookingfor,firstname,lastname,address,city,state,country,email;
     String userid,password1,password2,newsletter,offers,totdate,phone,remoteuser;
     int slno,pincode,count=0,month,date,year,iPhone=0;
     Connection con = null;
     Statement st,st1;
     ResultSet rs,rs1;
     Calendar cal;
     java.sql.Date sqlDate;
%>
<%
     try
          Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
          con = DriverManager.getConnection("jdbc:odbc:umasql","sa","bhavanid");
          st = con.createStatement();
          st1 = con.createStatement();
          iam = request.getParameter("gender");
          seeking = request.getParameter("genderwanted");
          lookingfor = request.getParameter("lookingfor");
          firstname = request.getParameter("firstname");
          lastname = request.getParameter("lastname");
          address = request.getParameter("address");
          city = request.getParameter("city");
          state = request.getParameter("state");
          country = request.getParameter("country");
          pincode = Integer.parseInt(request.getParameter("zipcode"));
          email = request.getParameter("email");
          //phone = Integer.parseInt(request.getParameter("phone"));
          phone = request.getParameter("phone");
          month = Integer.parseInt(request.getParameter("month"));
          date = Integer.parseInt(request.getParameter("day"));
          year = Integer.parseInt(request.getParameter("year"));
          totdate = year+"-"+month+"-"+date;
          userid = request.getParameter("nickname");
          password1 = request.getParameter("password1");
          password2 = request.getParameter("password2");
          newsletter = request.getParameter("newsletter");
          offers = request.getParameter("offers");
          cal = Calendar.getInstance();
          cal.set(year,month,date);
          sqlDate = new java.sql.Date(cal.getTime().getTime());
          rs1 = st1.executeQuery("select * from Dating_Register where nickname='"+userid+"' ");
          if(rs1.next())
               out.println("<h4><font color=red>Sorry the user already exists</font></h4>");
               printContent();
          else if(!(password1.equals(password2)))
               out.println("<h4><font color=red>Please type both the passwords same</font></h4>");
               printContent();
          else
               String inserting = "insert into Dating_Register values("+count+",'"+iam+"','"+seeking+"','"+lookingfor+"','"+firstname+"','"+lastname+"','"+address+"','"+city+"','"+state+"','"+country+"',"+pincode+",'"+email+"','"+iPhone+"',"+sqlDate+",'"+userid+"','"+password1+"','"+password2+"','"+newsletter+"','"+offers+"','"+remoteuser+"')";
               int x = st1.executeUpdate(inserting);
out.println("Successfully registered");
     catch(Exception e)
          e.printStackTrace();
%>
<%!
     public static void printContent()
%>     
//here I am writing the code for the HTML to repeat the HTML form.
<%!
%>

I hope your not writing all your code like this. Try using a MVC and some beans.
Bu to answer your question are the password the same try checking this and put brackets around the If else statement do not nest the to much Do it like this:
if(rs1.next()) {
out.println("<h4><font color=red>Sorry the user already exists</font></h4>");
printContent();
} else {
if(!(password1.equals(password2))) {
out.println("<h4><font color=red>Please type both the passwords same</font></h4>");
printContent();
} else {
String inserting = "insert into Dating_Register values("+count+",'"+iam+"','"+seeking+"','"+lookingfor+"','"+firstname+"','"+lastname+"','"+address+"','"+city+"','"+state+"','"+country+"',"+pincode+",'"+email+"','"+iPhone+"',"+sqlDate+",'"+userid+"','"+password1+"','"+password2+"','"+newsletter+"','"+offers+"','"+remoteuser+"')";
int x = st1.executeUpdate(inserting);
out.println("Successfully registered");
It is a lot clearer and better to maintain.
Succes,
Marsua

Similar Messages

  • What's wrong with the JSP files?? Urgent Help Request

    I have run some JSP files using Apache Tomcat 4.0 but I see many similar error message for the JSP files when running on the IE. I don't whether I should install some other software or components or just program errors in the JSP files.
    The error messages are as follows:
    javax.servlet.ServletException: oracle/xml/parser/v2/XMLParseException
         at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:457)
         at org.apache.jsp.edit_0005fquiz_0005flist$jsp._jspService(edit_0005fquiz_0005flist$jsp.java:154)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:202)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:382)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:474)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:201)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2344)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:462)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:163)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1011)
         at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1106)
         at java.lang.Thread.run(Thread.java:536)
    root cause
    java.lang.NoClassDefFoundError: oracle/xml/parser/v2/XMLParseException
         at EntityBase.(EntityBase.java:18)
         at QuizGen.(QuizGen.java:16)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
         at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
         at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
         at java.lang.Class.newInstance0(Class.java:296)
         at java.lang.Class.newInstance(Class.java:249)
         at java.beans.Beans.instantiate(Beans.java:204)
         at java.beans.Beans.instantiate(Beans.java:48)
         at org.apache.jsp.edit_0005fquiz_0005flist$jsp._jspService(edit_0005fquiz_0005flist$jsp.java:122)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:202)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:382)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:474)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:201)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2344)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:462)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:163)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1011)
         at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1106)
         at java.lang.Thread.run(Thread.java:536)
    And the reference JSP file is:
    <%@page language="java" import="java.io.*, java.sql.*, DBSession, QuizGen"%>
    <jsp:useBean id="sess" scope="session" class="DBSession"/>
    <jsp:useBean id="quizGen" scope="session" class="QuizGen"/>
    <%@include file="common.jsp"%>
    <%
    quizGen.setSession(sess);
    quizGen.build();
    quizGen.print(new PrintWriter(out), this.getURLPath(request, "edit_quiz_list.xsl"));
    %>
    another JSP file:
    <%@page language="java" import="java.io.*, java.sql.*, eQuizMetadata"%>
    <jsp:useBean id="eQuiz" scope="session" class="eQuizMetadata"/>
    <%@include file="common.jsp"%>
    <%
    Integer nextQues = (Integer) session.getAttribute("eQuiz_nextQues");
    session.setAttribute("eQuiz_nextQues", new Integer(nextQues.intValue()+1));
    if (nextQues.intValue() > 0) {
    if (request.getParameter("QueType").equals("F")) {
    eQuiz.checkAnswer(request.getParameter("answer"));
    else{
    if (request.getParameter("QueType").equals("H")) {
    eQuiz.checkAnswer(request.getParameter("map"));
    else{
    if(request.getParameter("QueType").equals("A")) {
    String sAns = "";
         if (request.getParameter("MAT1") != null) sAns += request.getParameter("MAT1");
         if (request.getParameter("MAT2") != null) sAns += request.getParameter("MAT2");
         if (request.getParameter("MAT3") != null) sAns += request.getParameter("MAT3");
         if (request.getParameter("MAT4") != null) sAns += request.getParameter("MAT4");
         eQuiz.checkAnswer(sAns);
         else{
              if (request.getParameter("Cardinality").equals("S"))
              eQuiz.checkAnswer(request.getParameter("MC"));
              else {
              String sAns = "";
              if (request.getParameter("MR1") != null) sAns += request.getParameter("MR1");
              if (request.getParameter("MR2") != null) sAns += request.getParameter("MR2");
              if (request.getParameter("MR3") != null) sAns += request.getParameter("MR3");
              eQuiz.checkAnswer(sAns);
    eQuiz.calAbility();
    // meet one of the stopping criteria?
    if (eQuiz.checkStopQuiz()) {
    %>
    <jsp:forward page="eQuiz_result.jsp"/>
    <%
    %>
    <html>
    <head>
    <title>QuizML Management System</title>
    </head>
    <frameset border="0" rows="30,*">
    <frame src="eQuiz_head.jsp" name="head" noresize scrolling="no">
    <frame src="eQuiz_detail.jsp" name="detail" scrolling="auto">
    </frameset>
    </html>

    root cause
    java.lang.NoClassDefFoundError: oracle/xml/parser/v2/XMLParseExceptionYou simply don't have the "oracle.xml.parser.v2.XMLParseException" class in your classpath at run-time.

  • What's wrong with the JSP file??Urgent Help Request

    I have run some JSP files using Apache Tomcat 4.0 but I see many similar error message for the JSP files when running on the IE. I don't whether I should install some other software or components or just program errors in the JSP files.
    The error messages are as follows:
    javax.servlet.ServletException: oracle/xml/parser/v2/XMLParseException
    at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:457)
    at org.apache.jsp.edit_0005fquiz_0005flist$jsp._jspService(edit_0005fquiz_0005flist$jsp.java:154)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:202)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:382)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:474)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:201)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
    at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2344)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
    at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:462)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:163)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1011)
    at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1106)
    at java.lang.Thread.run(Thread.java:536)
    root cause
    java.lang.NoClassDefFoundError: oracle/xml/parser/v2/XMLParseException
    at EntityBase.(EntityBase.java:18)
    at QuizGen.(QuizGen.java:16)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
    at java.lang.Class.newInstance0(Class.java:296)
    at java.lang.Class.newInstance(Class.java:249)
    at java.beans.Beans.instantiate(Beans.java:204)
    at java.beans.Beans.instantiate(Beans.java:48)
    at org.apache.jsp.edit_0005fquiz_0005flist$jsp._jspService(edit_0005fquiz_0005flist$jsp.java:122)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:202)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:382)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:474)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:201)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
    at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2344)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
    at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:462)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:163)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1011)
    at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1106)
    at java.lang.Thread.run(Thread.java:536)
    And the reference JSP file is:
    <%@page language="java" import="java.io.*, java.sql.*, DBSession, QuizGen"%>
    <jsp:useBean id="sess" scope="session" class="DBSession"/>
    <jsp:useBean id="quizGen" scope="session" class="QuizGen"/>
    <%@include file="common.jsp"%>
    <%
    quizGen.setSession(sess);
    quizGen.build();
    quizGen.print(new PrintWriter(out), this.getURLPath(request, "edit_quiz_list.xsl"));
    %>
    another JSP file:
    <%@page language="java" import="java.io.*, java.sql.*, eQuizMetadata"%>
    <jsp:useBean id="eQuiz" scope="session" class="eQuizMetadata"/>
    <%@include file="common.jsp"%>
    <%
    Integer nextQues = (Integer) session.getAttribute("eQuiz_nextQues");
    session.setAttribute("eQuiz_nextQues", new Integer(nextQues.intValue()+1));
    if (nextQues.intValue() > 0) {
    if (request.getParameter("QueType").equals("F")) {
    eQuiz.checkAnswer(request.getParameter("answer"));
    else{
    if (request.getParameter("QueType").equals("H")) {
    eQuiz.checkAnswer(request.getParameter("map"));
    else{
    if(request.getParameter("QueType").equals("A")) {
    String sAns = "";
    if (request.getParameter("MAT1") != null) sAns += request.getParameter("MAT1");
    if (request.getParameter("MAT2") != null) sAns += request.getParameter("MAT2");
    if (request.getParameter("MAT3") != null) sAns += request.getParameter("MAT3");
    if (request.getParameter("MAT4") != null) sAns += request.getParameter("MAT4");
    eQuiz.checkAnswer(sAns);
    else{
    if (request.getParameter("Cardinality").equals("S"))
    eQuiz.checkAnswer(request.getParameter("MC"));
    else {
    String sAns = "";
    if (request.getParameter("MR1") != null) sAns += request.getParameter("MR1");
    if (request.getParameter("MR2") != null) sAns += request.getParameter("MR2");
    if (request.getParameter("MR3") != null) sAns += request.getParameter("MR3");
    eQuiz.checkAnswer(sAns);
    eQuiz.calAbility();
    // meet one of the stopping criteria?
    if (eQuiz.checkStopQuiz()) {
    %>
    <jsp:forward page="eQuiz_result.jsp"/>
    <%
    %>
    <html>
    <head>
    <title>QuizML Management System</title>
    </head>
    <frameset border="0" rows="30,*">
    <frame src="eQuiz_head.jsp" name="head" noresize scrolling="no">
    <frame src="eQuiz_detail.jsp" name="detail" scrolling="auto">
    </frameset>
    </html>

    Your JSP refers to the class:
    oracle/xml/parser/v2/XMLParseException
    ...which isn't in your webapps class path... you need to find the jar that contains the parser and drop it into WEB-INF/lib for your app, or the Tomcat lib directory.

  • What's wrong with the jsp that show how many people online

    environment : tomcat
    the jsp can only add the online people count correct,
    when I close IE,the jsp cant sub the count;
    package mybeans;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class ShowActiveSession implements HttpSessionListener{
    private static int activeSession=0;
    public void sessionCreated(HttpSessionEvent se){
    activeSession++;
    public void sessionDestroyed(HttpSessionEvent se){
    activeSession--;
    public static int getActiveSession(){
    return activeSession;
    web.xml
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app>
    <listener>
    <listener-class>
    mybeans.ShowActiveSession
    </listener-class>
    </listener>
    </web-app>
    jsp file
    <%@ page contentType="text/html;charset=GB2312"%>
    <%@ page import="mybeans.ShowActiveSession"%>
    <html>
    <body>
    online people count:<%=ShowActiveSession.getActiveSession()%>
    </body>
    </html>

    can you tell me how to give me a message when user
    close IE;This has been discussed many times in this forum there are various solutions you can try but nothing is reliable at 100% but search this forum if you wanna more info

  • What is Wrong with this JSP ?...It`s suppose to call the Bean !

    Hi there ! It has been two weeks, I`ve been working on this issues but yet no accomplishment.!
    My page.jsp refers to newbean.java.
    I have succesfully compiled newbean.java and produced a class.
    The error I get is that , it doesn` seem to give me any results. My results are :-
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    SELECT LOT_ID, FLOW_ID, TST_TEMP, MODE_COD, RTST_COD, PART_CNT, GOOD_CNT, OPER_NAM, JOB_REV, PROC_ID, START_T, FACIL_ID, TSTR_TYP, NODE_NAM FROM LOT where START_T > TO_DATE('05/30/2002','MM/DD/YYYY') AND TST_TEMP <='' order by START_T
    Select Lot(s)|Flow|Temp|Test|Mode|Retest|Total|Good|Bad|Yield|UserID|Program|Mask|Start Time|Loc|Tester|System
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    PLEASE ASSIST ! I``m enclosing my page.jsp and newbean.java

    package mybeans;
    package mybeans;
    import java.sql.*;
    import java.lang.*;
    import java.text.*;
    import java.io.*;
    public class newbean
    Statement stmt = null;
    Connection conn;
    ResultSet rset = null;
    String S_date = new String();
    String temp = new String();
    String lot_id = new String();
    String result = new String();
    String SQL_String = new String();
    String crap = new String();
    double yield;
    int bad_cnt;
    public void connect()
    try
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    conn = DriverManager.getConnection("jdbc:oracle:thin:@klmomnidb:1521:OMNIDB","omni",
    "omni");
    catch(SQLException sqle)
    { //System.err.println("Error connecting: " + sqle);
    //return(null);
    System.out.println("Caught SQL Exception: " + sqle.toString() + "<br>");
    static double roundDouble(double toBeRounded, int fractionDigits)
    NumberFormat format = NumberFormat.getInstance();
    format.setMaximumFractionDigits(fractionDigits);
    String tempDouble = format.format(toBeRounded);
    return Double.parseDouble(tempDouble);
    public void startquery(String S_date)
    try
    SQL_String = "SELECT LOT_ID, FLOW_ID, TST_TEMP, MODE_COD, RTST_COD, PART_CNT, GOOD_CNT, OPER_NAM, JOB_REV, PROC_ID, START_T, FACIL_ID, TSTR_TYP, NODE_NAM FROM LOT where START_T > TO_DATE('"+ S_date + "','MM/DD/YYYY') AND TST_TEMP <='" + temp+"' order by START_T";
    stmt = conn.createStatement();
    rset = stmt.executeQuery (SQL_String);
    catch(SQLException sqle)
    System.err.println("Error executin query: " + sqle);
    public String displaySQL()
    return SQL_String;
    public String displayresult()
    try
    if (!rset.next())
    result ="No records found matching seach criteria.";
    else while (rset.next())
    bad_cnt = Integer.parseInt(rset.getString(6)) - Integer.parseInt(rset.getString(7));
    yield = (Double.parseDouble(rset.getString(7)) / Double.parseDouble(rset.getString(6))) *
    100;
    result= "<TR>";
    result = result + "<TD><a href=coolpage.jsp?LOT_ID=" + rset.getString(1)+ ">" + rset.getS
    tring(1) + "</A></TD>";
    result = result + "<TD>" + rset.getString(2) + "</TD>";
    result = result + "<TD>" + rset.getString(3) + "</TD>";
    result = result + "<TD>" + rset.getString(4) + "</TD>";
    result = result + "<TD>" + rset.getString(5) + "</TD>";
    result = result + "<TD>" + rset.getString(6) + "</TD>";
    result = result + "<TD>" + rset.getString(7) + "</TD>";
    result = result + "<TD>" + bad_cnt + "</TD>";
    result = result + "<TD>" + roundDouble(yield,2) + "%</TD>";
    result = result + "<TD>" + rset.getString(8) + "</TD>";
    result = result + "<TD>" + rset.getString(9) + "</TD>";
    result = result + "<TD>" + rset.getString(10) + "</TD>";
    result = result + "<TD>" + rset.getString(11) + "</TD>";
    result = result + "<TD>" + rset.getString(12) + "</TD>";
    result = result + "<TD>" + rset.getString(13) + "</TD>";
    result = result + "<TD>" + rset.getString(14) + "</TD>";
    result = result + "</TR>";
    return(result);
    catch(SQLException sqle)
    //System.err.println("Error executin query: " + sqle);
    //System.out.println("Query is : " + SQL_String + "\n\n");
    System.out.println("Caught SQL Exception: " + sqle.toString() + "<br>");
    return(result);
    public void disconnect()
    try
    conn.close();
    catch(SQLException sqlex)
    System.err.println( "Unable to Disconnect" );
    }

  • Forward() from a JSP:  what's wrong with this code?

    I have an application that was working. Then I tried to change it so that instead of the index page basically saying "Welcome. Click continue," it now tries to go directly to the Front Controller servlet without the user seeing the index page. Here's what I have in index.jsp:
    String path = request.getContextPath() + "/servlet/FrontController?thePage=\"index\"";
    RequestDispatcher rq = request.getRequestDispatcher(path);
    rq.forward(request, response);I did a print out of the path variable and it looks like this:
    /mealplan/servlet/FrontController?thePage="index"
    Now, when this was a normal page with a form that said
    <form action="<%= request.getContextPath() %>/servlet/FrontController" method="POST">and passed the page name in as a hidden parameter, the application worked fine. Now when I try to execute it, I get:
    /mealplan/mealplan/servlet/FrontController
    description The requested resource (/mealplan/mealplan/servlet/FrontController) is not availaIt looks like the "mealplan" part of the URL is being repeated (this is for dorm students to choose a meal plan). What am I doing wrong when I set up the URL for forwarding versus using the FORM element? Thanks.

    it appers to me that the jsp or servlet is already inside the mealplan directory through which it is trying to access /mealplan/...Hence it would be searching for /mealplan directory within the current working directory
    Anyways i dont think it should be too much to solve it out.

  • Step by step to use IIS to serve JSP, what's wrong?

    I am a total newbie in IT but I need to use IIS to serve a Jsp application.
    I put on my step by step procedure (images) on my webpages. Will some kind souls please take a look and tell me what went wrong.
    Thank you.
    URL : http://www.geocities.com/i_am_diablo2000/iis.html

    If you follow what I put up in my webpage, you should be able to get the re-direct work.
    However, that is not my ultimate goal.
    I thought I will be able to setup IIS to serve a Jsp application without starting the Tomcat. But that didn't happen. I still need to run Tomcat, in order to get the Jsp application running properly.
    Is there a way to start Servlet Engine without the Tomcat webserver?
    Help.

  • What is the difference between jsp :include and server side include

    what is the difference between jsp :include and server side include(request dispatcher include method)????
    i understand that both request dispatcher include method and jsp:include take dynamic data,so when would one use request dispatcher include and when jsp:include.
    Is the usage interchangeable?i believe jsp include is used only for jsp/html but include directive can be used to include servlets ,jsp and html....correct me if i m wrong and
    do suggest if u hav ny other diff in this context...

    The difference really is: in what format do you want your inclusions? If your environment has many Java developers and only a few designers that focus mainly on, say, Flash, that might push you more towards the server-side include() directive. Or, if you have a large set of pages that receive dynamic content that is displayed in a consistent fashion (such as a workflow header area on a page).
    If, on the other hand, you have more web designers, there may be a greater desire to deal in markup rather than Java code. Java developers themselves might prefer to view markup (JSP) that more resembles the eventual output than something occuring in Java code.
    Finally, there are considerations of tiering. While it is totally possible to (and I have previously) implement 'view classes' that render markup or generate layout templates, JSP's offer, IMO, a subtle, psychological advantage. By forcing a developer to work in a different format, markup versus Java source, the separation on view from controller and model becomes a bit easier. It is still possible to make mistakes, but if a developer at some point notices, "Wait, I'm in a JSP, should I be importing a java.sql class?", then the choice to use JSP includes has paid off in spades.
    - Saish

  • JScrollPane, what is wrong with my code?

    Hi, I appreciated if you helped me(perhaps by trying it out yourself?)
    I wanted my JScrollPane to display what is drawn on my canvas (which may be large)by scrolling, but it says it doesn't need any vertical and horizontal scroll bars. Here is the code that has this effect
    import javax.swing.*;
    import java.awt.*;
    public class WhatsWrong extends JApplet{
    public void init(){
    Container appletCont = getContentPane();
    appletCont.setLayout(new BorderLayout());
    JPanel p = new JPanel();
    p.setLayout(new BorderLayout());
    p.add(new LargeCanvas(),BorderLayout.CENTER);
    int ver = ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED;
    int hor = ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;
    JScrollPane jsp = new JScrollPane(p,ver,hor);
    appletCont.add(jsp,BorderLayout.CENTER);
    class LargeCanvas extends Canvas{
    public LargeCanvas(){
    super();
    setBackground(Color.white);
    public void paint(Graphics g){
    g.drawRect(50,50,700,700);
    and the html code:
    <html>
    <body>
    <applet code="WhatsWrong" width = 300 height = 250>
    </applet>
    </body>
    </html>
    What shall I do?
    Thanks in advance.

    What is wrong with your code is that your class, LargeCanvas must implement the Scrollable interface in order to be scrolled by a JScrollPane.
    A comment regarding your use of Canvas and Swing components: The Java Tutorial recommends that you extend JPanel to do custom painting. Canvas is what they call a "heavyweight" component and they recommend not to mix lightweight (Swing) components and heavyweight components.
    There is a lot more information on custom painting on the Java Tutorial in the Lesson "Creating a GUI with Swing.

  • What is Wrong with My html-el:reset Tag?

    In my JSP, I used <html-el:form ...>, <htim-el:checkbox ...>, <html-el:hidden ... >, <html-el:submit ... > without any problem.
    But, I got Error 500:(class: org/apache/strutsel?taglib/html/ELResetTag, method: release signature: ?V) Illegal use of nonvirtual method call
    when I used:
    <html-el:reset accesskey="C">Clear</html-el:reset>And the reset button does not get displayed when I
    <html-el:reset>Clear</html-el:reset>Would anybody point out what is wrong with the way I used the reset tag? Thank you.

    In my JSP, I used <html-el:form ...>, <htim-el:checkbox ...>, <html-el:hidden ... >, <html-el:submit ... > without any problem.
    But, I got Error 500:(class: org/apache/strutsel?taglib/html/ELResetTag, method: release signature: ?V) Illegal use of nonvirtual method call
    when I used:
    <html-el:reset accesskey="C">Clear</html-el:reset>And the reset button does not get displayed when I
    <html-el:reset>Clear</html-el:reset>Would anybody point out what is wrong with the way I used the reset tag? Thank you.

  • What's wrong with my send email app??

    Here is my code:
    <%@ page import="java.util.*,javax.mail.*,javax.mail.internet.*,javax.naming.*,java.io.*,javax.activation.*"%>
    <%@ page import ="javax.mail.internet.MimeMessage"%>
    <%
    String content = "Hihi";
    try
    Properties props = new Properties();
    props.setProperty("mail.transport.protocol", "smtp");
    props.setProperty("mail.smtp.host", "stdsmtp.****.***.**");
    props.setProperty("mail.user", "username of the server account");
    props.setProperty("mail.password", "password of the server account");
    Session sessionMail = Session.getDefaultInstance(props, null);
    Message message = new MimeMessage(sessionMail);
    Address from = new InternetAddress("an email account");
    Address to = new InternetAddress("an email accout");
    message.setContent(content, "text/plain");
    message.setFrom(from);
    message.setRecipient(Message.RecipientType.TO,to);
    message.setSubject("Java Mail is easy to use");
    Transport.send(message);
    catch(Exception e)
    e.printStackTrace();
    %>
    javax.mail.MessagingException: Exception reading response;
    nested exception is:
    java.net.SocketException: Connection reset
    at com.sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.java:1462)
    at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1260)
    at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:370)
    at javax.mail.Service.connect(Service.java:275)
    at javax.mail.Service.connect(Service.java:156)
    at javax.mail.Service.connect(Service.java:105)
    at javax.mail.Transport.send0(Transport.java:168)
    at javax.mail.Transport.send(Transport.java:98)
    at org.apache.jsp.sendEmail_jsp._jspService(sendEmail_jsp.java:72)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:362)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
    at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
    at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
    at java.lang.Thread.run(Thread.java:595)
    Caused by: java.net.SocketException: Connection reset
    at java.net.SocketInputStream.read(SocketInputStream.java:168)
    at com.sun.mail.util.TraceInputStream.read(TraceInputStream.java:97)
    at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
    at java.io.BufferedInputStream.read(BufferedInputStream.java:235)
    at com.sun.mail.util.LineInputStream.readLine(LineInputStream.java:75)
    at com.sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.java:1440)
    ... 31 more
    What's wrong with my application?

    If no one replies here try the Java Mail Forum:
    http://forum.java.sun.com/forum.jspa?forumID=43

  • What's wrong with a simple login.jspx?

    Hello,
    I wrote a simple login.jspx page by following the indications at http://download.oracle.com/docs/cd/E15523_01/web.1111/b31974/adding_security.htm#BABDEICH
    Now, the page works with Firefox 5, but does not with IE 7. When under IE 7, the page keeps reloading giving errors about *"AdfBootStrap undefined*" or *"AdfLogger undefined".*
    What is wrong? Please note that I have already read all the threads on the forum about this issue, without actually solving my problem (I have not really seen any useful solutions there to be honest).
    Jdeveloper is 11.1.1.5.0, only adf authentication is enabled.
    The error messages are like the following ones:
    http://forums.oracle.com/forums/thread.jspa?threadID=952977&tstart=29
    thanks.
    Edited by: user10047839 on 27-giu-2011 8.07
    Changing from jspx to jsp does not solve the problem.

    Hello codeplay,
    in the source code of the page I have the following similar to your line:
    <script type="text/javascript" src="/Myapp/afr/partition/ie/default/opt/boot-11.1.1.5.0-1095.js"></script>
    No lines with SHERMAN inside.
    I could not open "/Myapp/afr/partition/ie/default/opt/boot-11.1.1.5.0-1095.js" or
    "afr/partition/ie/default/opt/boot-11.1.1.5.0-1095.js". Page not found
    Why does it happen with login page only?
    In firefox, as opposite to ie, where the page is rendered a little better (not as good as it should be though, due to these problems), I can login and be redirected to the secured main page, which is another .jsp, more complex than the simple login page, and there I have no problems at all.
    I noticed that the badly rendered page has a link pointing to the generated html below. NOTE that JavaScript IS ENABLED in my IE despite what this html says at the end. I checked this twice:
    WHAT IS WRONG??????????
    <html lang="en-EN"><head><script>
    ** Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
    * This is the loopback script to process the url before the real page loads. It introduces
    * a separate round trip. During this first roundtrip, we currently do two things:
    * - check the url hash portion, this is for the PPR Navigation.
    * - do the new window detection
    * the above two are both controled by parameters in web.xml
    * Since it's very lightweight, so the network latency is the only impact.
    * here are the list of will-pass-in parameters (these will replace the param in this whole
    * pattern:
    * viewIdLength view Id length (characters),
    * loopbackIdParam loopback Id param name,
    * loopbackId loopback Id,
    * loopbackIdParamMatchExpr loopback Id match expression,
    * windowModeIdParam window mode param name,
    * windowModeParamMatchExpr window mode match expression,
    * clientWindowIdParam client window Id param name,
    * clientWindowIdParamMatchExpr client window Id match expression,
    * windowId window Id,
    * initPageLaunch initPageLaunch,
    * enableNewWindowDetect whether we want to enable new window detection
    * jsessionId session Id that needs to be appended to the redirect URL
    * enablePPRNav whether we want to enable PPR Navigation
    var id = null;
    var query = null;
    var href = document.location.href;
    var hashIndex = href.indexOf("#");
    var hash = null;
    /* process the hash part of the url, split the url */
    if (hashIndex > 0)
    hash = href.substring(hashIndex + 1);
    /* only analyze hash when pprNav is on (bug 8832771) */
    if (false && hash && hash.length > 0)
    hash = decodeURIComponent(hash);
    if (hash.charAt(0) == "@")
    query = hash.substring(1);
    else
    var state = hash.split("@");
    id = state[0];
    query = state[1];
    href = href.substring(0, hashIndex);
    /* process the query part */
    var queryIndex = href.indexOf("?");
    if (queryIndex > 0)
    /* only when pprNav is on, we take in the query from the hash portion */
    query = (query || (id && id.length>0))? query: href.substring(queryIndex);
    href = href.substring(0, queryIndex);
    var jsessionIndex = href.indexOf(';');
    if (jsessionIndex > 0)
    href = href.substring(0, jsessionIndex);
    /* we will replace the viewId only when pprNav is turned on (bug 8832771) */
    if (false)
    if (id != null && id.length > 0)
    href = href.substring(0, href.length - 10) + id;
    var isSet = false;
    if (query == null || query.length == 0)
    query = "?";
    else if (query.indexOf("_afrLoop=") >= 0)
    isSet = true;
    query = query.replace(/_afrLoop=[^&]*/, "_afrLoop=12570889997779");
    else
    query += "&";
    if (!isSet)
    query = query += "_afrLoop=12570889997779";
    /* below is the new window detection logic */
    var initWindowName = "_afr_init_"; // temporary window name set to a new window
    var windowName = window.name;
    // if the window name is "_afr_init_", treat it as redirect case of a new window
    if ((true) && (!windowName || windowName==initWindowName ||
    windowName!="1bvr27bkx4_1"))
    /* append the _afrWindowMode param */
    var windowMode;
    if (false)
    /* this is the initial page launch case,
    also this could be that we couldn't detect the real windowId from the server side */
    windowMode=0;
    else if ((href.indexOf("/__ADFvDlg__") > 0) || (query.indexOf("__ADFvDlg__") >= 0))
    /* this is the dialog case */
    windowMode=1;
    else
    /* this is the ctrl-N case */
    windowMode=2;
    if (query.indexOf("_afrWindowMode=") >= 0)
    query = query.replace(/_afrWindowMode=[^&]*/, "_afrWindowMode="+windowMode);
    else
    query = query += "&_afrWindowMode="+windowMode;
    /* append the _afrWindowId param */
    var clientWindowId;
    /* in case we couldn't detect the windowId from the server side */
    if (!windowName || windowName == initWindowName)
    clientWindowId = "null";
    // set window name to an initial name so we can figure out whether a page is loaded from
    // cache when doing Ctrl+N with IE
    window.name = initWindowName;
    else
    clientWindowId = windowName;
    if (query.indexOf("_afrWindowId=") >= 0)
    query = query.replace(/_afrWindowId=\w*/, "_afrWindowId="+clientWindowId);
    else
    query = query += "&_afrWindowId="+clientWindowId;
    var sess = "";
    if (sess.length > 0)
    href += sess;
    /* if pprNav is on, then the hash portion should have already been processed */
    if ((false) || (hash == null))
    document.location.replace(href + query);
    else
    document.location.replace(href + query + "#" + hash);
    </script><noscript>JavaScript is not enabled in your browser.</noscript></head></html>

  • What is wrong in my store procedure

    Hi all,
    I confuse on in ,out inout in store procedure , I got eroor at
    Formal parameter '@AccessionNumber' was defined as OUTPUT but the actual parameter not declared OUTPUT
    I use sql server 2000 and ms type 4 driver,
    my test store procedure is
    drop  proc test_select
    go     
    create proc test_select
    (@AccessionNumber int,
    @NewNum varchar(20))
    AS
            begin
        begin transaction
    select FieldNumber, Name, HiTiter, SubType, Storage,SampleRegion, SampleYear
            from STData.dbo.ViruName00          
         where AccessionNumber=@AccessionNumber      
            and NewNum=@NewNum
    if @@error <>0 or @@rowcount !=1
               begin
                    rollback
                   return
              end
           commit transaction
    endand my test servlet is
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    import javax.sql.*;
    * TryJdbc.java
    * This servlet demonstrates using JDBC
    public class displayT1 extends HttpServlet {
        CallableStatement cs =null;
        ResultSet rs = null;
        Connection conn = null;
       * We want to initialized the JDBC connections here
        public void init()
            try{
            Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
            catch( Exception e )
                e.printStackTrace();
       * This responds to an HTTP GET request.
        public void doGet(
        HttpServletRequest request,
        HttpServletResponse response)
        throws IOException, ServletException {
            response.setContentType("text/html");
        PrintWriter out = response.getWriter();
            out.println("<html>");
            out.println("<head>");        
            try{
              conn = DriverManager.getConnection("jdbc:microsoft:sqlserver://localhost:1433","test","1234");
            conn.setCatalog("STData");   
           //we made it!
            out.println("connection established sucessfully!");
               // register int OUT parameter
                cs = conn.prepareCall("{call test_select(?,?)}");
                  cs.setInt(1, 1);
                   cs.setString(2, "00-1");
    cs.registerOutParameter(1, Types.INTEGER);
         cs.registerOutParameter(2, Types.VARCHAR);
                     ResultSet rs = cs.executeQuery(); 
          out.println("<html>");
                         out.println("<body bgcolor=\"#d2eeff\">");                  
                         out.print("<table border=\"1\"  width=\"37%\"> "); //create an html table
                         out.print("<tr>");
                         out.print("<h2> Customers on the flight</h2>");
                         out.print("</tr>");                    
                         out.println("<tr><td>Name</td>");
                         out.println("<td>SubTYpe</td></tr>");
                           while(rs.next()) {
                             out.print("<tr>");
                              out.print("<td>"+ rs.getInt(1) +"</td>");
                               out.print("<td>"+ rs.getString(2) +"</td>");
                               out.print("</tr>");                             
                                }// end while
                      out.print("</table>");
                       out.print("</body></html>");
                       out.close();
          while(rs.next()) {
           String Name=rs.getString("Name");        
            out.print(""+Name+"");
             out.print("</body></html>");
              out.close();
         }catch(SQLException e) {
                e.printStackTrace(out);
         finally {
          try {
            if(rs != null)
              rs.close();
              rs = null;
            if(cs != null)
              cs.close();
              cs = null;
            if(conn != null)
              conn.close();
              conn = null;
        catch (SQLException e) {}   
    public void doPost(HttpServletRequest Request, HttpServletResponse Response)
                    throws ServletException, IOException {
    public String getServletInfo()
        return "A Simple Servlet";
    }and my AccessionNumber is first column, and NewNum is second column.
    appreciate any help!
    Thank you!

    HI all,
    html + bean + jsp call store procedure still not work, I got empty output!!
    what is wrong ?
    public  String getString(){
        return string;
    public void setString( String string ) {
       this.string =string;    }
    public  String getMyType(){
        return myType;
    public void setMyType( String myType ) {
       this.myType =myType;    }
    try {
                  cs = db.prepareCall("{call select_all(?,?)}");            
                   cs.setString(1, myType);
                   cs.setString(2, string); 
                     ResultSet rs = cs.executeQuery();         
            fieldNumberList.clear();
            nameList.clear();
            hiTiterList.clear();
            subTypeList.clear();
            storageList.clear();
            sampleRegionList.clear();      
            rowCount = 0;
            while (rs.next()) {
               fieldNumberList.add(rs.getString("FieldNumber"));
               nameList.add(rs.getString("Name"));
               hiTiterList.add(rs.getString("HiTiter"));   
               subTypeList.add(rs.getString("SubType"));
               storageList.add(rs.getString("Storage"));
               sampleRegionList.add(rs.getString("SampleRegion"));
               rowCount++;
              anyRecords = true;
            }//end while
          }//end trythe following code work in servlet
    cs = conn.prepareCall("{call select_all(?,?)}");
                   cs.setString(1, myType);
                   cs.setString(2, string); 
                     ResultSet rs = cs.executeQuery(); 
             thank you!

  • What is wrong in my web file

    Hi all,
    when I add the following code into my web xml file.
    <login-config>
        <auth-method>form</auth-method>
          <form-login-config>
                 <from-login-page>/login.html</form-login-page>
                 <from-error-page>/ErrorLogin.jsp</form-error-page>
          </form-login-config>
    </login-config>I can not access my seit either at
    http://*******/******/login.html or
    http://*******/******/ErrorLogin.jsp
    what is wrong?
    thank you

    Hi all
    should
       <form name="test" action="secure/display1.jsp" method="post" >  web xml file
    <welcome-file-list>
            <welcome-file>Home.html</welcome-file>          
    </welcome-file-list>
    <security-constraint>
              <web-resource-collection>
                   <web-resource-name>SecurePages</web-resource-name>
                   <description>Security constraint for resources in the secure directory</description>
                   <url-pattern>/secure/*</url-pattern>
                   <http-method>POST</http-method>
                   <http-method>GET</http-method>
              </web-resource-collection>
              <auth-constraint>
                   <description>only let the system user login </description>
              </auth-constraint>
              <user-data-constraint>
                   <description>SSL not required</description>
                   <transport-guarantee>NONE</transport-guarantee>
              </user-data-constraint>
         </security-constraint>
             <login-config>
                  <auth-method>FORM</auth-method>
                  <form-login-config>
                       <form-login-page>/login.html</form-login-page>
                       <form-error-page>/ErrorLogin.jsp</form-error-page>
                  </form-login-config>
             </login-config>
    </web-app> Thank you

  • What's wrong???

    Does anyone knows what's wrong with my codes? This page is to retrieve values from database and display in the Dropdownlist.
    details.TeacherDetails is where my database connection is located.
    I keep getting an error at the bold codes below:
    Thanks.
    <%@ page import="java.sql.*"%>
    <jsp:useBean id="s" class="details.TeacherDetails" scope="request"/>
    <html>
    <head>
    <title>Search Teacher</title>
    </head>
    <form method="Post">
    <br>
    <%
         try
              String sql = "Select teacherName from Teacher";
              ResultSet rs;
              rs = s.executeQuery(sql);
              %>
              Please Select A Teacher:<select name="name"><%
              while (rs.next())
              %>
              <option value="<%=rs.getString("teacherName")%>"></option>
              <%
              %></select><%
                   rs.close();
              catch(Exception e)
              %>There was a problem with your connection.
              <%
                   e.printStackTrace();
              %>
    </form>
    </body>
    </html>
              

    hie there.....
    from the look of things Retrieve.jsp is working just fine. the problem is with the appears to be with the bean s with original class details.TeacherDetails.
    I think you wanted the details.TeacherDetails to handle all the SQL issues of setting up the connection(connection URL, username and passwords). Remember that in details.TeacherDetails you need to do the following:
    a) get the connection URL
    b) load the database driver
    c) set up the connection
    d) create a statement
    e) do something usefull with the statement
    again looking at you code, you are saying s.executeQuery(sql). from the Java API executeQuery() {see http://java.sun.com/j2se/1.4.2/docs/api/java/sql/Statement.html} is used to "Executes the given SQL statement, which returns a single ResultSet object.". so that you dont overide this method i suggest creating a method called runUserQuery in details.TeacherDetails as follows:
    public ResultSet runUserQuery(String query){
           //assuming you have created a connection known as conn
           ResultSet retVal = null;
           try{
                Statement stmt = con.createStatement();
                retVal = stmt.executeQuery(query);
           }catch(Exception e) {//lazy, just get any thrown exception
                       //make sure retVal is null
                       retVal = null;  
            return retVal;
    }now in the Retrieve.jsp simple do the following:
    rs = s.runUserQuery(sql); instaed of rs = s.executeQuery(sql);
    Also make sure the the directory structure OK, i.e. it conforms to the details.TeacherDetails naming. under the ...Teacher/WEB-INF/classes folder you should have /details/TeacherDetails.class so all in all its ...Teacher/WEB-INF/classes/details/TeacherDetails.class
    lets have a look at the details.TeacherDetails source code to avoid assumptions.
    sipatha.
    may the source forever be with you

Maybe you are looking for