Login JSP losing Session

I have a Login JSP which talks to a Servlet which then passes the login request to a Bean. In the Bean I save the login information in the Session, if the login fails I am trying to 'forward' to the Login JSP page again. On the Login JSP there is an 'errorText' field that gets the errorText Property from my Bean. However, when the 'getErrorText' method is called by the JSP I seem to have a new Session and have lost all of my login information.
What have I done wrong ? I have tried setting the 'scope' of the Login JSP to session and the application but with no result.
How can I ensure that when I re-display the Login JSP with an error message on it that I am using the Session (and copy of my bean) that I had when I set the properties ?
Sarah.

have the code for setting the session values in the servlet that comes after the JSP login page.
in the jsp login page try to retreive the session values for the user name and the password.
store these values in the name and password variables.
for the first time it'll be null and an exception will be thrown. so in the catch block, set the value of the name variable and the password to null string ie "" and set these values as the values of the textfields (for user name and password). also in the catch block, set the error message string also . this one u can use to display when u r redirected to the JSP login page by the servlet. if first time, then set it to null string "".
but assuming that the JSP page has been called from the servlet when an error occured i.e when the server cannot recognize the user name and password combination, the session variables for the user name and the password won't be null and u can use these values to be displayed in the respective textfields.
so when the user name and password cannot be recognized by the server, just call the same JSP login page.
hope that clears a bit of ur doubt!!
rgds
JP

