My logic dosen't work - help me please

Hello,
I'm having a small trouble. Here is the problem.
I have a jsp page, which I used to enter data. There is a textbox called nicno. Now I want to verify that, if a user enter a valid nicno or not.
Here is the .jsp page which I use to enter data.
<form method="POST" action="FinalCtrl.jsp">
  <div align="center">
    <center>
    <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse"
bordercolor="#111111" width="54%" id="AutoNumber1">
      <tr>
        <td width="50%" bgcolor="#DEB887" bordercolor="#DEB887"><b>Enter
        details.....</b></td>
        <td width="50%" bgcolor="#DEB887" bordercolor="#DEB887"> </td>
      </tr>
      <tr>
        <td width="50%" bgcolor="#FFF3C6" bordercolor="#FFF3C6"> </td>
        <td width="50%" bgcolor="#FFF3C6" bordercolor="#FFF3C6"> </td>
      </tr>
      <tr>
        <td width="50%" bgcolor="#FFF3C6" bordercolor="#FFF3C6">Nicno</td>
        <td width="50%" bgcolor="#FFF3C6" bordercolor="#FFF3C6">
        <input type="text" name="nicno" size="24" style="border: 1px solid #0000FF"></td>
      </tr>
      <tr>
        <td width="50%" bgcolor="#FFF3C6" bordercolor="#FFF3C6">Date of
        interview</td>
        <td width="50%" bgcolor="#FFF3C6" bordercolor="#FFF3C6">
            <select size="1" name="dateInterM" style="border: 1px solid #0000FF">
          <option>January
          <option>February
          <option>March
          <option>April
          <option>May
          <option>June
          <option>July
          <option>August
          <option>September
          <option>October
          <option>November
          <option>December
     </select>
        <input type="text" name="dateInterD" size="4" style="border: 1px solid #0000FF"><input
type="text" name="dateInterY" size="6" style="border: 1px solid #0000FF"></td>
      </tr>
      <tr>
        <td width="50%" bgcolor="#FFF3C6" bordercolor="#FFF3C6">Basic salary</td>
        <td width="50%" bgcolor="#FFF3C6" bordercolor="#FFF3C6">
        <input type="text" name="basicSal" size="20" style="border: 1px solid #0000FF"></td>
      </tr>
      <tr>
        <td width="50%" bgcolor="#FFF3C6" bordercolor="#FFF3C6"> </td>
        <td width="50%" bgcolor="#FFF3C6" bordercolor="#FFF3C6"> </td>
      </tr>
      <tr>
        <td width="100%" bgcolor="#FFF3C6" bordercolor="#FFF3C6" align="center" colspan="2">
        <input type="submit" value="APPROVE" name="B1" style="border: 1px solid #0000FF"></td>
      </tr>
      <tr>
        <td width="100%" bgcolor="#FFF3C6" bordercolor="#FFF3C6" align="center"
colspan="2"> </td>
      </tr>
    </table>
    </center>
  </div>
  <p align="center"><a href="MainForm.jsp">Go to main form</a></p>
  <p> </p>
