Novice asking qn, pls give a helping hand

i am trying to develop a distributed system that needs password checking in order to access.
Hence i need to check user password in my database that resides in my server.
so when ReMoTe user click "enter" after typing password.. how do i connect to my server database to verify?? is my solution given below the norm?
suggested solution: pass the userID and password to the server using HttpServletRequest, from there, the server listen for request and process connecting to local DB if a request is detected..
am i correct... pls give a helping hand...

import java.io.*;
import java.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class LoginServlet extends HttpServlet{
     private Connection con;
     private PreparedStatement pstmt;
     private Statement stmt;
     private ResultSet rs;
     private String pass = "";
     private String login="",password="",done="";
     private HttpSession session;
     public void doPost(HttpServletRequest request,HttpServletResponse response)
     throws ServletException, IOException{
          login = ""+request.getParameter("login");
          password = ""+request.getParameter("password");
          done = ""+request.getParameter("done");
          session = request.getSession(true);
          PrintWriter out = response.getWriter();
          out.println(login);
                    out.println(password);
          try{
               Class.forName("org.gjt.mm.mysql.Driver");
          }catch(Exception e){
               out.println(e.getMessage());
          try{
               con = DriverManager.getConnection("jdbc:mysql:///senji");
               if(!(password.equals("")&&login.equals(""))){
                    pstmt = con.prepareStatement("select password from logon where login = ?");
                    pstmt.setString(1,login);
                    rs = pstmt.executeQuery();
                    pass = "";
                    while(rs.next()){
                         pass = rs.getString(1);
                    if(pass.equals(password)){
                         session.setAttribute("login",login);
                         if(done.equals("null")){
                              done = "";
                              pass = "";
                              response.sendRedirect("/ksenji/quiz2/shoponline.jsp");
                         }else{
                              response.sendRedirect(done.substring(5));
                    else{
                         response.sendRedirect("/ksenji/quiz2/login.jsp?"+done);
               else{
                    response.sendRedirect("/ksenji/quiz2/login.jsp?"+done);
          }catch(SQLException ex){
               out.println(ex.getMessage());
}

Similar Messages

  • How to calculate the number of vowels from a txt file. Pls give me a hand!!

    Guys! How do i calculate the number of vowels from a txt file? I have to create a program to count the number of words, sentence, and vowels. So far I had managed to count the number of words. Now I need help on counting sentence and vowels! Pls give me a hand guys!

    I first have to read from the file not the string.I
    know how to read from a file. Now the problem ishow
    to compare a character from a txt file!You fail to understand, that you have read the data
    from the file into a string. Now loop over all
    characters in the string. Forget about the file.
    KajOr forget the scanners just as others have told you. Just read the file character by character using a FileReader.
    Kaj

  • I have an urgent question about my indesign. I had problems with the creative cloude app and then uninstalled it and then installed it again. Now it is not opening and I cannot download it again either. Pls give me help and advice if there is anything I c

    I have an urgent question about my indesign. I had problems with the creative cloude app and then uninstalled it and then installed it again. Now it is not opening and I cannot download it again either. Pls give me help and advice if there is anything I can do to repair it

    Please authorize ADE 3 with same credentials that you used with older version of ADE

  • A sapscript problem!,pls give me help.

    hi,everyone.
    when I maintain a sapscript form, I changed a main window ,then when the program executed ,error:element MAIN window MAIN is not defined for form zsds022. 
    and I don't know how to changed to the previous correct one .
    if angone know this ,pls tell me about the details step to do it .
    how can I solve this problem? I know little about sap script form .
    pls help me ,I will appreciate .

    Ok, I understood your problem, you are getting confused with MAIN window and MAiN element as both having the same name
    Let me tell you stepwise..
    1) goto SE71, give your form name, Change
    2) Click on windows you will see a window by name MAIN.
    3) now double click on MAIN window and press F9(before doing this goto menu Settings--> form Painter and see GRAPHICAL PC EDITOR  unchecked.)
    4) now once you press F9 you will see two text boxes in right hand text box see any text MAIN exists or not, if exist on the left handside it  should be like this /E
    i.e it should look like this... save activate it will work
    /E  MAIN
    If you don't find MAIN in Righthand side... add MAIN on FIRST LINE by creating new line like
    /E MAIN
    Regards,
    Sairam

  • Pls give me help! it is urgent!

    hi,all.
    when I am printing the form report .It can display how many pages of the report ,
    and if I click the icon of the next page ,can see the different content of different page.
    but when execute the print action,the next page content just overlay the content of the front page.and come out to be one page print result ,with content is the overlayed content.
    there is one page totally,and three windows main,head and foot.
    I write new-page ,but it does not work.the code of the program just so complicated .
    pls help me,thank you in advance.

    the program code as following ,
    because the program is not written by me and I have little knowledge about sap script form .so I really have no way out.pls help me!
    the problem is that overlayed print result.
    in the form there is one page containing three page windows,the next page of the main page is itself, when print preview,can display different pages and content .but print result is the next page's content overlay the front page's content ,and all content print in one page.can anyone offer some help?
    Message was edited by:
            niuniu

  • How ask indesign to give back the hand ?

    Since we work with InDesign CS5.5, when we do a book, all the stages a little long (add documents, package, synchronization ...) are keeping busy indesign
    It was the same with CS4 but we could use other applications in the same time.
    Indesign was switching in the background while indesign was working and we could work on excel, word, acrobat, etc.
    Now Indesign keeps control: we can open another program but the actions are impossible, because indesign keep the hand. (we have new computers, 8 Go Ram andt 1To disc)
    I tried to create several desktops but indesign keeps the hand on every desk!
    How can we take control of the computer?
    Thank you for your help

    Thanks.
    I found the application frame, although he did not have the same name in French... And I realised that I have been working with since the beginning.
    I will test the new user account but I can't do it by myself.
    I hope we will finish by find something  
    To be continued ...

  • Pls give me a hand and have a look, i dont know whats wrong with it

    it said-
    Order.java:45: connot reslove symbol
    symbol: class View
    location: class Order
    View my View = View();
    import java.io.*;
    import java.util.*;
    public class Order {
         private int SupplierID;
         private String SupplierName;
         private int HouseNumber;
         private String Address1;
         private String Town;
         private String County;
         private String PostCode;
         private int ShrubID;
         private String ShrubName;
         private String Genus;
         private String Species;
         private String Variety;
         private int Quantity;
         private double Price;
         public Order (int SuID, String SuN, int Hno, String Add, String T, String C, String PC,int ShID, String ShN, String G, String S, String V, int Q, double P){
              SupplierID = SuID;
              SupplierName = SuN;
              HouseNumber = Hno;
              Address1 = Add;
              Town = T;
              County = C;
              PostCode = PC;
              ShrubID = ShID;
              ShrubName = ShN;
              Genus = G;
              Species = S;
              Variety = V;
              Quantity = Q;
              Price = P;
              public boolean View() throws IOException{
                   View myView  = new View();
                   myView.getSupplierID(SupplierID);
                   myView.getSupplierName(SupplierName);
                   myView.getHouseNumber(HouseNumber);
                   myView.getAddress1(Address1);
                   myView.getTown(Town);
                   myView.getCounty(County);
                   myView.getPostCode(PostCode);
                   myView.getShrubID(ShrubID);
                   myView.getShrubName(ShrubName);
                   myView.getGenus(Genus);
                   myView.getSpecies(Species);
                   myView.getVariety(Variety);
                   myView.getQuantity(Quantity);
                   myView.getPrice(Price);
              boolean returnCode; returnCode = false;
                   try{
                        File outputFile = new File ("Order.html");
                        FileWriter writeBuffer = new FileWriter(outputFile);
                        BufferedWriter bufferedWriter = new BufferedWriter(writeBuffer);
                        writeBuffer.write("<html> \n \r");
                        writeBuffer.write("<head> \n \r");
                        writeBuffer.write("<title>Order</title>\n\r");
                        writeBuffer.write("</head> \n \r");
                        writeBuffer.write("<body> \n \r");
                        writeBuffer.write("<div align='right'> \n \r");
                        writeBuffer.write("<FONT> face = 'Times New Roman'<P>address1</P></FONT> \n \r");
                        writeBuffer.write("</div align='right'> \n \r");
                        writeBuffer.write("<div align='left'> \n \r");
                        writeBuffer.write("<FONT>  face = 'Times New Roman'<P>"+ Address1 +"</P></FONT> \n \r");
                        writeBuffer.write("</div align='left'> \n \r");
                        writeBuffer.write("<P>Order description</P> \n \r");
                        writeBuffer.write("<p>" + ShrubName + ", " + Genus + ", " + Species + ", " + Variety + "</p>\n \r");
                        writeBuffer.write("<p>Total Price =" + (Quantity*Price) + "</p>");
                        writeBuffer.write("</body> \n \r");
                        writeBuffer.write("</html>");
                        bufferedWriter.close();
                        returnCode = true;
                        catch (IOException e) {
              return returnCode;
    }

    Hi,
    It means that there is no class with the name View. You either need to write it, or import it.
    /Kaj

  • HT3702 I'm trying to open an iTunes account and was asked to provide one of each:credit card details or gift card details.i provided a gift card details and yet I'm being asked to contact the support team!!! Pls can someone help me out on this..thanx. Bre

    I'm trying to open an iTunes account and was asked to provide one of each:credit card details or gift card details.i provided a gift card details and yet I'm being asked to contact the support team!!! Pls can someone help me out on this as I cant enjoy my new iPad 3 without buying apps

    Brenda, the easiest way to contact the support team is thru the iTunes Customer Service website:
    http://www.apple.com/support/itunes/contact/

  • An unknown error occurred (0x80092013) what the **** is going on  from last six month i am unable to access i tune store?pls give me solution which should help me to shortout this problem as soon as possible

    An unknown error occurred (0x80092013) what the **** is going on  from last six month i am unable to access i tune store?pls give me solution which should help me to shortout this problem as soon as possible. i have not expected this from apple

    I have been trying for months to put iTunes on my laptop and kept getting installation errors in Windows 7. I gave up and just installed iTunes on my PC running XP.
    Now I have to install Quicktime on the laptop and once again I get an installation error 0x800736FD.
    All windows updates are fine, none failed.
    I have removed all apple software from my laptop using CCleaner, common files and folders. Tried reinstalling and still the same error.
    Could you offer any advice on how to get both quicktime and then iTunes working??
    Thank you in advance

  • My apple I'd has been discarded for security reasons. The site asks me to give my email and they would send me the further instruction. But no Emil has arrived so far. Since January. And I did requested help multiple times. :( any ideas where can I solve

    My apple I'd has been discarded for security reasons. The site asks me to give my email and they would send me the further instruction. But no Emil has arrived so far. Since January. And I did requested help multiple times. :( any ideas where can I solve

    Who discarded the Apple ID? Apple? or You?
    Did you answer the Security Questions? Is the backup email accurate? Have you tried contacting them?

  • Hi I,m Wonkeun Kim. Could u give me a hand to solve the problem which now i forget answers of my security questions. How should i do to reset my answers??

    Hi I,m Wonkeun Kim. Could u give me a hand to solve the problem which now i forget answers of my security questions. How should i do to reset my answers??

    Forgotten Security Questions / Answers...
    See Here > Apple ID: Contacting Apple for help with Apple ID account security
              Ask to speak with the Account Security Team...
    Or Email Here  >  Apple  Support  iTunes Store  Contact
    More Info >  Apple ID: All about Apple ID security questions
    Note:
    You can only set up and/or change a Rescue Email Before you forget the questions/answers.

  • HI all pls give me diff btwn upload ws_upload and GUI Upload

    HI All,
             pls give me difference  between
            upload
            ws_upload and
            GUI Upload
    Thanks & regards .
    Bharat Kumar

    Hi,
    WS_* Function modules are replaced by GUI_* FMs from 4.7 SAP version.
    GUI_* modules have additional parameters when compared with WS_* FMs.
    Both FM are used for uploading data .
    But ws_upload is obsolete now .
    WS_UPLOAD and WS_DOWNLOAD, the function modules used until now are not part of the standard set of ABAP commands. They are used to display the file interface on the presentation server. WS_UPLOAD and WS_DOWNLOAD are not compatible with USs and have been replaced by GUI_UPLOAD and GUI_DOWNLOAD.
    The new function modules, GUI_UPLOAD and GUI_DOWNLOAD, have an interface that also allows you to write Unicode format to the local hard drive. For a description of these interfaces, refer to the documentation for each function module, available under SAP Easy Access " Development " Function Builder " Goto " Documentation.
    WS_UPLOAD, GUI_UPLOAD FMs are used in BDCs.
    WS_UPLOAD loads files from the Presentation Server to Internal ABAP Tables.
    This is used upto SAP 4.6 version.
    GUI_UPLOAD is used to loads a file from the PC to the server. The data can be
    transferred in binary or text format. Numbers and data fields can be
    interpreted according to the user settings.
    You can check this for some info
    http://help.sap.com/saphelp_erp2005/helpdata/en/79/c554a3b3dc11d5993800508b6b8b11/frameset.htm
    http://www.sapdevelopment.co.uk/file/file_otherpc.htm
    Regards,
    Priyanka.

  • Pls give Link.... flash player problem

    pls give me the link of the previous flash player that works..
    im not a computer expert but its clear as day that something is wrong with the latest (10.1)...
    pls...

    Hi, you can do that, but until the Uninstall is clean, you won't be able to Install the 10.0. It sounds as if you had an application in the system tray that was running when you ran the Uninstaller, since afterwards the 10.1 was still there.
    Also, your operating system and browser(s) you use would be helpful.
    Thanks
    eidnolb

  • Pls give me the code to load method only once in JVM.

    Hi all,
    Pls give me the code to execute method only once in JVM.Even if we create more than one instance to call the method.
    Thanks & Regards,
    Vinodh

    [How to ask a question on these forums|http://catb.org/~esr/faqs/smart-questions.html]

  • Pls give the menu path for pricing schema for PO

    Pls give the menu path for pricing schema for PO
    Thanx
    Vikas Chhabra

    Hi,
    we assign account assignment category in PO.Here is the path
    IMG>Materials Management>Purchasing>Account Assignment>Maintain Account Assignment Categories OME9
    Based on account assignment category you use in PO, it will ask you cost object in PO
    E.g P (project) you need to enter G/L and WBS element
          N Network     G/L and Network
    Like in SD account determination,  OMWB is MM and FI integration.
    Regards,
    Chandra

Maybe you are looking for