Simple login

can anyone sharing some vi's or idea on how to do a simple login file without using a sub vi??
i want to compare what the user input with a constant number. If it is correct, then it'll prompt "Correct", if wrong, "Wrong".
It will verify when user press the ok button.

Hi mahe,
with this little modification, it do what you want.
Mike
Message Edited by MikeS81 on 04-28-2008 02:35 PM
Attachments:
Unbenannt.PNG ‏14 KB

Similar Messages

  • 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>

  • I am new on flex, and i would like to create a simple login + password using amfphp

    Hi all,
    I try to make a simple login password using mysql and amfphp, i have a little quesiton, i dont' know how to get back my response from php. Thanks in advance if anyone could help me.
    Best regards
    i would like to tell to the label    <mx:Label x="380" y="10" id="lResponse"/> the response from php
    I juste want to take back response from php.
    Here is my mxml :
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                   xmlns:s="library://ns.adobe.com/flex/spark"
                   xmlns:mx="library://ns.adobe.com/flex/halo" minWidth="1024" minHeight="768">
        <fx:Script>
            <![CDATA[
                import mx.controls.dataGridClasses.DataGridColumn;
                import flash.net.Responder;
                import mx.events.DataGridEvent;
                import org.corlan.VOAuthor;
                private function checkpassword():void {
                    var newauthor:VOAuthor=new VOAuthor();
                    newauthor.lname_aut = nom.text;
                    newauthor.fname_aut = prenom.text;
                    myRemote.validate(newauthor);
                private function checkInput():void
                    if(nom.text == "" || prenom.text == "")
                        lResponse.text = "Veuillez completer tout les champs";
                    else
                        lResponse.text = "connecter";
                        checkpassword();
                    //    checkLogin("login.Verify.validate",[nom.text,prenom.text]);
            ]]>
        </fx:Script>
        <fx:Declarations>
            <!-- Place non-visual elements (e.g., services, value objects) here -->
            <mx:RemoteObject id="myRemote" destination="MyService" source="MyService"
                             endpoint="http://localhost/amfphp/gateway.php" showBusyCursor="true"/>
            </fx:Declarations>
        <s:Panel x="334" y="168" width="245" height="135" title="Identifiez vous" textAlign="center">
            <s:TextInput x="102" y="10" textAlign="left" id="nom" />
            <s:TextInput x="102" y="40" textAlign="left" id="prenom" />
            <s:RichText x="50" y="6" text="Login :" height="22" width="56" textAlign="left" verticalAlign="bottom"/>
            <s:RichText x="27" y="46" text="Password :" height="20"/>
            <s:Button x="125" y="70" label="Connecter" width="105" click="checkInput()"/>
            <mx:Label x="380" y="10" id="lResponse"/>
        </s:Panel>
    </s:Application>
    Here is my php code :
    <?php
    session_start();
    require_once ('./vo/org/corlan/VOAuthor.php');
    //conection info
    define( "DATABASE_SERVER", "127.0.0.1");
    define( "DATABASE_USERNAME", "root");
    define( "DATABASE_PASSWORD", "xxxx");
    define( "DATABASE_NAME", "flex360");
    class MyService {
        function validate($author){
            $mysql = mysql_connect(DATABASE_SERVER, DATABASE_USERNAME, DATABASE_PASSWORD);
            mysql_select_db(DATABASE_NAME);
            $user = $author[0];
            $pass = $author[1];
            $query = "SELECT DISTINCT * FROM authors_aut WHERE fname_aut = '$user' AND lname_aut = '$pass'";
            $rs = mysql_query($query);
            $var = mysql_fetch_assoc($rs);
            $u = $var["fname_aut"];
            $p = $var["lname_aut"];
            if ($pass != $p){
                $response[0] = "INVALID";
                $response[1] = "Invalid username and/or password";
            } else {
                $response[0] = "VALID";
                $response[1] = "Welcome $u";
            return $response;
    ?>

    I usually have a resultHandler function, to handle stuff from the server.
    resultHandler(event:ResultEvent):void

  • Creating a simple Login screen

    Hi folks,
    I'm a beginner trying to develop some code for a simple login screen for a database.
    I know that some packages (Access) have tailor-made code for this but can't seem to find
    anything in Oracle to do this. Can anyone help or point me in the right direction ?
    I'm using Oracle 8i and Forms 6i(8.1.7) running on Windows NT4.
    Thanks in advance,
    John

    Forms has a default for that.
    When you start a form with Forms runtime, the login screen is displayed automatically.

  • SIMPLE login script install of zfd4 agent?

    Is there is simpler way of installing the zfd4 agent via a login script when
    I'm not using an intermediate tier or use the application explorer. The
    login script examples I've found onlnie (and information in the Novell docs
    and Novel Press books) seem complex and frought with pitfalls...
    Thanks,
    KB

    > I'm reviewing this TID; I may be able to do this on my own. However, if
    > anyone has an example, working "simple" login script they could post as
    an
    > example, it would be REALLY appreciated....
    >
    > Thanks!
    > KB
    > "KB" <[email protected]> wrote in message
    > news:mHgfg.738$[email protected]..
    > > Forgot to mention - I want to run this in silent mode, and need to
    handle
    > > the issue where someone already has the agent installed...
    > >
    > > Thanks,
    > > KB
    > >
    > > "KB" <[email protected]> wrote in message
    > > news:Dfgfg.703$[email protected]..
    > >> Is there is simpler way of installing the zfd4 agent via a login
    script
    > >> when I'm not using an intermediate tier or use the application
    explorer.
    > >> The login script examples I've found onlnie (and information in the
    > >> Novell docs and Novel Press books) seem complex and frought with
    > >> pitfalls...
    > >>
    > >> Thanks,
    > >> KB
    > >>
    > >
    > >
    >
    >
    Hi,
    your Login Script must be seen like this:
    #z:exist c:\programme\novell\zenworks\nalwin32.exe
    if "%ERRORLEVEL"="0" THEN GOTO NOTHING
    #z:\zfdagent\agent.bat
    NOTHING:
    END
    the agent.bat is a batch File to install the agent in silent mode
    it looks like that:
    msiexec /i z:\zfdagent\zfdagent.msi /qn ADDLOCAL=ALL EDITABLE_MT_ADDRESS=1
    STARTUP_APPWINDOW=1 STARTUP_APPEXPLORER=0 REBOOT=ReallySuppress /l*v %
    WINDIR%\zfdagent.log
    the z:\zfdagent is a subdirectory in the sys:\system\Public where
    zfdagent.msi file exists.
    hier is a link to download exist.exe
    Download: http://www.novell.com/coolsolutions/...oads/exist.zip
    Best regards
    Issam

  • Tutorial for simple login form

    Can anyone post a link to a tutorial for a simple login form in Oracle form devloper 10g?
    Thanks,
    Va
    Message was edited by:
    user450092

    > 1. When I enter the correct username and password, it
    just drops me back
    > into the login page.
    This - header("Location=
    http://thenewpage.com");
    should be this - header("Location= thenewpage.php");
    > 2. When I enter the incorrect username and password, it
    drops me back into
    > the login page without the error message.
    Post the rest of the form, please.
    (Now I'm really off for the Philles game!)
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    ==================
    "Virginia Carter" <[email protected]> wrote in
    message
    news:g0pibi$lu2$[email protected]..
    > I'm trying to create a simple login using a form and php
    and am having
    > difficulty in troubleshooting - if someone could give me
    a little help, I
    > would greatly appreciate it.
    >
    > Here is the code:
    >
    > <?php
    >
    > $error = FALSE;
    >
    > if (isset($_POST['client_password']) &&
    isset($_POST['client_username']))
    > {
    > if (($_POST['client_password'] == 'blah') &&
    > ($_POST['client_username'] == 'blahblah')) {
    > header("Location=
    http://thenewpage.com");
    > exit();
    > }
    > else {
    > $error = "<h2>You have entered an incorrect
    password/username.
    > Please try again.</h2>";
    > }
    > }
    >
    > ?>
    >
    > (and in the document body)
    >
    > <?php echo $error?$error:''; ?>
    > <form method="POST" action="<?php echo
    $_SERVER['PHP_SELF']; ?>"
    > name="form1
    > " id="form1">
    > <rest of form follows here>
    >
    > In testing this page in the browser:
    >
    > 1. When I enter the correct username and password, it
    just drops me back
    > into the login page.
    >
    > 2. When I enter the incorrect username and password, it
    drops me back into
    > the login page without the error message.
    >
    > Thanks in advance.

  • How to work with EJBs and database for a simple login application

    Hi all :)
    I am new in JSP,EJB and Servlets. I just wanted to develop a simple login application, using JSP+EJBand servlets. In some tutorial I found that the beans are already populatesd with database records. But will it be good logic to retrive all records into a bean and then search for a perticuler users data for authentication.
    Can any one tell me me what is the best logic for doing so. :(
    Thanx in advance.

    Himanshu.Shekhar wrote:
    Hi all :)
    I am new in JSP,EJB and Servlets. I just wanted to develop a simple login application, using JSP+EJBand servlets. In some tutorial I found that the beans are already populatesd with database records. But will it be good logic to retrive all records into a bean and then search for a perticuler users data for authentication.No. Let the database do the search. It's far more efficient.
    %

  • Help needed "tabEnabling" not working in simple login page - Flex

    Hello Friends,
    I need a small help in Flex. I am doing a simple login page application  in FlashBuilder 4.0 & i have kept 2 input boxes like Login,Password  and a submit buttion. On clicking the button i am calling a method, so  far everything is working fine.... But some how tabenabling is not  working. suppose if you are in login inputbox and i press "tab key" it  has to go to password input box.. but its not working. can any one help  me on this, why it is not working. i have tried all the attempts using  tabEnabled = "true". but stil i am failing to do this.
    your help would be appreciated.
    Rajesh
    Message was edited by: Rajeshb_Flash

    <?xml version="1.0" encoding="utf-8"?>
    <mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml"
       width="100%"
       height="100%"
       verticalAlign="middle"
       horizontalAlign="center">
    <mx:Script>
      <![CDATA[
       import com.tel.model.EventConstants;
       import mx.controls.Alert;
       import mx.managers.CursorManager;
       import mx.rpc.events.FaultEvent;
       import mx.rpc.events.ResultEvent;
       import mx.rpc.http.mxml.HTTPService;
       private var httpService:HTTPService;
       public var userID:String = "";
       public function init():void{
       private function mouseClickSubmit():void{
        if(userName.text != "" && password.text != ""){
         userID = userName.text;
         initService();
        }else{
         if(userName.text == ""){
          Alert.show("Please enter 'User Name'.","Alert!")
         }else if(password.text == ""){
          Alert.show("Please enter 'Password'.","Alert!")
       private function initService():void{
        var params:Object = new Object();
        params["userName"] = userName.text;
        params["password"] = password.text;
        httpService = new HTTPService();
        httpService.showBusyCursor = true;
        httpService.resultFormat = "xml";
        httpService.method=URLRequestMethod.POST;
        httpService.addEventListener(ResultEvent.RESULT, httpServiceResultHandler);
        httpService.addEventListener(FaultEvent.FAULT, httpServiceFaultHandler);
        httpService.url = "Login.action";
        httpService.send(params);
       private var boolFirstRun = true;
       private function httpServiceResultHandler(event:ResultEvent):void{
        httpService.removeEventListener(ResultEvent.RESULT, httpServiceResultHandler);
        httpService.removeEventListener(FaultEvent.FAULT, httpServiceFaultHandler);
        httpService = null;
        var resultXML:XML = new XML(event.result.toString());
        if(resultXML.children().toString() == "true"){
         boolFirstRun = false;
         dispatchEvent(new Event(EventConstants.LOGIN_SUCCESS))
        }else{
         userName.text = "";
         password.text = "";
         Alert.show("Login Failed! Invalid 'User Name' or 'Password'.","Alert")
       private function httpServiceFaultHandler(event:FaultEvent):void{
        httpService.removeEventListener(ResultEvent.RESULT, httpServiceResultHandler);
        httpService.removeEventListener(FaultEvent.FAULT, httpServiceFaultHandler);
        httpService = null;
      ]]>
    </mx:Script>
    <mx:Panel title="Login Page" width="400" height="300" styleName="loginPanel" verticalAlign="middle" horizontalAlign="center" backgroundImage="assets/images/hello.jpg" backgroundAlpha=".1">
       <mx:VBox width="260" height="95" styleName="loginBox" backgroundAlpha=".2">
       <mx:HBox width="100%">
        <mx:Label width="85" text="User Name" styleName="loginTextStyle"/>
        <mx:TextInput width="150" id="userName"/>
       </mx:HBox>
       <mx:HBox width="100%">
        <mx:Label width="85" text="Password" styleName="loginTextStyle"/>
        <mx:TextInput width="150" id="password" displayAsPassword="true"/>
       </mx:HBox>
       <mx:HBox width="100%">
        <mx:Spacer width="80%"/>
        <mx:Button label="Enter" id="submit" click="mouseClickSubmit()"/>
       </mx:HBox>
      </mx:VBox>
    </mx:Panel>
    </mx:VBox>

  • ADF correct way to implement simple login?

    I have an ADF app that just needs some simple login functionality.
    I found a tutorial somewhere and did the following:
    Put this in my jazn-data.xml file
    <login-config>
        <auth-method>FORM</auth-method>
        <form-login-config>
          <form-login-page>/login.html</form-login-page>
          <form-error-page>/login.html</form-error-page>
        </form-login-config>
      </login-config>
    Created static page login.html
    Created the users
    And it works!
    Problems:
    - I would like to have an ADF page as my login page, not some simple HTML page that looks nothing like the rest of my application. If I replace the html page with a jspx in the above xml file then I get java.lang.RuntimeException: Cannot find FacesContext
    - On failed login it should redirect to login page and provide an error message, not just redirect.
    I have not been able to find a definitive tutorial on how to do this. Help would be appreciated, thanks.
    JDeveloper 11.1.1.6

    Hi,
    because you have to use faces/filename.jspx
    Frank

  • HELP!! Need a script for DUMMIES for a simple login/register feature

    I know very little html and am more of a designer, but my programmer has let me me down so I have to take this on myself.
    I want to include a very common feature where visitors register to my site, so I can collect some information and contact details from them, then they can access hidden pages of the site and receive some exclusive download links by email, allowing them to download content (only once). They can then login each time they visit with a userID or email and a password.
    My host supports almost every scripting language.
    I've been told PHP is what I need, but I know absolutley nothing about it. My host said there is templates for such a simple script out there on the net for free but I'm being passed from pillar to post with scripts for much more complicated and rarer scripts than I need.
    Hope you can help.
    LB

    Do I need to create a database to store users info first?
    Yes. Without a database, it won't work.
    Is this a basic html page with a table with lots and lots or rows and columns for each of the details they have entered (e.g Name, DOB, Address.....etc)??
    No, I'm afraid not. Dreamweaver's PHP server behaviors work in conjunction with the MySQL database. If your hosting company supports PHP, you will almost certainly have access to a MySQL database and phpMyAdmin, a web-based program that helps create and maintain MySQL databases. As a minimum, your users table in the database will need three columns:
    user_id (a number that acts as the primary key for each record)
    username
    password
    You can also have other columns to store other details, such as first name, family name, and any other information that you want to store.
    If you have never done any PHP or database development before, this is going to be a major undertaking for you. The Adobe Developer Centre has some articles that show you how to set up a PHP/MySQL testing environment (http://www.adobe.com/devnet/dreamweaver/articles/setting_up_php.html) and create your first database-driven pages (http://www.adobe.com/devnet/dreamweaver/articles/php_event_registration.html). The Dreamweaver help files also step you through the process of creating a login system (http://help.adobe.com/en_US/Dreamweaver/10.0_Using/WScbb6b82af5544594822510a94ae8d65-7883a .html).
    Working with PHP/MySQL isn't difficult, but there's a lot to absorb. If you're going to start working with login systems and other database-driven features, you might find it useful to take a look at one of my books about Dreamweaver and PHP. I have different editions for Dreamweaver 8, CS3, and CS4. You can find more details at my website (http://foundationphp.com/).
    Good luck.

  • Any tutorials on creating a simple Login using Mysql and sessions?

    Hey guys. I cannot seem to find any information(online) or books that cover sessions in JSF and how to do a simple log in. I can get the application to query a mysql table and check the credentials and go to the next page, but I'm not sure how to make that page locked from non authorized access. I am very familiar with PHP and using it to create database driven applications. It's very straightforward, making safe logins using mysql, and creating sessions once the user has logged in(making pages locked unless the user is logged in, etc).. I have the core java server faces book but it's a joke. I feel like its an incomplete book. It merely skims a topic, and when you think it's going to get interesting it moves on to something else. It teaches basic stuff but nothing of what I want to do(or need to do). The older Javaserver faces book that came out in 2004 from O'Reilly doesn't seem to help either. I'm just wondering where people learn JSF at. I know Java, I would say pretty well as far as desktop applications go. I really like the way JSF is layed out and would really like to use it in my next project. At the level I know it now it's perfect for static web pages with no dynamic information.(but I could use plain html for that). Thanks for all your help.

    dothedru22 wrote:
    but I'm not sure how to make that page locked from non authorized access.You can use a Filter for that. Map the filter on the desired url-pattern and write doFilter() logic which checks if the user is logged in (basically: if there is an User object in the HttpSession) and handle accordingly (chain.doFilter() on success or response.sendRedirect on fail).
    and creating sessions once the user has logged in(making pages locked unless the user is logged in, etc).. The HttpSession is backed by a cookie (as is PHP's $_SESSION, did you know that?), you don't need to do any low-level stuff with cookies. Maybe at highest if you ever want a "remember me on this computer" option.
    booksThe mentioned books learns you the JSF basics. They doesn't really learn the best practices / practical use cases. There you have other resources for (or just practical experiences). Besides, I recommend you to go get a book which covers JSF 1.2 or newer. The mentioned ones are outdated, as is everything else older dan two years in the programming world.

  • Getting error 404 when iam running a simple login servlet in tomcat

    hi
    this is my Login.java
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    public class Login extends HttpServlet
         public void doPost(HttpServletRequest rq, HttpServletResponse rs)
              String username =rq.getParameter("username");
              String password =rq.getParameter("password");
    try{
              rs.setContentType("text/html");
              PrintWriter out=rs.getWriter();
              out.println("<html><body>");
              out.println("thank u, " + username + "you r logged sucessfully");
              out.println("</body></html>");
              out.close();
              }catch(Exception e){
                   e.printStackTrace();
    i have saved in the form ofC:\Program Files\apache-tomcat-4.1\webapps\sravan\WEB-INF\classes\Login.class
    where sravan is my folder
    step 2: Login.html
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <html>
    <head>
    <title>login page</title></head>
    <body>
    <h1> WELCOME TO THE SERVLET HOME PAGE</h1>
    ENTER UR USERNAME AND PASSWORD
    <form action="/sravan/Login" method="Post">
         username<input type="text" name="username" >
         password<input type="password" name="password" >
         <input type="submit" value="submit"></form>
         </body>
    </html>
    i have saved in the form C:\Program Files\apache-tomcat-4.1\webapps\sravan\Login.html
    step3:
    my 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>
    <display-name>beginning j2ee</display-name>
    <servlet>
    <servlet-name>Login</servlet-name>
    <servlet-class>Login</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>Login</servlet-name>
    <url-pattern>Login</url-pattern>
    </servlet-mapping>
    </web-app>
    i have saved in C:\Program Files\apache-tomcat-4.1\webapps\sravan\WEB-INF\web.xml
    step4:
    here is my server.xml
    <Context path="/sravan" docBase="sravan" debug="0" reloadable="true" privileged="true"/>
    saved in C:\Program Files\apache-tomcat-4.1\webapps\sravan\WEB-INF\server.xml
    everything is fine....program is compiled ...but when iam running the servlet in tomcat iam getting error 404 Login.html not found....
    so plz kindly help me this my first servlet .....

    There seems not to be any '.html' in your url-pattern
    <url-pattern>Login</url-pattern>- so i presume you should use
    http://yourhost/Logininstead.

  • Simple Login and Session maintaining with Mysql

    Hi everybody,
    I'm not expert in Java servlets and I'm writing and application that recognize users and maintain their session trough application's pages.
    This application, after authentication, will displays a table coming from a query where I will have to modify only a "square" ( i Don't know the right english name for it,sorry...) of a row, more exactly the notes
    I need a hand about Session and Login, and if you can post the code of a "row-selectionable" (to modify notes) query resulted table it will be very appreciated ;) (for the table, does'nt matter if it will be a Servlet or a JSP)
    This is my actual Login code, but it doesn't works! (I tried to manage session reading some tutorials around the net)
    package Login;
    import java.sql.*;
    import javax.servlet.http.*;
    import javax.swing.JOptionPane;
    * @author Alessio
    * TODO To change the template for this generated type comment go to
    * Window - Preferences - Java - Code Style - Code Templates
    public class Login extends HttpServlet{
         private Connection con;
         private Statement st;
         private ResultSet rs,rs2;
         boolean autenticato= false;
         public void doGet(HttpServletRequest req,HttpServletResponse res) {
              try{
              Class.forName("com.mysql.jdbc.Driver");
              con=DriverManager.getConnection("jdbc:mysql://localhost:3306/gecoprova","root","argoilcane");
              HttpSession session=req.getSession(true);
              String sessione = session.getId();
              //APRE uno statement e con una query pesca dal DB tutte le tuple che hanno i dati passati allaservlet (nome, cognome,...)
              st=con.createStatement();     
              rs=st.executeQuery("SELECT * FROM anagrafe_procuratori WHERE ragsoc='"+req.getParameter("ID")+"'");
              //se il RESULTSET non � vuoto fa un check per vedere cosa restituisce RULES mentre nel frattempo pone 1 su LOGGED
              PreparedStatement updateProcuratore = con.prepareStatement("UPDATE privilegi_procuratore SET Logged=? WHERE (userid=? AND pass=?)");
              if(rs!=null){
                   if(rs.next())try {
                        st=con.createStatement();
                        rs2=st.executeQuery("SELECT * FROM privilegi_procuratore WHERE (userid='"+req.getParameter("ID")+"' AND pass='"+req.getParameter("pass")+"' AND Logged=0)");
                        if(rs2!=null){
                             if(rs2.next())try {
                                          autenticato = true;
                                          String utente=req.getParameter("ID");
                                          String password=req.getParameter("pass");
                                          HttpSession s= req.getSession(true);
                                          Utente u =(Utente)s.getValue("Login.utente");
                                          if (u==null){
                                               u =new Utente (utente,password);
                                          else{
                                               u.ID=utente;
                                               u.pass=password;
                                          s.putValue("Login.utente",s);
                                            rs2.close();     
                                            con.close();
                                            updateProcuratore.close();
                                            }catch (Exception e){e.printStackTrace();}
                                                 if (autenticato=true){               
                                                 res.sendRedirect("RulezAmministration");
              else{
                   res.sendRedirect("errorlogin.html");
                   }catch (Exception e){e.printStackTrace();}
                                  res.sendRedirect("errorlogin.html");
              else{
                   res.sendRedirect("errorlogin.html");
              res.sendRedirect("errorlogin.html");
              catch(Exception e){
                   try {
                        e.printStackTrace();
                        res.sendRedirect("errorlogin.html");
                   catch(Exception e1){}
         public void doPost(HttpServletRequest req,HttpServletResponse res){
              try{
              HttpSession s=req.getSession(false);
              Utente u=(Utente)s.getValue("Login.utente");
              u.Logout();
              s.putValue("Login.utente",s);
              res.sendRedirect("index.htm");
                   catch(Exception e1){}
    public class RulezAmministration extends HttpServlet{
         private Connection con;
         private Statement st;
         private ResultSet rs;
         public void doGet(HttpServletRequest req,HttpServletResponse res){
              try{
                   HttpSession s=req.getSession(false);
                   if (s!=null){
                        Utente u= (Utente)s.getValue("Login.utente");
                        if (u!=null){
                             if (u.ID!=null){
                                  res.sendRedirect("Inserimento.jsp");
                             else res.sendRedirect("errorlogin.html");
              catch(Exception e){}
         }

    After you can use:
    String utente=req.getParameter("ID");          
    String password=req.getParameter("pass");
    to get the ID and password, use a Database Access Object to communicate with the database. A sample block of code would something like:
    Connection conn = null;
    Context ctx = null;
    DataSource ds = null;
    try {
         DriverManager.registerDriver(new OracleDriver());
         String connectString = "jdbc:oracle:thin:@...";
                   conn = DriverManager.getConnection(connectString, userName, password);
    } catch (Exception e) {
    e.printStackTrace();
    Then,
    statement = conn.createStatement();
    resultSet = statement.executeQuery("select * from TABLE where Id = id and pass=password");
    if it returns you a result, then, it means the login info is valid, you can set this info in a session object, like:
    request.setSesion().setAttribute("login", "true");
    Later on, in your application, you can chk whether the user has logon by
    request.getSesion().setAttribute("login");
    You should organize your code so that it separate different functions in your program.
    Hope that helps.

  • How to make a simple login page using java creator studio and mysql

    Hi,
    I hav got java creator studio n my sql.Can u give me the code for login page authentication and navigation

    This is a forum about Java language questions, not about how to use a developers tool. I would say to go to the site where you got java creator studio from, and look for a forum there.

  • How to make a simple login in AS2

    I am trying to make a login that allows the user to create an account and be able to access it at anytime. Like if I was going to go on to facebook I can login. Something like that except I want it in my swift and not like a php or whatever you call it now.

    using the secure hash algorithm function is a bit of overkill for you app but it's so easy to use and fast there's no downside:
    function SHA256(s){
         var chrsz   = 8;
         var hexcase = 0;
         function safe_add (x, y) {
              var lsw = (x & 0xFFFF) + (y & 0xFFFF);
              var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
              return (msw << 16) | (lsw & 0xFFFF);
         function S (X, n) { return ( X >>> n ) | (X << (32 - n)); }
         function R (X, n) { return ( X >>> n ); }
         function Ch(x, y, z) { return ((x & y) ^ ((~x) & z)); }
         function Maj(x, y, z) { return ((x & y) ^ (x & z) ^ (y & z)); }
         function Sigma0256(x) { return (S(x, 2) ^ S(x, 13) ^ S(x, 22)); }
         function Sigma1256(x) { return (S(x, 6) ^ S(x, 11) ^ S(x, 25)); }
         function Gamma0256(x) { return (S(x, 7) ^ S(x, 18) ^ R(x, 3)); }
         function Gamma1256(x) { return (S(x, 17) ^ S(x, 19) ^ R(x, 10)); }
         function core_sha256 (m, l) {
              var K = new Array(0x428A2F98, 0x71374491, 0xB5C0FBCF, 0xE9B5DBA5, 0x3956C25B, 0x59F111F1, 0x923F82A4, 0xAB1C5ED5, 0xD807AA98, 0x12835B01, 0x243185BE, 0x550C7DC3, 0x72BE5D74, 0x80DEB1FE, 0x9BDC06A7, 0xC19BF174, 0xE49B69C1, 0xEFBE4786, 0xFC19DC6, 0x240CA1CC, 0x2DE92C6F, 0x4A7484AA, 0x5CB0A9DC, 0x76F988DA, 0x983E5152, 0xA831C66D, 0xB00327C8, 0xBF597FC7, 0xC6E00BF3, 0xD5A79147, 0x6CA6351, 0x14292967, 0x27B70A85, 0x2E1B2138, 0x4D2C6DFC, 0x53380D13, 0x650A7354, 0x766A0ABB, 0x81C2C92E, 0x92722C85, 0xA2BFE8A1, 0xA81A664B, 0xC24B8B70, 0xC76C51A3, 0xD192E819, 0xD6990624, 0xF40E3585, 0x106AA070, 0x19A4C116, 0x1E376C08, 0x2748774C, 0x34B0BCB5, 0x391C0CB3, 0x4ED8AA4A, 0x5B9CCA4F, 0x682E6FF3, 0x748F82EE, 0x78A5636F, 0x84C87814, 0x8CC70208, 0x90BEFFFA, 0xA4506CEB, 0xBEF9A3F7, 0xC67178F2);
              var HASH = new Array(0x6A09E667, 0xBB67AE85, 0x3C6EF372, 0xA54FF53A, 0x510E527F, 0x9B05688C, 0x1F83D9AB, 0x5BE0CD19);
              var W = new Array(64);
              var a, b, c, d, e, f, g, h, i, j;
              var T1, T2;
              m[l >> 5] |= 0x80 << (24 - l % 32);
              m[((l + 64 >> 9) << 4) + 15] = l;
              for ( var i = 0; i<m.length; i+=16 ) {
                   a = HASH[0];
                   b = HASH[1];
                   c = HASH[2];
                   d = HASH[3];
                   e = HASH[4];
                   f = HASH[5];
                   g = HASH[6];
                   h = HASH[7];
                   for ( var j = 0; j<64; j++) {
                        if (j < 16) W[j] = m[j + i];
                        else W[j] = safe_add(safe_add(safe_add(Gamma1256(W[j - 2]), W[j - 7]), Gamma0256(W[j - 15])), W[j - 16]);
                        T1 = safe_add(safe_add(safe_add(safe_add(h, Sigma1256(e)), Ch(e, f, g)), K[j]), W[j]);
                        T2 = safe_add(Sigma0256(a), Maj(a, b, c));
                        h = g;
                        g = f;
                        f = e;
                        e = safe_add(d, T1);
                        d = c;
                        c = b;
                        b = a;
                        a = safe_add(T1, T2);
                   HASH[0] = safe_add(a, HASH[0]);
                   HASH[1] = safe_add(b, HASH[1]);
                   HASH[2] = safe_add(c, HASH[2]);
                   HASH[3] = safe_add(d, HASH[3]);
                   HASH[4] = safe_add(e, HASH[4]);
                   HASH[5] = safe_add(f, HASH[5]);
                   HASH[6] = safe_add(g, HASH[6]);
                   HASH[7] = safe_add(h, HASH[7]);
              return HASH;
         function str2binb (str) {
              var bin = Array();
              var mask = (1 << chrsz) - 1;
              for(var i = 0; i < str.length * chrsz; i += chrsz) {
                   bin[i>>5] |= (str.charCodeAt(i / chrsz) & mask) << (24 - i%32);
              return bin;
         function Utf8Encode(string) {
              var utftext = "";
              for (var n = 0; n < string.length; n++) {
                   var c = string.charCodeAt(n);
                   if (c < 128) {
                        utftext += String.fromCharCode(c);
                   else if((c > 127) && (c < 2048)) {
                        utftext += String.fromCharCode((c >> 6) | 192);
                        utftext += String.fromCharCode((c & 63) | 128);
                   else {
                        utftext += String.fromCharCode((c >> 12) | 224);
                        utftext += String.fromCharCode(((c >> 6) & 63) | 128);
                        utftext += String.fromCharCode((c & 63) | 128);
              return utftext;
         function binb2hex (binarray) {
              var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef";
              var str = "";
              for(var i = 0; i < binarray.length * 4; i++) {
                   str += hex_tab.charAt((binarray[i>>2] >> ((3 - i%4)*8+4)) & 0xF) +
                   hex_tab.charAt((binarray[i>>2] >> ((3 - i%4)*8  )) & 0xF);
              return str;
         s = Utf8Encode(s);
         return binb2hex(core_sha256(str2binb(s), s.length * chrsz));

Maybe you are looking for

  • Credit Note in Fixed Assets add-on

    Hi experts, I really do not understand how Credit Note is working in this add-on. Depreciation(accounting impact): Dr                                                                                Cr 510000 - Depreciation (Personal Computers)       

  • How to populate custom fields for Outbound delivery header (LIKP)

    Hi All, I have added one field in the structure LIKP using APPEND structure. Now want to populate this field from a batch program. I have delivery number. Is there any API or BAPI. I already tried using the FM BAPI_OUTB_DELIVERY_CHANGE by populating

  • Sending contacts to Nokia 6103 via bluetooth

    Good morning, everyone! I'm having some trouble with the bluetooth connection between my MBP (C2D) and my Nokia 6103 telephone. Specifically, I am trying to send the contents of my addressbook from the MBP to the Nokia. However, I'm only able to send

  • Add People button results in "You have labeled everyone in your selection"

    Hopefully there's a solution out there that I simply failed to find. I am using PSE11 20120830.r.32025 When I click on the "Add People" button under the "People" tab in the Organizer, normally the program would show a dialog box, "Preparing files..."

  • Use Java to process the XSLT stylesheet

    Background:- I used Java to design a very simple Interface, which was composed of two components, one is an editable comboBox, the other is a button. What I want to achieve is selecting the value in the combobox and clicking the button, then it will