Similar Messages

  • Issue in applying SSL selectively to Login JSP Page--Session getting lost.

    Hi,
    I am facing some issues with SSL configuration on my web site running on tomcat 5.5. I am using jdk 1.5 and form based authentication with JAAS framework.
    The SSL configuration is working perfectly when applied to complete web site, but starts giving problem when applied selectively to some JSP pages. At present I am trying to apply SSL just on the login page.
    When the login screen loads up, the URL in the browser has a protocol "*https*", as expected, but it doesn't gets changed to "*http*" once the user has successfully logged in. Why is the automatic change from https to http not ocurring?
    Also I want to know which is the default page, tomcat will direct the logged in user to, once successfully authenticated using form based login; Is there any way to change this default page to some other page. It looks like that tomcat automatically directs to index.html , once the user has been successfully authenticated, but I am not so sure. My index.html page is having 4 frames; the source of these frames are different JSP pages, which are not under SSL.
    My aim is to apply SSL just on login.jsp so that password doesn't travel in clear text. Once the user is authenticated he should see index.html and the address bar's URL should change it's protocol from https to http.
    Please, find below the code in my web.xml
    <security-constraint>
    <web-resource-collection>
    <web-resource-name>CWA Application</web-resource-name>
    <url-pattern>/about.jsp</url-pattern>
    <url-pattern>/admin_listds.jsp</url-pattern>
    <http-method>DELETE</http-method>
    <http-method>GET</http-method>
    <http-method>POST</http-method>
    <http-method>PUT</http-method>
    </web-resource-collection>
    <auth-constraint>
    <role-name>*</role-name>
    </auth-constraint>
    <user-data-constraint>
    <transport-guarantee>NONE</transport-guarantee>
    </user-data-constraint>
    </security-constraint>
    <security-constraint>
    <web-resource-collection>
    <url-pattern>/*login.jsp*</url-pattern>
    <http-method>GET</http-method>
    <http-method>POST</http-method>
    </web-resource-collection>
    <auth-constraint>
    <role-name>*</role-name>
    </auth-constraint>
    <user-data-constraint>
    <transport-guarantee>CONFIDENTIAL</transport-guarantee>
    </user-data-constraint>
    </security-constraint>
    <login-config>
    <auth-method>FORM</auth-method>
    <realm-name>CWA Application</realm-name>
    <form-login-config>
    <form-login-page>/login.jsp</form-login-page>
    <form-error-page>/login.jsp?error=true</form-error-page>
    </form-login-config>
    </login-config>
    <welcome-file-list>
    <welcome-file>login.jsp</welcome-file>
    </welcome-file-list>
    My login. jsp has below code:
    <form name="login" method="POST" action='<%= response.encodeURL(*"j_security_check*") %>' >
    <tr>
    <td width="100%">
    <table width="260" border="0" cellspacing="0" cellpadding="1">
    <tr>
    <td align="left" valign="top" rowspan="4"><img src="images/space.gif" width="15" height="5"></td>
    <td align="right" class="login-user" nowrap ><p>User name: </p></td>
    <td align="left" valign="top"><input maxLength="64" name="j_username" size="20"></td>
    </tr>
    <tr>
    <td align="right" nowrap class="login-user"><p>Password: </p>
    </td>
    <td align="left" valign="top">
    <input maxLength=\"64\" tabindex="2" type="password" name="j_password" size="20">
    </td>
    </tr>
    </form>
    The entries in my server.xml are following:
    <Connector port="8080" maxHttpHeaderSize="8192"
    maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
    enableLookups="false" redirectPort="8443" acceptCount="100"
    connectionTimeout="20000" disableUploadTimeout="true" />
    <Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
    maxThreads="150" scheme="https" secure="true"
    keystoreFile="${java.home}\lib\security\cacerts" keystorePass="changeit"
    clientAuth="false" sslProtocol="TLS" />
    I have gone through the http://forums.sun.com/thread.jspa?threadID=197150 and tried implementing it; The filter as explained in the thread does gets called but the session values are still lost.
    Please note I am using javascript to go from secure "https" to "http" once the user has successfully logged in The javascript code is as below:
    top.location.href="http://localhost:8080/qtv/index.html." ;
    If I use response.sendRedirect("http://localhost:8080/qtv/index.html") for going to non-secure mode, the index.html page does not gets loaded properly. (Please note that my index.html is made of *4 frames*, as explained earlier. This is a legacy code and frames can't be removed).
    The reason for index.html not getting loaded properly is that the Address bar URL does NOT change its URL and protocol from https (https://localhost:8443/qtv/index.html ) to "*http*" (http://localhost:8080/qtv/index.html) when esponse.sendRedirect() is used ;this is the default behaviour of response.sendRedirect(). And because the protocol in address bar is https, index.html is not able to load the other JSP's in it's frames because of cross-frame-scripting security issues (The other JSP's to be loaded in frames are are NOT secure as discussed earlier).
    Please let know if any way out.
    Thanks,
    Masaai

    Hi
    try to set the maximum interval between requests
    eg:
    session.setMaxInactiveInterval(6000);
    vis

  • Losing session with WLS 7.02 in cluster env

              PROBLEM: We are losing our session when running in our app in a clustered environment.
              The user can use the app for a while, but then weird stuff starts happening. In
              some cases, the login check that we do at the begining of each request fails,
              because it tries to check for a login token in the session, and the session has
              been wiped out. The user gets forwarded to the login page.
              Our configuration is:
              WLS 7.0.2 (OS = Windows 2000)
              Admin Server and a managed server A at APP1 (physical machine), another managed
              server B
              at APP2 (physical machine), A and B is in one cluster. We had 6 Apache Servers
              2.0.45 (OS = Linux) and each works together with Weblogic Plugin. The weblogic
              plugin has the following configuration:
              <Location /sample>
              SetHandler weblogic-handler
              WeblogicCluster 10.1.1.11:7010,10.1.1.12:7010
              Idempotent ON
              CookieName JSESSIONID
              </Location>
              The server A and B use round-robin loadblancing, and we have a hardware loadblancer
              infront of Apache to do loadblancing for our 6 web servers.
              In weblogic.xml we config our application to use replicated for session failover.
              Losing session is randomly happened.
              Anyone of you have any idea?
              Thanks in advance.
              Harry
              

    To verify that it is WL and not your app logic, try using a different
              session replication implementation for testing, such as the one that comes
              with Coherence for Servlet 2.3 containers:
              http://www.tangosol.com/coherence.jsp
              Peace,
              Cameron Purdy
              Tangosol, Inc.
              http://www.tangosol.com/coherence.jsp
              Tangosol Coherence: Clustered Replicated Cache for Weblogic
              "Harry Yu" <[email protected]> wrote in message
              news:[email protected]...
              >
              > PROBLEM: We are losing our session when running in our app in a clustered
              environment.
              > The user can use the app for a while, but then weird stuff starts
              happening. In
              > some cases, the login check that we do at the begining of each request
              fails,
              > because it tries to check for a login token in the session, and the
              session has
              > been wiped out. The user gets forwarded to the login page.
              >
              > Our configuration is:
              > WLS 7.0.2 (OS = Windows 2000)
              > Admin Server and a managed server A at APP1 (physical machine), another
              managed
              > server B
              > at APP2 (physical machine), A and B is in one cluster. We had 6 Apache
              Servers
              > 2.0.45 (OS = Linux) and each works together with Weblogic Plugin. The
              weblogic
              > plugin has the following configuration:
              > <Location /sample>
              > SetHandler weblogic-handler
              > WeblogicCluster 10.1.1.11:7010,10.1.1.12:7010
              > Idempotent ON
              > CookieName JSESSIONID
              > </Location>
              >
              > The server A and B use round-robin loadblancing, and we have a hardware
              loadblancer
              > infront of Apache to do loadblancing for our 6 web servers.
              >
              > In weblogic.xml we config our application to use replicated for session
              failover.
              >
              > Losing session is randomly happened.
              >
              > Anyone of you have any idea?
              >
              > Thanks in advance.
              >
              > Harry
              >
              

  • Form based login, iframes and session time out

    Hi all,
    I'm trying to create a site using form based login.
    The site contains a page protected page, default.jsp that have a logout button/link (clicking it invalidates the session), and a navigation bar with links linking opening them in iframes inside the default.jsp page:
    I have also a login.jsp page and and a error.jsp page
    Everything works fine I can login, I can logout. My problem occurs when the session times out and the user tries to access protected contents in the internal frames. He then is promted for a new login. The problem is that the login,jsp page now turns up inside the jframe designatet for my contents.
    I woud have liked the login page to turn up at the top level i.e. filling the entire browser window (i.e on the same level as the default.jsp page). Is this somehow possible?
    Regards
    Uno Engborg

    Easy answer: use JS to jump out iframe.
    Best answer: don't use iframes, but use server side includes like jsp:include. Iframes have too much disadvangages, topping the extremely bad SEO and UX.

  • Generating error page(in jsp) when session expires....

    hello,
    i want to generate error page(in jsp) when session get expires...
    plz help me out.............

    You could do it according to the line BalusC supplied in another topic:
    <meta http-equiv="refresh" content="<%= session.getMaxInactiveInterval() %>;url=login.jsp">The only thing you gotta change, is the URL, make it:
    <meta http-equiv="refresh" content="<%= session.getMaxInactiveInterval() %>;url=error.jsp">Create 'error.jsp' and have the message 'Session expired, sorry!' or something printed. If you want to use error.jsp for more than just the session expiration, add a parameter to it:
    <meta http-equiv="refresh" content="<%= session.getMaxInactiveInterval() %>;url=error.jsp?error=sessionexpired"> Place the following lines in your error.jsp:
    String errormessage = request.getParameter("error");
    if(errormessage.equals("sessionexpired")){
    out.println("Your session has expired, sorry!");
    }else if(errormessage.equals("whatever")){
    // To do code here.
    }

  • Losing Session for Weblogic 7.0.2 in Cluster env

              PROBLEM: We are losing our session when running in our app in a clustered environment.
              The user can use the app for a while, but then weird stuff starts happening. In
              some cases, the login check that we do at the begining of each request fails,
              because it tries to check for a login token in the session, and the session has
              been wiped out. The user gets forwarded to the login page.
              Our configuration is: WLS 7.0.2 (OS = Windows 2000) Admin Server and a managed
              server A at APP1 (physical machine), another managed server B at APP2 (physical
              machine), A and B is in one cluster. We had 6 Apache Servers 2.0.45 (OS = Linux)
              and each works together with Weblogic Plugin. The weblogic plugin has the following
              configuration: <Location /sample> SetHandler weblogic-handler WeblogicCluster
              10.1.1.11:7010,10.1.1.12:7010 Idempotent ON CookieName JSESSIONID </Location>
              The server A and B use round-robin loadblancing, and we have a hardware loadblancer
              infront of Apache to do loadblancing for our 6 web servers.
              In weblogic.xml we config our application to use replicated for session failover.
              Losing session is randomly happened.
              Anyone of you have any idea?
              Thanks in advance.
              Harry
              

    The advice on version numbers given above is quite generic. While JDK 1.4 may work, if you want to run a supported configuration the answer to this question depends on what OS you're running. Further, BEA supports different JDK versions for running the server and for client applications. Here is the whole chart:
    http://e-docs.bea.com/platform/suppconfigs/configs70/70_over/overview.html
    Be sure to click on your operating system to get the specific information about what JDK is "fully-supported" and what is "client-only".
    Hope that helps,
    Justin

  • JSP application session terminated & application terminated

    I have a JSP application running under Oracle 9iAS 1.0.2.1 on a Windows 2000 server.
    Upon successful login to the application, a new browser window is opened for the application and the parent browser is redirected to a benign static HTML page. The new browser window allows us to present the illusion of a captive application - the 'application' browser window is not resizable and does not have a tool bars.
    The login jsp creates several session scope objects. These session scope objects are used by the core application jsps interfaced through the application browser.
    In the test enviroment the application functions as expected.
    In the production environment sessions appear to terminate immediately following login. All session scope objects are null in the jsp page - mainMenu.jsp - that serves as the application entry point in the new browser window. Application scope objects are not null in this initial jsp. Upon a subsequent access to login.jsp, the application_onStart event is triggered, followed by a session_onStart event and the failure of mainMenu.jsp due to null session scoped objects.
    Any ideas on how to diagnose this problem would be greatly appreciated.

    Hi Anil,
    Thxs for the reference. I will check this with the system administrator because at first glance one has to be careful with this type of configuration.
    Reward given.
    LauQ.

  • Deployig to a Cluster without losing session.

    Hi,
              We have a cluster setup with 4 servers. We use HttpSession and
              StatefulSessionBeans in the cluster with in-memory replication. Is it
              possible to redeploy the application to a cluster without losing
              session ?.
              Thanks,
              -Senthil.
              

    We have a cluster setup with 4 servers. We use HttpSession and          > StatefulSessionBeans in the cluster with in-memory replication. Is it
              > possible to redeploy the application to a cluster without losing
              > session ?.
              Not with WebLogic session replication. The session replication is "lazy"
              (only when something happens) so the best approach is to make sure there are
              no imcompatibilities and then cycle the cluster one server at a time, maybe
              one server every hour (or whatever your session timeout is).
              Peace,
              Cameron Purdy
              Tangosol, Inc.
              http://www.tangosol.com/coherence.jsp
              Tangosol Coherence: Clustered Replicated Cache for Weblogic
              "Senthil" <[email protected]> wrote in message
              news:[email protected]..
              > Hi,
              >
              >
              > Thanks,
              > -Senthil.
              

  • Typical login.jsp, middle_page.jsp and logout.jsp

    Hi all,
    I have been tring to build a login system in JSP.
    The problem is every time the session expires I am
    not able to login again immediately and on few
    ocassions lots of sessions are opened automatically
    which prevents re-loging.
    I dont even want to discuss what I did in fear of
    confusing you.
    So somebody please send me excerpts from a typical
    1.)login.jsp
    2.) someMiddlePage.jsp
    3.) logout.jsp
    That really works
    I think I am sure about the login and middlepages i.e
    -->creating a login.java bean that creates a session and
    -->adding userdata into session.
    --> and declaring <jsp:usebean id=login class=login scope =session/>
    in the middle page and check if the session has valid userid
    before serving...
    --> I am not sure about the rest..
    I think answering this question with a "working code"
    can prevent hundreds of other questions that can follow..
    Thanks a lot in advance..

    See: http://www.open-group.biz/xmlportal/Portal?xpc=1$@5$@1$@3
    The example is embedded in a portal but the source code is visible on-line.
    Good luck!

  • Losing Sessions

    I posted this on the ejb group, but then it occured to me this might be
              better.
              Hi all,
              Something very odd here.
              WLS 7.0, trying to get a WAR ported.
              Deploys allright, connects to the EJBs allright, but after the first page
              (our login page), the next JSP explodes because something it is looking for
              in the HttpSession that was put there by the Login page, is gone. In fact,
              the session that I get in the JSP's 'session' variable has no items
              whatsoever (using getAttributeNames() to check).
              WLS is running on my own machine, so my URL to the app is:
              http://localhost:7001/appName.
              I played around a bit looking at the HTTP headers and what not, and it seems
              that the JSESSIONID cookie is always changing from WLS, which would explain
              why my sessions are going away.
              The WAR works fine under Tomcat (no mean feat, as we had to tweak a lot of
              stuff to get this to compile under WLS), but now with the session loss, the
              app is pretty much dead in the water, as we can't get past our login page.
              Any ideas?
              Thanx!
              Will Hartung
              ([email protected])
              

    Will Hartung wrote:
              > I posted this on the ejb group, but then it occured to me this might be
              > better.
              >
              > Hi all,
              >
              > Something very odd here.
              >
              > WLS 7.0, trying to get a WAR ported.
              >
              > Deploys allright, connects to the EJBs allright, but after the first page
              > (our login page), the next JSP explodes because something it is looking for
              > in the HttpSession that was put there by the Login page, is gone. In fact,
              > the session that I get in the JSP's 'session' variable has no items
              > whatsoever (using getAttributeNames() to check).
              >
              > WLS is running on my own machine, so my URL to the app is:
              > http://localhost:7001/appName.
              >
              > I played around a bit looking at the HTTP headers and what not, and it seems
              > that the JSESSIONID cookie is always changing from WLS, which would explain
              > why my sessions are going away.
              >
              > The WAR works fine under Tomcat (no mean feat, as we had to tweak a lot of
              > stuff to get this to compile under WLS), but now with the session loss, the
              > app is pretty much dead in the water, as we can't get past our login page.
              >
              > Any ideas?
              >
              > Thanx!
              >
              > Will Hartung
              > ([email protected])
              >
              >
              >
              >
              >
              Did anyhow you wrote to the "next JSP" with some expiring control on the
              top/header of the page?
              Thank you,
              Neo Gigs
              [email protected]
              "Follow the white rabbit..."
              

  • Problem with login jsp

    I made a login.jsp with the help of a bean. the bean holds a string[] as a property where it stores user and pass, then those values are checked in my database, and a boolean bean property is set to true. The problem is I want to do an if statement in my JSP using that boolean, but I can't seem to get the jsp working, can anyone help me?
    I'm doing
    <%if (<jsp:getProperty name="auth" property="truth"/>) do something else something else%>
    I've also tried
    <%! boolean it = <jsp:getProperty name="auth" property="truth"/> %>
    <%if (it) do something else something else%>
    both give me compile errors.

    <jsp:getProperty name="auth" property="truth"/> is roughly equivalent to
    <% out.print(your_bean.getTruth()); %> or <%=your_bean.getTruth()%>
    Once you understand this, you'll see why your code cannot possibly work...
    Below is a simple solution to your problem.
    <jsp:useBean   class="YourBean"  id="auth"  etc.. >
    <% if auth.getTruth() {
          something; // don-t forget the semi-colon
       else {
          some other thing; // ditto
    %>If you don't want any java code inside your jsp, consult the JSTL tag lib to construct an xml-like if-else statement.

  • Help with customised login JSP on SSO server

    Our customised version of the SSO login page JSP is required to access a database table in order to retrieve a dynamic message to display. This means we will need to create utility java classes in order to connect to the database and retrieve the information. We will also ideally need a data source on the SSO APP Server that we can reference in order to avoid hard-coding environment specific connection data.
    Can anyone help out on where we will need to install the utility classes and where the data source can be created in order for the login JSP to see them. Is there any other configuration we need to consider e.g. classpaths etc?
    The coding we are fine with, it is the actual "what goes where and don't forget to include this" that we are unsure of.

    Hello St***,
    Did you accomplished the cusomized SSO logon page with database access. If yes can you please provide met with some examples and instructions how to accomplish this.
    Regards,
    Dennis

  • Redirecting user to login page after session expiry

    Hi,
    Default session expiry implementation in sap EP6.0 doesn't work properly. To overcome this, we have implemented one component where we check the idle time and throw the user back to the login page if the idle time has exceeded the session expiry period. This component has been added to desktop inner page as an iView. Following is the logic put in this component.
    IAuthentication ia = UMFactory.getAuthenticator();
    ia.logout(httpRequest, httpResponse);
    httpResponse.sendRedirect("/irj/portal");
    We are successfully getting the login page after session expiry. Issue is, our portal server is running on 11111 port. We cannot change this to 80 on unix because of unix limitations for the port number. So we have put one apache web server before our portal server. Apache web server is listening on port 80 and forwarding the request to our portal server.
    Now when user is redirected to the login page, url being shown in the browser is http://<host_name>:11111/irj/portal but I am expecting http://<host_name>/irj/portal (without port). I have tried putting the full url in sendRedirect() method but that too doesn't work.
    Any help is highly appreciated.
    Regards,
    Chandra

    Hi Chandra,
    Let the URL be relative in the sendRedirect i.e.
    httpResponse.sendRedirect("/irj/portal");
    However since you have a Reverse proxy in front, the response header for redirect will not contain the address of the reverse proxy in this case, your servername without port. You have to properly configure your reverse proxy so that the HTTP Headers are changed properly before sending the response to the users.
    Check this URL,
    http://httpd.apache.org/docs/1.3/mod/mod_proxy.html#proxypassreverse
    This gives you the details on configuring your apache.
    Hope this helps.
    Ankur
    P.S. If this helps please reward points.

  • Adding a custom button to Login.jsp

    In AM 7.1 I have a need to add a "Forgot your password?" button to the AM login page. I would like this button to be located just to the right of the existing 'Log In" button and have the same look and feel as the "Log In" button.
    When a user clicks on the button it is going to take them over to our Identity Manager questionLogin.jsp page. Linking the button to the IdM page is easy. What I don't know how to do is modify the Login.jsp page to add another button that has the same look and feel of and is positioned right next to the current "Log In" button. The AM Developer's Guide was of no help. Can anyone help and/or provide a code example that would do what I am looking for?

    Thanks for the reply, Michael. I understand that the Login.jsp needs to be modified and redeployed, but the question is how to create a new button with the same look and feel as the Login button. Currently we have modified the Login.jsp with a "Forgot Password" html link, but it would be prefered to create a button to match what already exists. I understand that this might be outside the scope of this forum, but I was hoping that someone that has done this (specifically the original poster if he found a solution) could share the relevent code.

  • Writing Login.jsp and authenticating a user who have stored in MySql DB

    Hi Friends,
    My project requirement is: Need to write a login page must send the request to servlet is the user and password avail in mysql db, if yes servlet should forward the home page else error message. Tools i need to use is IDE=eclipse, Server = tomcat, database = MySql
    Here is source:
    pls tell me where i m wrong.
    Login.jsp
    <%@ page language="java" %>
    <html>
    <head>
    <title>Login Page</title>
    <script language = "Javascript">
    function Validate(){
    var user=document.frm.user
    var pass=document.frm.pass
    if ((user.value==null)||(user.value=="")){
    alert("Please Enter user name")
    user.focus()
    return false
    if ((pass.value==null)||(pass.value=="")){
    alert("Please Enter password")
    pass.focus()
    return false
    return true
    </script>
    </head>
    <body>
    <h1>Login
    <br>
    </h1>
    <form name="frm" action="/LoginAuthentication" method="Post" onSubmit="return Validate()" >
    Name:
    <input type="text" name="user" value=""/><br>
    Password:<input type="password" name="pass" value=""/><br>
    <br>
    <input type="submit" value="Login" />
    <input type="reset" value="forgot Password" />
    </form>
    </body>
    </html>
    Servlet Code:
    LoginAuthentication.java
    import java.io.*;
    import java.util.*;
    import java.sql.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.IOException;
    import javax.servlet.ServletException;
    import javax.servlet.ServletContext;
    import javax.servlet.RequestDispatcher;
    import javax.servlet.http.HttpSession;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import java.util.List;
    import java.util.ArrayList;
    public class LoginAuthentication extends HttpServlet{
    private ServletConfig config;
    public void init(ServletConfig config)
    throws ServletException{
    this.config=config;
    //public void init() {
    // Normally you would load the prices from a database.
    //ServletContext ctx = getServletContext();
    // RequestDispatcher dispatcher = ctx.getRequestDispatcher("/HomePage.jsp");
    //dispatcher.forward(req, res);
    public void doPost(HttpServletRequest request, HttpServletResponse response)
    throws ServletException,IOException{
    PrintWriter out = response.getWriter();
    String connectionURL = "jdbc:mysql://127.0.0.1/SRAT";
    //String connectionURL = "jdbc:mysql://192.168.10.59/SRAT";
    //127.0.0.1
    //http://localhost:3306/mysql
    Connection connection=null;
    ResultSet rs;
    String userName=new String("");
    String passwrd=new String("");
    response.setContentType("text/html");
    try {
    // Load the database driver
    Class.forName("com.mysql.jdbc.Driver");
    // Get a Connection to the database
    connection = DriverManager.getConnection(connectionURL, "admin", "admin");
    //Add the data into the database
    String sql = "select user,password from login";
    Statement s = connection.createStatement();
    s.executeQuery (sql);
    rs = s.getResultSet();
    while (rs.next ()){
    userName=rs.getString("user");
    passwrd=rs.getString("password");
    rs.close ();
    s.close ();
    }catch(Exception e){
    System.out.println("Exception is ;"+e);
    if(userName.equals(request.getParameter("user"))
    && passwrd.equals(request.getParameter("pass"))){
    out.println("WELCOME "+userName);
    else{
    out.println("Please enter correct username and password");
    out.println("<a href='Login.jsp'><br>Login again</a>");
    Deployment Descriptor for TOMCAT
    web.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
    <display-name>
    SRAT</display-name>
    <welcome-file-list>
    <welcome-file>login.jsp</welcome-file>
    </welcome-file-list>
    <servlet>
    <servlet-name>LoginAuthentication</servlet-name>
    <servlet-class>LoginAuthentication</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>LoginAuthentication</servlet-name>
    <url-pattern>/LoginAuthentication</url-pattern>
    </servlet-mapping>
    </web-app>
    PLS HELP ME.
    S. Udaya Chandrika

    I too have used the same code but its giving the following error:
    HTTP Status 500 -
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    javax.servlet.ServletException: Wrapper cannot find servlet class Validation or a class it depends on
         org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
         org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
         org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
         org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
         org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
         java.lang.Thread.run(Unknown Source)
    root cause
    java.lang.ClassNotFoundException: Validation
         org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1387)
         org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)
         org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
         org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
         org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
         org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
         org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
         java.lang.Thread.run(Unknown Source)
    note The full stack trace of the root cause is available in the Apache Tomcat/6.0.18 logs.
    Apache Tomcat/6.0.18
    Please some one help??

Maybe you are looking for

  • Bex variable selection screen issue

    Dear All, I have three variables in my Bex report -- Submission date, User ID and Company Code. The variable -- 'Submission date' is of type 'Replacement Path'. Other two are User entry. When I run the report, only the 'User ID' and 'Company code' va

  • Sync new laptop with existing Apple TV and iPhone.

    I have an Apple TV and a MacBook Pro (as well as an iPhone) that were all synced and dandy, until my laptop died and had to be rebuilt. Now, with a new system, I proceeded to sync with my Apple TV and iPhone and of course nothing wants to know my lap

  • Financial statement- Balance sheet accounts

    Hi friends, In our SAP system there are some interim asset acquisition accounts added to balance sheet which should not have been there. I  removed them by editing the account-> financial statement version.  But still the same accounts are displayed

  • IPod skips over iTunes purchased music

    Hi all I am having a really annoying issue with my iPods - I have a 20Gb 4th gen and a 60Gb iPod video, both were plugged into the same music library and now neither will play any music I have purchased through iTunes - all other music is fine. I hav

  • Clearing a bound JList after a refresh

    Hey guys, I'm fairly new to NetBeans and data binding in general so I'm having a bit of a hard time here. I'm working on a fairly basic database application (not modified too much from the template) and I've got a JList bound to the selected table va