</form>Here is the file "FinalCtrl.jsp"
<%@ page language="java" import="java.util.*"%>
<%@ page import="hrm.*" %>
<%@ page session="true" %>
<jsp:useBean id="approve" class="hrm.ApproveMgr" scope="request"/>
<jsp:setProperty name="approve" property="*"/>
<%
String nextPage ="MainForm.jsp";
     if(approve.verifyNicNo())
          nextPage="FinalSeleMgr.jsp";
     }else{
          nextPage="InvalidNic.html";
%>
<jsp:forward page="<%=nextPage%>"/>..............................................................
In order to do this I wrote a javaBean called ApproveMgr.java
package hrm;
import java.io.*;
import java.sql.*;
import java.util.*;
import javax.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class ApproveMgr
     private  String DRIVER = "com.mysql.jdbc.Driver";
       private  String URL = "jdbc:mysql://localhost:3306/super";
     private  Connection connection;
        private  PreparedStatement pstmt1;
        private String nicno;
        private String interviewDateM;
        private int interviewDateD;
        private int interviewDateY;
       // Constructor
     public ApproveMgr()
          this.nicno = nicno;
          this.interviewDateM = interviewDateM;
          this.interviewDateD = interviewDateD;
          this.interviewDateY = interviewDateY;
   * Returns the nicno.
   public String getNicno()
      return nicno;
   * Sets the nicno.
   public void setNicno(String nicno)
      this.nicno = nicno;
   * Returns the interviewDateM.
   public String getInterviewDateM()
      return interviewDateM;
   * Sets the interviewDateM.
   public void setInterviewDateM(String interviewDateM)
     this.interviewDateM = interviewDateM;
   * Returns the interviewDateD.
   public int getInterviewDateD()
      return interviewDateD;
   * Sets the interviewDateD.
   public void setInterviewDateD(int interviewDateD)
     this.interviewDateD = interviewDateD;
   * Returns the interviewDateY.
   public int getInterviewDateY()
      return interviewDateY;
   * Sets the interviewDateY.
   public void setInterviewDateY(int interviewDateY)
     this.interviewDateY = interviewDateY;
     // Initializes the connection and statements
        public void initConnection() {
                if (connection == null) {
             try {
                      String sql;
                      // Open the database
                      Class.forName(DRIVER).newInstance();
                      connection = DriverManager.getConnection(URL);
                      //Verify nicno
                      sql="SELECT nicNo FROM Approve where nicNo= ?";          
               pstmt1 = connection.prepareStatement(sql);
         catch (Exception ex) {
            System.err.println(ex.getMessage());
     public boolean verifyNicNo(){
          boolean nic_no_select_ok = false;
          String nic="xxxx";
          initConnection();
                try {
                   pstmt1.setString(1, nicno);
               ResultSet rs1 = pstmt1.executeQuery();               
                            if(rs1.next()){
                    nic=rs1.getString("nicNo");
                           if(nic.equals("xxxx"))
                    nic_no_select_ok = true;
               } else{
                    nic_no_select_ok = false;     
               rs1.close();
                       pstmt1.close();
                catch (Exception ex) {
                  System.err.println(ex.getMessage());
          return nic_no_select_ok;
Here is my problem. In my table Approve it has the following record.
Approve(810000000V,January,02,2004)
When I go to the form and enter the data and clicks to the Approve button it always displays the
error page "Invalid nicno".
This error page displays when I enter a nicno which is already exists or not. It should be
display only for invalid number.(which does not exist in Approve table) only. But it dosen't do like that. Please, can somebody tells me whats going on.
Thanks.

Try calling approve.setNicno(......); before approve.verifyNicno()I think that should do it...
TheReader

Similar Messages

  • I cant open my ipad after i turned on the voice in accessibility i have a passcode and i tried to enter my password but it not working. help me please

    i cant open my ipad after i turned on the voice in accessibility i have a passcode and i tried to enter my password but it not working. help me please..
    i updated my ipad in ios 6

    Turn off VoiceOver
    1. Press the Home button
    2. Tap Settings.
    3. Then double-tap Settings.
    4. Tap General.
    5. Then double-tap General.
    6. Use three fingers on the screen to scroll to Accessibility
    7. Tap Accessibility.
    8. Then double-tap Accessibility
    9. Tap VoiceOver
    10. Then double-tap VoiceOver.
    11. Tap "On" next to VoiceOver
    12. Then double-tap "On" to turn it off.

  • Can not connect the iTunes Store, since the last update 2 weeks ago, iOS 6.1.2 has stopped working, help me, please ....

    can not connect the iTunes Store, since the last update 2 weeks ago, iOS 6.1.2 has stopped working, help me, please ....

    Ok, I am having literally identical issues with Marathon Max.
    I try to connect, and it says, "Itunes could not connect to the itunes store, Make sure your network connection is active and try again." I have contacted my ISP, and they ran a full check, and sayed I should be able to connect to pretty much all websites. I did the whole "ipconfig" thing and that was no help. I also tried the "msconfig" thing, and it sayed it did not recognize it as any kind of command, internal or external command or operable program or batch file. Whats strange is I can connect from another computer just fine, but when offered to upgrade itunes I declined for fear of the same thing happpening. I am tempted to just upgrade it and thus demonstrate that itunes has a flaw in their upgrade. I will save this computers diagnostics, and the other one's too, before and after the upgrade. I look forward to sending more feedback regarding this matter

  • SOMEONE PLEASE HELP ME THIS IS MY FIRST TIME DOING THIS MY IPOD IS DISABLED AND IT SAID CONNECT TO I TUNES I DID THAT AND ITS NOT WORKING HELP ME PLEASE AND THANK U

    SOMEONE PLEASE HELP ME THIS IS MY FIRST TIME DOING THIS MY IPOD IS DISABLED AND IT SAID CONNECT TO I TUNES I DID THAT AND ITS NOT WORKING HELP ME PLEASE AND THANK U

    Please turn off your caps lock.
    See http://support.apple.com/kb/HT1212.

  • My new macbook pro doesnt turn on. i press the power button and i can hear it runing but it wont turn on. i tried charging it but nothing works. help me please.

                                    My new macbook pro doesnt turn on. i press the power button and i can hear it runing but it wont turn on. i tried charging it but nothing works. help me please.                   

    ilmare55555 wrote:
    i cant go because if my parents find out my new mac broke they will kill me. i tried to restart it but it wont work i can only hear the fans working and then completely stop after 10 seconds.
    It's new and under warranty. That's the reason to go to the Apple Store.
    Did something happen to it?

  • My new macbook pro doesnt turn on. i press the power button and i van hear it runing but it wont turn on. i tried charging it but nothing works. help me please.

    My new macbook pro doesnt turn on. i press the power button and i van hear it runing but it wont turn on. i tried charging it but nothing works. help me please.

    ilmare55555 wrote:
    i cant go because if my parents find out my new mac broke they will kill me. i tried to restart it but it wont work i can only hear the fans working and then completely stop after 10 seconds.
    It's new and under warranty. That's the reason to go to the Apple Store.
    Did something happen to it?

  • Photoshop elem 12 + mac os = dosen't work, HELP!!

    Hello !!! I bought on amazon adobe photoshop elements 12, I have a mac os and when I inserted the CD to install the program and clicked on install it dosen't work !!!!!! what happens is that I press on install, it start loading but then when he almost finished it stops and says I need to download adobe support advisor but the link that they give dosen't work so I can not finish installing the program... what should I do?! any suggestions ?!

    copy the installation files to a desktop directory.  install from that directory.

  • HELP QUICK!  My iPad is restricting me from using YouTube, when I used my friend's theirs worked perfectly (using my wifi) and when I try again to use mine at home it doesn't work. help me please!

    Dear reader,
    Could you please help me quick, my iPad is restricting me from something.
    I tried to go on YouTube many times on my favorite videos list and I get a message saying: you don't have permission to access the requested resource. I go to settings to see if anybody restricted me from YouTube and nobody did. I went to my friend's house and they have wifi. My iPad worked perfectly in YouTube. I went back to use my dad's iPad and after I watched some videos for a while, his stopped working on YouTube too. After then, I went back to my mom's house and the same thing happened. TO BOTH MY IPAD AND MY DAD'S! Is there something wrong with them? Please reply soon! :)

    I have the same issue. When I select a video from my favorites list (this is in the YouTube app—not through the Safari browser), I get the error message "You do not have permission to access the requested resource." My sister has said she has gotten the same message on her iPhone 3GS.
    The work around is to kill the YouTube process (double press the home key to bring up the recent apps list, press and hold on the YouTube icon until the red minus sign appears, then tap on the minus sign). When you restart YouTube, it works.
    However, invariably, the next day, when I try again, I get the same message, and have to kill YouTube again.

  • Logic dosen't work

    Hi,
    I have a problem to change a user's password. Here is the condition. In my db it has a table called userpassword.
    userpassword(empno,username,password,level)
    At first time who wants to access this system must logs on to the system via submitting
    username and password. The it displays the main form. My problem is, I wrote a .jsp page to update the password. But I want to mention here something. Only the user who logs into the system can change his/her password only, others can't do it.
    Here is the form which I used to change the password,"changePasswordForm.html".
    <form method="POST" action="changePassCtrl.jsp">
    <p> </p>
    <p> </p>
      <div align="center">
        <center>
        <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse"
    bordercolor="#C0C0C0" width="47%" id="AutoNumber1" height="189">
          <tr>
            <td width="100%" colspan="2" bgcolor="#0000FF" bordercolor="#FFFFFF" height="19">
            <font color="#FFFFFF"><b>Change Password</b></font></td>
          </tr>
          <tr>
            <td width="50%" bordercolor="#FFF3C6" height="23"
    bgcolor="#FFF3C6"><b>Username</b></td>
            <td width="50%" bordercolor="#FFF3C6" height="23" bgcolor="#FFF3C6">
            <input type="text" name="username" size="15" style="border: 1px solid
    #0000FF"></td>
          </tr>
          <tr>
            <td width="50%" bordercolor="#FFF3C6" height="20" bgcolor="#FFF3C6"><b>
            Enter old password</b></td>
            <td width="50%" bordercolor="#FFF3C6" height="20" bgcolor="#FFF3C6">
            <input type="text" name="oldPass" size="15" style="border: 1px solid
    #0000FF"></td>
          </tr>
          <tr>
            <td width="50%" bordercolor="#FFF3C6" height="20" bgcolor="#FFF3C6"><b>Enter new
    password</b></td>
            <td width="50%" bordercolor="#FFF3C6" height="20" bgcolor="#FFF3C6">
            <input type="password" name="newPass" size="15" style="border: 1px solid
    #0000FF"></td>
          </tr>
          <tr>
            <td width="100%" align="center" bordercolor="#FFF3C6" height="26" colspan="2"
    bgcolor="#FFF3C6">
            <input type="submit" value="SUBMIT" name="B3" style="border:1px solid #0000FF;
    font-weight: bold"></td>
          </tr>
          <tr>
            <td width="50%" bordercolor="#FFFFFF" height="3"></td>
            <td width="50%" bordercolor="#FFFFFF" height="3"></td>
          </tr>
        </table>
        </center>
      </div>
    </form>here is the file "changePassCtrl.jsp"
    <%@ page language="java" import="java.util.*"%>
    <%@ page import="hrm.UserAccManager" %>
    <%@ page session="true" %>
    <%@ page import="java.sql.*,javax.servlet.http.*" %>
    <jsp:useBean id="useraccount" class="hrm.UserAccManager" scope="request"/>
    <% hrm.UserAccManager user =
    (hrm.UserAccManager)request.getSession().getAttribute("useraccount");%>
    <%
         final String DRIVER = "com.mysql.jdbc.Driver";
           final String DBURL  = "jdbc:mysql://localhost:3306/superfine";
            // Load the driver class and establish a connection
         Class.forName(DRIVER);
            Connection connection = DriverManager.getConnection(DBURL);
            PreparedStatement pstmt =null;     
         String value1 = user.getUsername();
         String value2 = user.getPassword();
         String nextPage ="MainForm.jsp";
         String uName = request.getParameter("username");
         String uPass1 = request.getParameter("oldPass");
         String uPass2 = request.getParameter("newPass");
         if((value1==uName)&& (value2==uPass1)){
              //Prepare a statement that will handle the update
              String sql ="UPDATE UserPassword SET password= + uPass2 + ";
             pstmt = connection.prepareStatement(sql);          
              //assign value for ???
                   pstmt.setString(1, uPass2);          
                   pstmt = connection.prepareStatement(sql);
                   pstmt.executeUpdate();
                   //Close any open JDBC objects
                   if(pstmt != null) pstmt.close();
                   if(connection != null) connection.close();
         %>
              <jsp:forward page="MainForm.jsp"/>
         <%
         else{
         %>
              <jsp:forward page="InvalidUNamePass.html"/>
         <%
    %>In this file ther is some logic behind it. If the user enters the correct username and
    password, then it must update the db and finnaly should display the "MainForm.jsp".
    Otherwise if username and password invalid, then it should displays
    "InvalidUNamePass.html". But my problem is, when I enter a invalid username and password
    it displays "InvalidUNamePass.html", but it also display the "InvalidUNamePass.html" for
    valid username and password also. Why is it?
    Please can somebody help me. Thanks.

    You cannot compare strings with "==" operator. Use String equals method to compare the strings. That is why it is going to the error page.
    if((value1==uName)&& (value2==uPass1)){
    Replace with
    if (value1.equals(uName) ---- Like this.
    Thanks

  • I am currently in Italy and my phone wont work, help me please?!

    my phone just says that it has no signal all the time and wont let me send messages

    Buying a bundle doesn't mean that your device will work aborad you need to make sure roaming is enabled on your account.
    If you have a EE extra plan you still need to make sure roaming is enable on your account your plan only gives you free/cheaper calls when abroad.
    If your wanting to enable roaming on your account there could be a deposit to pay if you haven't had the device for about 6 months.
    Unless you have paid the deposit then roaming is not enabled on your account.
    You need to activate roaming on your account by calling 150 from your device or from a landline 01707 315000 before you leave the UK.
    But you can still do this if you are abroad.
    If you have had the device/contract for 6 months or over you can login to your online account and turn on roaming yourself
    Manage this device>Usage controls>Roaming abroad - Allow and Call abroad and turn it on. If the option is not there you need to call
    It can take 24 hours to activate
    If you had this device/contract for under 6 months you need to call customer services on +44 7953 966250 from a landline.
    Once you have activated roaming you can then use this link to see what cost there is and what bundles you can have.
    http://explore.ee.co.uk/roaming/ee
    Please read this about voicemail
    http://ee.co.uk/help/getting-started/setting-up-voicemail/divert-to-voicemail
    And this
    http://ee.co.uk/articles/set-up-your-phone-for-using-abroad
    Also sending a text to 150 with the words of RO country your going to i.e. RO Spain will get you a reply of what the costs will be from that country.

  • Interactive ALV not working - help me please

    Hi all,
    This is my first time here and I hope somebody could help me out with this.
    I have created an interactive ALV report in OOP. I have screen 1000 which contains the selection screen, and 2 custom controls. What I wanted to do is that when I select from the screen, data will be populated on the 1st ALV. Then when I double click on any item on my 1st ALV, it will do another selection and data will be displayed on the 2nd ALV (while 1st ALV contents remain). And when I double click on any item on the second ALV, it will call a transaction.
    Quite complex. But the event for my 2nd ALV is working, it's able to call a transaction. What puzzling me now is the event on my 1st ALV. Data selection is okay, but data are not populated on my 2nd ALV. It only shows data in the 1st ALV. Somebody please help!

    Hey Ayem...
    There is a other place to post your thread.
    Expert forums -> ABAP development -> UI Programming or ABAP general
    link: User Interface Development in ABAP
    All the best,
    Thanks,
    Naveen.I

  • My nokia c6-01 is stopped working , help me please

    When I'm updating my c6-01 to nokia belle the USB was disconnected and the mobile stopped working what can I do?

    Hey Mohammedraad, Welcome to the Nokia Forums.
    Its now no longer turning on at all? or Is it now not even being recognised by the computer?
    If it has completely turned off, please try take your battery out for a few minutes and then re-insert it, and see if it starts up.
    If it is no longer being recognised by the computer please go into your control panel, device manager and forget your device. Then replug it in.
    Let me know how if it works or not and I can help you further.
    Sheldrick
    Press the 'Accept As Solution' icon if I have solved your problem, Kudos my post if my advice has helped you!

  • Why firefox keep deleting my history? i try to reinstall it but it won't work. help me please.

    I just upgrade my windows and reinstall my firefox. then it won't make me save my history. at first the history saved. but when I restart my laptop then open my firefox the history won't show up. and i try to reinstall but nothing changes. help :(

    I expect you are deleting your history at the end of your session, as opposed to only clearing cache.
    Make sure your are saving history, then in the settings that you are not clearing history.
    '''Tools > Options > Privacy''' you must have "Remember my browsing history" and in Settings where check marks mean to clear things you must leave unchecked "Browsing history". Annotated picture:
    * http://img232.imageshack.us/img232/4928/clearcachew.png
    FWIW,
    App-tabs are considered part of browsing history so you must save your browsing history for app-tabs to work.

  • My z10 speakers are not working help me please

    Hello
    I bought the BB Z10 last week and after 5 days i found that the speakers are not working ,i have tried everything such taking the batter,restart,format etc
    i have found so many people have the same situiation that i ave with my bb
    what should i do ??

    Hello Doss188.
    Do not reboot the Z10 or tried to get the battery for a minute to see if it works?
    Regards.
    Kudos **Do not forget to give those people who help and advise you regarding your questions, as well give the answer like**
    @ gutijose14
    BBM Channels  PIN: C0007093A
    Do not forget to give LIKE    Those people who help you and advise you about your doubts.  if the review has been SOLVED** # 4LL  #ÉliteRoad  Make a backup of your BlackBerry
    BlackBerry Protect and  BlackBerry Link constantly.  #ichooseBlackBerry10 Gutijose14 Forums Veteran I

  • Apple Configurator Device Backup Not Working - HELP ASAP Please

    Hey Everyone!
    We are trying to backup one iPad so we can take that backup and add it to all of our other iPads....
    In Apple Configurator I've added all of the apps, setup a profile, etc.
    On PREPARE, At the top I go to DEVICES and click on BACKUP. It gets to the "archiving" part of step 1 of 2 and I receive a popup saying "Could Not Create a backup. The device was disconnected... check the usb connection to this device".
    I'm going to assume this has nothing to do with my USB connection as I've tried several ports and several cables.
    We really need to get this backup and restore it onto all of our ipads as soon as possible.
    This is our first time using apple configurator!
    Thanks so much!
    Any help would be greatly appreciated!!!

        Let's get your iPhone back up and running reeset12! My first recommendation is to try a soft reset by holding down the power and home keys. If the device doesn't respond, I recommend connecting it to a computer via the usb cable. If you are unable to get past the logo screen in either case, I recommend a hands on evaluation at a store location.
    http://bit.ly/3SdsA
    Sincerely,
    JonathanK_VZW
    VZW Support
    Follow Us on Twitter@VZWSupport

Maybe you are looking for

  • Cutover Plan SAP GRC AC

    Hi all, I´m interested in getting some templates for planning and describe a detailed Cutover Plan for SAP GRC Access Control, which includes all activities for performing in each one of the modules for SAP GRC (RAR, ERM, CUP and SPM). Anybody has so

  • SDM stopped?

    Hi there, We have a strange problem with the Netweaver Administrationpanel: We've started the SDM-Service manually and it's running without problems (for example the JSPM can Deploy packages, etc). The Netweaver Administrationpanel shows SDM as stopp

  • Ideas for the CE UI layer

    This thread should be used to post ideas regarding the UI layer of SAP NetWeaver Composition Environment. Before you start to post ideas please read <a href="/people/community.user/blog/2007/09/14/ask-not-what-sap-netweaver-composition-environment-ca

  • Send me a link to functional spec in business process

    hi,      this is sravan, if any one know the links to following send me those links.           1. sample of  High level  design           2. sample of  Function Spec's           3. sample of Technical Spec's

  • Center external jpg in movie?

    Is it possible to externally load jpgs with different dimensions which would center with the movie clips registration point instead of aligning with the upper left default point? Here is the code I am using currently for each button calling the jpg t