Jsp Login Form

Hi All,
I am new to JSP. Please send me a JSP Login Form Validatio with DB.
Regards,
Gokul.

Validation.jsp whats the error in that
<%@ page language="java" import="java.sql.*,java.io.*,java.lang.*,java.util.*,com.login.users.*" %>
<jsp:useBean id="user" class="com.login.users.Users" />
<%@ page contentType="text/html;charset=windows-1252"%>
<html>
<head>
<% Connection cc = user.connect();
String username = request.getParameter("j_username");
String password = request.getParameter("j_password");
ResultSet rs = user.validateUser(cc);
%>
</head>
<body>
<%
while(rs.next()){
String u1 = rs.getString("name");
String p1 = rs.getString("Password");
if (u1.equals(username) && (p1.equals(password))){
break;
%>
<jsp:forward page="err.html" />
<%}
out.println("You Are a Valid User");
user.disconnect();
%>
</body>
</html>
my mail id is [email protected]

Similar Messages

  • Jsp login form code

    hi all
    i am a student and new to jsp
    imy problem is that i want to create a login form and have a page that validates the username and password ... i have tried this but i am gettin errors with my sql line . can any1 help me out
    i have pasted the sql line below
    ResultSet rs = stmt.executeQuery("SELECT username,password FROM myusers WHERE username='"+request.getParameter("username_signin") + "' AND password=PASSWORD('"+request.getParameter("password_signin")+"')");
    thanks

    hi i also have similar problem to avoid the ' or1=1 that simple hacking code.
    i try to use ur method but i nt too sure abt the prepare statement , pls help thanks.
    <%@page contentType="text/html"%>
    <%@page import="java.sql.*"%>
    <html>
    <head>
    <title>Check Login</title>
    </head>
    <body>
    <%
    //String varName=request.getParameter("userName");
    //String varPass=request.getParameter("userPass");
    String DRIVER = "sun.jdbc.odbc.JdbcOdbcDriver";
    Connection con = null;
    String nextPage = null;
    try {
         // set up the DSNless connection to the EJewel.mdb database
         String source = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)}; DBQ=C:\\Program Files\\Apache Software Foundation\\Tomcat 5.5\\webapps\\ROOT\\assess20\\assess.mdb";
         // Open a Database connection with the Driver
         Class.forName(DRIVER);
         con = DriverManager.getConnection(source);
    // Create sql string to check whether userName is found in database
         //String sql = "Select * from Customers where userName='" + varName + "' and userPass='" + varPass + "'";
         PreparedStatement stmt = con.prepareStatement("SELECT * from Customers WHERE username= 1 AND password='2");
    stmt.setString(1, request.getParameter("userName"));
    stmt.setString(2, request.getParameter("userPass"));
         // Create statement to connect to Connection
         Statement stmt=con.createStatement();
         // Execute result set on sql string
         ResultSet rs=stmt.executeQuery(PreparedStatement);
         String userPass = "foobar";
    MessageDigest mdAlgorithm = MessageDigest.getInstance("MD5");
    mdAlgorithm.update(userPass.getBytes());
    byte[] digest = mdAlgorithm.digest();
    StringBuffer hexString = new StringBuffer();
    for (int i = 0; i < digest.length; i++) {
    userPass = Integer.toHexString(0xFF & digest);
    if (userPass.length() < 2) {
    userPass = "0" + userPass;
    hexString.append(userPass);
    // We now have a unique MD5 Hash of original input
    out.print(hexString.toString());
              if (rs.next())
              out.print("Exist");
              session.setAttribute("loginStatus", "login");
              session.setAttribute("userName", varName);
    session.setAttribute("userPass", varPass);
    nextPage="ShowMain.jsp";     
              else
              //out.print("Does not exist");
              nextPage="Showlogin.htm";
         // close the resultset and statement     
    rs.close();
    rs = null;
    stmt.close();
    stmt = null;
         } // end try
         // catch for 3 exceptions
         catch (ClassNotFoundException cnfe) {
    out.println ("Could not create driver " + cnfe.getMessage ()) ;
         catch (SQLException sqle) {
    out.println ("Could not connect to database " + sqle.getMessage ()) ;
         catch (Exception excpt) {
    out.println ("Could not connect to database, general error " + excpt.getMessage ()) ;
    } // end all catch
         // finally to close connection
    finally {
    if (con != null) {
    con.close();
    } // end finally
    %>
    <jsp:forward page="<%=nextPage%>"/>
    </body>
    </html>

  • Help with Login Form (JSP DB Java Beans Session Tracking)

    Hi, I need some help with my login form.
    The design of my authetication system is as follows.
    1. Login.jsp sends login details to validation.jsp.
    2. Validation.jsp queries a DB against the parameters received.
    3. If the query result is good, I retrieve some information (login id, name, etc.) from the DB and store it into a Java Bean.
    4. The bean itself is referenced with the current session.
    5. Once all that's done, validation.jsp forwards to main.jsp.
    6. As a means to maintain state, I prefer to use url encoding instead of cookies for obvious reasons.I need some help from step 3 onwards please! Some code snippets will do as well!
    If you think this approach is not a good practice, pls let me know and advice on better practices!
    Thanks a lot!

    Alright,here is an example for you.
    Assume a case where you don't want to give access to any JSP View/HTML Page/Servlet/Backing Bean unless user logging system and let assume you are creating a View Object with the name.
    checkout an example (Assuming the filter is being applied to a pattern * which means when a resource is been accessed by webapplication using APP_URL the filter would be called)
    public doFilter(ServletRequest req,ServletResponse res,FilterChain chain){
         if(req instanceof HttpServletRequest){
                HttpServletRequest request = (HttpServletRequest) req;
                HttpSession session = request.getSession();
                String username = request.getParameter("username");
                String password = request.getParameter("password");
                String method = request.getMethod();
                String auth_type  = request.getAuthType();
                if(session.getAttribute("useInfoBean") != null)
                    request.getRequestDispatcher("/dashBoard").forward(req,res);
                else{
                        if(username != null && password != null && method.equaIsgnoreCase("POST") && (auth_type.equalsIgnoreCase("FORM_AUTH") ||  auth_type.equalsIgnoreCase("CLIENT_CERT_AUTH")) )
                             chain.doFilter(req,res);
                        else 
                          request.getRequestDispatcher("/Login.jsp").forward(req,res);
    }If carefully look at the code the autherization is given only if either user is already logged in or making an attempt to login in secured way.
    to know more insights about where these can used and how these can be used and how ?? the below links might help you.
    http://javaboutique.internet.com/tutorials/Servlet_Filters/
    http://e-docs.bea.com/wls/docs92/dvspisec/servlet.html
    http://livedocs.adobe.com/jrun/4/Programmers_Guide/filters3.htm
    http://www.javaworld.com/javaworld/jw-06-2001/jw-0622-filters.html
    http://www.servlets.com/soapbox/filters.html
    http://www.onjava.com/pub/a/onjava/2001/05/10/servlet_filters.html
    and coming back to DAO Pattern hope the below link might help you.
    http://java.sun.com/blueprints/corej2eepatterns/Patterns/DataAccessObject.html
    http://java.sun.com/blueprints/patterns/DAO.html
    http://www.javapractices.com/Topic66.cjp
    http://www.ibm.com/developerworks/java/library/j-dao/
    http://www.javaworld.com/javaworld/jw-03-2002/jw-0301-dao.html
    On the whole(:D) it is always a good practice to get back to Core Java/J2EE Patterns.and know answers to the question Why are they used & How do i implement them and where do i use it ??
    http://www.fluffycat.com/java-design-patterns/
    http://java.sun.com/blueprints/corej2eepatterns/Patterns/index.html
    http://www.cmcrossroads.com/bradapp/javapats.html
    Hope that might help :)
    REGARDS,
    RaHuL

  • Login form using Access... (in JSP )

    I have written the following code in JSP and connected to Access Database.
    Aftre i run the JSP from browser the Login form is displayed. but aftre i enter the "userid" and "password" nothing hapens. the application is STUCK !!
    <HTML>
    <HEAD>
    <TITLE> Login </TITLE>
    <script language="Javascript">
    function giveFocus()
         document.login.user.focus()
    function submitForm()
         document.login.submit()
    function resetForm()
         document.login.reset()
         document.passwd.reset()
         document.login.user.focus()
    </script>
    </HEAD>
    <BODY onload="giveFocus()">
    <form name="login" method="post" action="http://localhost//dcs/forward.jsp">
    <table border="0" cellpadding="2" cellspacing="0" width="80%"> <tr><td bgcolor="#ffffff" align="center">
    <table border="0" cellspacing="6" cellpadding="6" bgcolor="ffffff" width="80%" height="280">
    <tr bgcolor="#ADADAD">
    <td align="center"><font face="Verdana" SIZE="5">LOGIN FOR DDM</font><br>
    <table border=0 cellpadding=4 cellspacing=0>
    <tr> <td align="right">
    <P ALIGN="LEFT"><font face="Verdana" size="3"><BR>Please enter your ID and password
    <table border=0 cellpadding=10 cellspacing=10>
    <tr>
         <td align="right" ><font face="Verdana" size="4">User Id   :</font></td>
         <td><font face="arial" size="-1"><b></b></font><input name="user" type="text" length="9" maxlength="9"></td>
    </tr>
    <tr>
         <td align="right" ><font face="Verdana" size="4">Password  :</font></td>
         <td><input name="passwd" type="password" length="8" maxlength="8"></td>
    </tr>
    <tr>
         <td align=center valign=bottom>
         <input type="submit" name="login" value="     LOGIN     "  ></td>
    <td align=center valign=bottom><input type="button" name="cancel" value="   Cancel    " ></td>
    <td align=center valign=bottom><input type="submit"  name="chgp" value="Change Password"></td>
    </tr>
    </table>
    </table>
    </table>
    </table>
    </form>
    </body>
    </html> Kindly tell me wht is the problem with my code ? ?

    http://forum.java.sun.com/thread.jspa?threadID=599315&tstart=0
    Cross-post

  • Login form using Access(JSP)....

    I have written the following code in JSP and connected to Access Database.
    Aftre i run the JSP from browser the Login form is displayed. but aftre i enter the "userid" and "password" nothing hapens. the application is STUCK !!
    <HTML>
    <HEAD>
    <TITLE> Login </TITLE>
    <script language="Javascript">
    function giveFocus()
         document.login.user.focus()
    function submitForm()
         document.login.submit()
    function resetForm()
         document.login.reset()
         document.passwd.reset()
         document.login.user.focus()
    </script>
    </HEAD>
    <BODY onload="giveFocus()">
    <form name="login" method="post" action="http://localhost//dcs/forward.jsp">
    <table border="0" cellpadding="2" cellspacing="0" width="80%"> <tr><td bgcolor="#ffffff" align="center">
    <table border="0" cellspacing="6" cellpadding="6" bgcolor="ffffff" width="80%" height="280">
    <tr bgcolor="#ADADAD">
    <td align="center"><font face="Verdana" SIZE="5">LOGIN FOR DDM</font><br>
    <table border=0 cellpadding=4 cellspacing=0>
    <tr> <td align="right">
    <P ALIGN="LEFT"><font face="Verdana" size="3"><BR>Please enter your ID and password
    <table border=0 cellpadding=10 cellspacing=10>
    <tr>
         <td align="right" ><font face="Verdana" size="4">User Id   :</font></td>
         <td><font face="arial" size="-1"><b></b></font><input name="user" type="text" length="9" maxlength="9"></td>
    </tr>
    <tr>
         <td align="right" ><font face="Verdana" size="4">Password  :</font></td>
         <td><input name="passwd" type="password" length="8" maxlength="8"></td>
    </tr>
    <tr>
         <td align=center valign=bottom>
         <input type="submit" name="login" value="     LOGIN     "  ></td>
    <td align=center valign=bottom><input type="button" name="cancel" value="   Cancel    " ></td>
    <td align=center valign=bottom><input type="submit"  name="chgp" value="Change Password"></td>
    </tr>
    </table>
    </table>
    </table>
    </table>
    </form>
    </body>
    </html> Kindly tell me wht is the problem with the code ? ? ?

    the code for doing the connection between JSP and Access is as follows :
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection conn = DriverManager.getConnection("jdbc:odbc:rupa","system","manager");rupa is DSN which i created for MS ACCESS
    is this ok?

  • Lesser Looking Login Form (JSF vs. JSP)

    Hi,
    We have a non-trivial (but not uncommon) layout for our application, including: icons, tabbed menu, menu bar, left-hand navigation submenu, page content, footer links, and footer copyright.
    The application uses JAZN for authentication, which means we cannot use these items: resource bundles, JSF Core components, and ADF Faces components.
    If we were to try and create a login page that has the same look and feel as the rest of the application (using only HTML), it would be a maintenance burden.
    Is there any way we can leverage the JSF Core and ADF Faces components for the login page within a system that uses JAZN? (All searches for login pages and JAZN revealed painfully plain HTML pages.)
    One idea would be to disable authentication for a specific "EmbedLogin" page. The EmbedLogin page would include an IFRAME (or otherwise INLINE) the login page. This will not work.
    Any other ideas?

    Hi,
    in JDeveloper 11 / OracleAs 11 there will be a new API that allows you to perform programmatic authentication through JAAS - which then allows you to use a JSF page as a login form.
    For now, beside of using Shay's suggestion, you can e.g. follow the trick that the Webcenter documentation exposes.
    See "10.4.1 Creating an Oracle ADF Faces-Based Login Page"
    http://download.oracle.com/docs/cd/B32110_01/webcenter.1013/b31074/jpsdg_security.htm#CHDJAGDG
    It's a hack, but it works
    Frank

  • How to refresh the Expired Login Form on the onChange event of the password

    Hi,
    In the Expired Login Form I have places a custom label. My requirement is that on the onchange event of the password field the label color should change to orange if the entered password meets the password policy else red.
    I am trying the following code :
    Custom label:
    <Field name='Custom Label'>
    <Display class='Label'>
    <Property name='value' value='Custom label 1'/>
    <Property name='noNewRow'>
    <Boolean>true</Boolean>
    </Property>
    <Property name='color'>
    <block>
    <cond>
    <isTrue>
    <invoke name='checkStringQualityPolicy' class='com.waveset.ui.FormUtil'>
    <rule name='EndUserRuleLibrary:getCallerSession'/>
    <s>Default Password Policy</s>
    <invoke name='decryptToString'>
    <ref>resourceAccounts.password</ref>
    </invoke>
    <map/>
    <list/>
    <s>Configurator</s>
    </invoke>
    </isTrue>
    <s>orange</s>
    <s>red</s>
    </cond>
    </block>
    </Property>
    </Display>
    </Field>
    And on the password field i gave following in the onChange event:
    submitCommand(this.form, "Recalculate")
    But the above command is not refreshing the page. Instead on the onChange event its going back to the login.jsp.
    Any idea how to resolve the above issue.
    Thanks.

    I got it working as below but i dont know is this best practices?
    <%
        if(session.getAttribute("afterSet") != null){
             %>
        <div style="visibility:hidden">
          <iframe NAME="iframe1" src="/WebApplication2/TestController?fileDownload=test.pdf" WIDTH="40" HEIGHT="40"></iframe>
        </div>
        <%}       basically first time user visit the jsp page session attribute "afterSet" will be null so it wont create the hidden iframe tag . after it dispatched to the servlet controller and successfully processing the record it will set "afterSet" properties to some value and dispatch to itself
    after that it will popup/dialog box for user to save the pdf.
    this way the page already refreshes itself and wont have problem double clicking thing and so on

  • J_security_check & login form

    I have a problem that just started. When goto a page (/faces/home.jspx) it brings up the login form as usual. I login and it sends me to a 404 page not found error. I click back, and then it'll bring me to the home page. Not sure why this is bringing up the 404 page.
    If i change from form based to http basic, then it prompts me for my password and brings up the home page. Any ideas why the 404 is coming up?

    For the benefit of others here is the JSP/JSTL & javascript solution.
    This allowed me to create an automated login and use declarative security ...
    The following code requires param.UserID and param.PassWord to be set before it is executed...
    <form name="AutoLogin" method="POST" action="j_security_check" >     
    <input type="hidden" name="j_username" value="<%= request.getParameter("UserID") %>" size="8" maxlength="8" />
    <input type="hidden" name="j_password" value="<%= request.getParameter("PassWord") %>" size="8" maxlength="8" />
    </form>
    <script type="text/javascript" language="JavaScript">
    document.AutoLogin.submit();
    </script>

  • Oracle ADF 11g – Authentication using Custom ADF Login Form Problem

    Hi Guys,
    I am trying to Authenticate my adf application using custom Login Form.
    following this..
    http://www.fireboxtraining.com/blog/2012/02/09/oracle-adf-11g-authentication-using-custom-adf-login-form/#respond
    But my Login Page is not Loading.I think its sending request in chain.my jdev version is 11.1.1.5.Any Idea.
    Thanks,
    Raul

    Hi Frank,
    I deleted bounded code and In another Unit Test I created a simple login.jspx page and applied form based authentication but still facing same problem means something wrong in starting.
    My login.jspx page is
    <?xml version='1.0' encoding='UTF-8'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
              xmlns:f="http://java.sun.com/jsf/core"
              xmlns:h="http://java.sun.com/jsf/html"
              xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
      <jsp:directive.page contentType="text/html;charset=UTF-8"/>
      <f:view>
        <af:document id="d1" >
          <af:form id="f1" >
            <af:panelFormLayout id="pfl1">       
              <af:inputText label="USERNAME" id="it1"
                            />       
              <af:inputText label="PASSWORD" id="it2"
                              />
              <af:commandButton text="LOG IN" id="cb1" />
              <f:facet name="footer">       
              </f:facet>                 
            </af:panelFormLayout>
          </af:form>
        </af:document>
      </f:view>
    </jsp:root>
    Don't know wht real problem is

  • JSP Login

    Hi ....
    I am working on JSP for oracle applications. In the login page, when the username and password is entered and 'Submit' button is pressed, the page is validated.
    However after typing username and password and 'Enter" button in keyboard is hit, no action takes place. How can I modify to have page processed for 'Enter" key.
    This is urgent.

    Hi ,
    I have attched the code. Also the link for the page is:
    http://angelic.itconvergence.net:8001/OA_HTML/ibeCAcdLogin.jsp?a=b
    This page is developed by Oracle and I am working on customizations.
    Thannks for your help in advance.
    <%@ include file="jtfincl.jsp" %>
    <!-- $Header: ibeCAcdLogin.jsp 115.31.11590.4 2003/06/10 21:46:16 sfung ship $ -->
    <!-- $Header: ibeCAcdLogin.jsp 115.31.11590.4 2003/06/10 21:46:16 sfung ship $ -->
    <%--=========================================================================
    |      Copyright (c)2000 Oracle Corporation, Redwood Shores, CA
    |                         All rights reserved.
    +===========================================================================
    |
    | FILE
    |   ibeCAcdLogin.jsp - User Login Page
    |
    | DESCRIPTION
    |   Sign On Page
    |
    | HISTORY
    |   11/11/2002  madesai IBE.O UI changes
    |   12/13/2002  madesai error msg appears after the title, prompts added with colon
    |   12/27/2002  adwu    Removed Javascript event for 2726995
    +=======================================================================--%>
    <%
    final String J = "ibeCAcdLogin.jsp";
    pageContext.setAttribute("_signInPage", "true", PageContext.REQUEST_SCOPE);  %>
    <%@ include file="ibeCZzpHeader.jsp" %>
    <%
    String username = IBEUtil.nonNull(request.getParameter("username"));
    if (username.equals("") && RequestCtx.userIsLoggedIn())
      username = RequestCtx.getUserName();
    //madesai - added errorMessage pageContext for IBE.O
    //Share Cart feature
    String errorMessage = null;
    errorMessage = IBEUtil.nonNull((String)pageContext.getAttribute("errorMessage",PageContext.REQUEST_SCOPE));
    if (errorMessage.equals(null)|| (errorMessage.equals("")))
    if (pageContext.getAttribute("invalid", pc) != null) {
      IBEUtil.log("ibeCAcdLogin.jsp", "Login fails");
      errorMessage = mm.getMessage("IBE_PRMT_INVALID_PASSWORD_G");
    String ref = IBEUtil.nonNull(request.getParameter("ref"));
    pageContext.setAttribute("_pageTitle", mm.getMessage("IBE_PRMT_SIGN_IN_G"), pc);
    pageContext.setAttribute("selectedTab", "signin", pc);
                                                                                 %>
    <%@ include file="ibeCZzdTop.jsp" %>
    <%@ include file="ibeCZzdMenu.jsp" %>
    <SCRIPT LANGUAGE="JavaScript" SRC="ibeCButton.js"></script>
    <TABLE  border="0" cellspacing="0" cellpadding="0" width="100%">
    <TR>
    <TD valign="top" width="15%"><BR clear="all">
    </TD>
    <TD valign="top" width="70%">
    <table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
      <tr>
      <td class=pageTitle ><%= mm.getMessage("IBE_PRMT_SIGN_IN_G") %></td>
      </tr>
       <tr>
      <td class=OraBGAccentDark><img src="/OA_MEDIA/jtfutrpx.gif" height="1" width="1"></td>
      </tr>
      </table>
      <table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
      <tr>
    <% if (errorMessage != null) { %>
          <span class="errorMessage" colspan="2"><%= errorMessage %></span>
          <% } %>
        </tr>
    </table>
    <BR>
    <table width="100%" border="0" cellspacing="0" cellpadding="2">
    <FORM name = "mainForm" method="post" action="<%= DisplayManager.getTemplate("STORE_CUST_ACC_LOGIN_AUTH").getFileName() %>">
    <input type ="hidden" name="event" value="">
      <tr>
      <td colspan="2">
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
        <td class="sectionHeader1"><%= mm.getMessage("IBE_PRMT_RET_USER_G") %>
        </td>
        </tr>
        <tr>
        <td class=OraBGAccentDark><img src="/OA_MEDIA/jtfutrpx.gif" height="1" width="1"></td>
        </tr>
      </table>
      </td>
      </tr>
      <tr>
      <td nowrap  ><img src=../OA_MEDIA/jtfutrpx.gif height="5" width="1"></td>
      <td nowrap class="sectionHeaderBlack"><img src="/OA_MEDIA/jtfutrpx.gif" height="5" width="1"></td>
      </tr>
      <tr>
      <td nowrap class="requiredFieldPrompt" align="right" width="30%"><%= mm.getMessage("IBE_PRMT_USERNAME_COL") %></td>
      <td nowrap width="70%">
        <input type="text" name="username" size="20" VALUE="<%=username%>">
      </td>
      </tr>
      <tr>
      <td nowrap class="requiredFieldPrompt" align="right"><%= mm.getMessage("IBE_PRMT_PWD_COL") %></td>
      <td nowrap >
      <input type="password" name="password" size="20">
      </td>
      </tr>
      <%
        out.println(RequestCtx.getSessionInfoAsHiddenParam());
        if (! "".equals(ref))
           out.println("<INPUT TYPE=HIDDEN NAME=ref VALUE=\"" + ref + "\">");
        %>
      <tr>
      <td align="right"> </td>
      <td nowrap >
                  <script language="JavaScript">
                  buttonGen("<%=mm.getMessage("IBE","IBE_PRMT_SIGN_IN_G" )%>", "javascript:submitForm('', 'mainForm')");
          </script>
          </td>
      </tr>
    </FORM>
    <tr><td></td><td class=footnote>
      <%
       if (request.getParameter("reauth") != null)
         out.println(mm.getMessage("IBE_PRMT_REAUTH"));
       else {
        try
          String custMsgKey = "IBE_PRMT_LOGIN_CSTM_MSG1";
          String custMsg    = DisplayManager.getTextMedia(custMsgKey);
          out.println(custMsg);
        }//end try
        catch (MediaException e)
         //do nothing
        }//end else
      %>
      </td></tr>
       <%
        boolean isMaintenanceMode = IBEUtil.isMaintenanceMode();
        if (! isMaintenanceMode) {
          String htmlPage = RequestCtx.getURL(
            DisplayManager.getTemplate("STORE_CUST_ACC_PWD_RESET").getFileName());
      %>
      <tr>
      <td   align="right">  </td>
      <td class="promptSmall"> <a href="<%= htmlPage %>"><%= mm.getMessage("IBE_PWD_FORGET") %>
            </a> </td>
      </tr>
      <%
      %>
              <!--<tr>
                <td align="right" nowrap class="sectionHeader1"> New user, please
                  register</td>
                <td >
                  <hr>
                </td>
              </tr>-->
      <!-- registration links start ------------------------------------------------>
       <%
        if (! isMaintenanceMode) {
       %>
      <tr>
      <td colspan="2">
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
        <td class="sectionHeader1"><%= mm.getMessage("IBE_PRMT_NEW_USER_G") %></td>
        </tr>
        <tr>
        <td class=OraBGAccentDark><img src=../OA_MEDIA/jtfutrpx.gif height="1" width="1"></td>
        </tr>
      </table>  </td>
      </tr>
      <%
      if (IBEUtil.useFeature("IBE_USE_B2B_FEATURES")) {
        String url = null;
        if ("".equals(ref))
          url = DisplayManager.getURL("STORE_CUST_BUSINESS_REGISTRATION");
        else
          url = DisplayManager.getURL("STORE_CUST_BUSINESS_REGISTRATION",
                                    "ref=" +
                                    oracle.apps.jtf.util.Utils.encode(ref));
      %>
      <tr>
      <td nowrap > </td>
      <td nowrap class="sectionHeaderBlack"><a href="<%=url%>"><b><%= mm.getMessage("IBE_PRMT_BIZ_ORG") %></a></td>
      </tr>
      <tr>
      <td nowrap > </td>
      <td nowrap class="prompt"><%= mm.getMessage("IBE_PRMT_BIZ_REG_MSG") %></td>
      </tr>
      <tr>
      <td nowrap  ><img src=../OA_MEDIA/jtfutrpx.gif height="5" width="1"></td>
      <td nowrap class="sectionHeaderBlack"><img src="/OA_MEDIA/jtfutrpx.gif" height="5" width="1"></td>
      </tr>
      <%
      if (IBEUtil.useFeature("IBE_USE_B2C_FEATURES")) {
        String url = null;
        if ("".equals(ref))
          url = DisplayManager.getURL("STORE_CUST_SIGNIN");
        else
          url = DisplayManager.getURL("STORE_CUST_SIGNIN",
                                    "ref=" +
                                    oracle.apps.jtf.util.Utils.encode(ref));
      %>
      <tr>
      <td nowrap  > </td>
      <td nowrap class="sectionHeaderBlack"><a href="<%=url%>"><b><%= mm.getMessage("IBE_PRMT_IND_CON") %>
                  </a></td>
      </tr>
      <tr>
      <td nowrap class="prompt" > </td>
      <td nowrap class="prompt"><%= mm.getMessage("IBE_PRMT_IND_REG_MSG") %></td>
      </tr>
    <%
      } // isMaintenanceMode
      %>
    </table>
    <table align="center" cellspacing=0 cellpadding=0 width="100%" border=0>
      <tr>
      <td><img height=14 src="../OA_MEDIA/jtfutrpx.gif" width=1></td>
      <td rowspan=2><img height=15 src="/OA_MEDIA/jtfuski.gif" width=12
          align=bottom></td>
      </tr>
      <tr>
      <td class=OraBGAccentDark width="100%"><img height=1
          src="/OA_MEDIA/jtfutrpx.gif" width=1></td>
      </tr>
      </table>
        </TD>
        <TD valign="top" width="15%"> <BR>
        </TD>
    </TR>
    </TABLE>
    <!-- registration links end -------------------------------------------------->
    <%@include file="ibeCZzdBottom.jsp" %>

  • Servlet Jsp Login Problen

    Consider 4 pages
    default.jsp          -          Default page     -     Provides link to update.jsp
    Update.jsp          -          Update Page          -     User came through default page
    login.jsp          -          Displays html      -     Two Input tags user & pass
    check Servlet     -          Authentication     -     Validates userid & pwd from database
    what I want to do ?
    1     User clicks on update link on default page
    2     update checks for session as
              String user = (String) session.getAttribute("user");
              if( user == null )                    
                   response.sendRedirect("/login.jsp");
    3     Now login.jsp displays the HTML form with action = /servlet/check          
    4     check servlet revceives values user & pass from HTML response & validates through
         database
    5     Now if validation succedes it must redirect to the actual page that user had
         requested for ultimately i.e update.jsp
    6 HOW MANY WAYS I CAN DO THIS
    7      Problem becomes more serious when along with login & check other intermediate
         servlets are also there.
    8     The final problem is
         1     Update.jsp receives request data from some HTML form but checks for user
              from session object.
         2     If found null redirect to login page
         3     The above prob. now repeats but the point is after authentication
              the check servlet not only redirects to the actual requested page but
              also supplies the data that update.jsp has received
    Please reply soon

    Thanx Sir!
    But i want to have a more generic solution
    like using <jsp:fordward> & <jsp:param> etc
    but i want it so generic that it can be done in ASP/ JSP
    preferably without using queryString
    And the main point is this problen
    request.setAttribute() is not working
    I am uploading the code
    CODE:
    default.jsp     Update
    update.jsp     String user = (String) session.getAttribute("user");
              if( user == null )     {
                   String look_for = request.getRequestURI();
                   request.setAttribute("look_for",look_for);
                   response.sendRedirect("/login.jsp");
    login.jsp     String req = null;
              req = (String)request.getAttribute("req");
              //out.print(req); --> Error Printing null
              request.setAttribute("req", req);
              <form----
              >
              response.sendRidirect("/servlet/check");
    check     
         String user = null;
    String look_for = (String)request.getAttribute("req");
    if(look_for == null)     {
              request.setAttribute("req", look_for);
         response.sendRedirect(request.getHeader("HTTP_REFERER"));
    if(user != "Hemant") {
    request.setAttribute("req",look_for);
    response.sendRedirect("/login.jsp");
    HttpSession session = request.getSession();
    session.setAttribute("user","Hemant");
    response.sendRedirect(look_for);
    out.close();     

  • To create login form using swing with sqlserver as backend

    hi.
    can anybody send me code to create login form using swings .
    thnaks in advance..
    sj

    You do realise that you can't create Swing on a JSP page?
    You have to use HTML.
    If you want to use Swing, the java must be running at the client end, which means you need an Applet, and a completely different forum.

  • Jsp login forum help

    Hi everyone, i have the bean class User.java below and i want to create the basic authentication login , when the user login successful the welcome page will be display depend on the type of user. For example, if the user type is teacher so he/she can create the new student username and password. Could anyone help me to do that. Please explain more detail since i am a newbie for jsp.
    Thank you.
    public class User {
    public User() { }
    public String getUserName() { return name;}
    public String getPassword() {return password;}
    public String userType () {return type;}
    public void setUserName(String name ) { this.name = name;}
    public void setPassword (String password) {this.password = password;}
    public void setType (String type) {this.type = type;}
    private String name;
    private String password;
    private String type;
    }

    The thing is i haven't using database before and i didn't have any database in the server, assume that i using hashtable to store the users detail. Could you please give me the example code.
    Here is my login.jsp
    <p>
    <form name="loginForm" method="post" action="process.jsp">
    <p align="center"><strong><font size="4">LOGIN</font></strong> </p>
    <table width="24%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
    <tr>
    <td bgcolor="#FFFFCC"><div align="right">User name</div></td>
    <td bgcolor="#FFFFCC"><div align="center">
    <input name="username" type="text" id="username">
    </div></td>
    </tr>
    <tr>
    <td bgcolor="#FFFFCC">
    <div align="right">Password</div></td>
    <td bgcolor="#FFFFCC"> <div align="center">
    <input name="password" type="password" id="password">
    </div></td>
    </tr>
    <tr>
    <td bgcolor="#FFFFCC">
    <div align="right">
    <input name="usertype" type="checkbox" id="usertype" value="checkbox">
    Staff </div></td>
    <td bgcolor="#FFFFCC">
    <div align="center">
    <input type="submit" name="login" value="Login">
    <input type="reset" name="clear" value="Clear">
    </div></td>
    </tr>
    </table>
    <p align="center">Staff's ID: teacher<br>
    Staff's password: pass<br>
    You must check the staff checkbox to login as clerk.</p>
    </form>
    </p>
    So what i need is when the user input staff id, password and the check box, the page will check the correct authentication and the process to the new page, for example the teacher page that have another form to create the student authentication. When the student user created the student can login using the same form as the teacher's login form but this time will forward to the student's page. Also how can i use session to keep track of the user logged in, for example when the student logged successful, he/she can view her mark or do some task and can logout (which is clear the session).
    Thank you so much.

  • Where can i find the user login form

    Hi everyone
    Do you know the name of the end user login form? I want to add a button on it but i don't know where i can find it.
    Somebody has an idea?

    Thanks everyone
    I found the solution in the login.jsp (idm/user/login.jsp). I will just add a link which will execute a workflow.
    I needed to have the number of failed login attemps. So I uses this code in the login JSP
    com.waveset.server.Server _server = com.waveset.server.Server.getServer();
        com.waveset.repository.Repository _repo = _server.getRepository();
        com.waveset.object.WSUser uo = (com.waveset.object.WSUser)_repo.getIfExists(com.waveset.object.Type.USER, "test");
        int nb = 0;
        if (uo != null ) {
            com.waveset.object.ObjectCache _serverCache = _server.getCache();
            uo.setCache(_serverCache);
            nb = uo.getFailedPasswordLoginAttemptsCount();
            %>
                The user is not null <BR>
                nb == <%=nb %>
            <%
        else{
            %>the user is null <BR><%
        }good luck.

  • NEWBIE - creating a simple JSP login page

    Hi guys,
    I am really really stuck, and I would be so grateful if you guys could help me in any way. I am creating a simple application, but as part of the application i have to create a login / logout sub-application. It needs to verify the username and password by looking up a database in mySQL. I've had a look around on the internet to see if there is any simple way of doing it, but i can't understand most of it. I'm really new to JSP and only know how to do simple statement like <c:choose> and stuff like that. If anyone can help me in any way to create as simple a login / logout application that verifies the username and password from a database, I would be ever so grateful, thank you!
    Just to let you know, the security-roles and all that stuff together with the <tomcat-users> stuff has already been set up.
    I found this code by the author brain.compression, which seems to very useful, I've not tried it out yet, but was wondering, if somebody could help me split the code up into the separate JSP pages i will need, as I am not too sure which bits of the code need to go on what pages.
    Thank you to anyone that can help me out and thanks for brain.compression for providing this code. I'm sorry for posting this in a forum not related to JSP, its just that I am a complete newbie to JSP and nobody in that forum is helping me.
    brain.compression's code starts here...
    First for the page you are requesting you would need a verify if the user is logged in or not:
    <c:if test="${existingUser==null}">
    <jsp:forward page="login.jsp">
    <jsp:param name="origURL" value="${pageContext.request.requestURL}"/>
    <jsp:param name="errorMsg" value="Please log in first" />
    </jsp:forward>
    </c:if>
    This will redirect you to the login page:
    <font color="red">
    ${fn:escapeXml(param.errorMsg)}
    </p>
    </font>
    <form method="post" action="authenticate.jsp">
    <table>
    <tr>
    <td>Please Enter the following information to log in:</td>
    </tr>
    </table>
    <table>
    <tr>
    <td>User ID:</td>
    <td><input name="userid" value="${fn:escapeXml(cookie.userid.value)}"></td>
    </tr>
    <tr>
    <td>Password:</td>
    <td><input type="password" name="password" value="${fn:escapeXml(cookie.password.value)}"></td>
    </tr>
    </table>
    After that you have to verify with your DB if the login info provided is correct:
    %-- Removing any scoped variables --%>
    <c:remove var="existingUser" />
    <c:if test ="${empty param.userid || empty param.password}" >
    <c:redirect url="login.jsp">
    <c:param name="errorMsg" value="Please enter a User Id and Password." />
    </c:redirect>
    </c:if>
    <%-- Checking if User Id and Password are valid --%>
    <sql:query var="anyvariable" dataSource="${data}">
    SELECT * FROM table WHERE user_id = ? AND pass = ?
    <sql:param value="${param.userid}"/>
    <sql:param value="${param.password}"/>
    </sql:query>
    <c:if test="${anyvariable.rowCount == 0}">
    <c:redirect url="login.jsp">
    <c:param name="errorMsg" value="Invalid User Id or Password"/>
    </c:redirect>
    </c:if>
    Also can somebody tell me if i am right. Do I need to create a page called login.jsp to put the actual form on, and a page called authenticate.jsp to verify the username and password are correct? Finally i see that brain.compression has used a variable called existingUser but has he actually declared it anywhere. Thanks again for anybody that can help me out!

    i am still a jsp noobie but i have done some applications using html javascript php asp and other languages. What you want to do is take the data from the login form then compare that to the db see if it actually exist and has the correct info. From there you want to write a cookie to the users computer to hold the username and password, which will be checked for at the begining of every page verifying it in the database. This is how i have done password verification in the past and it works fairly well and unless your server gets hacked your pages should be secure.

Maybe you are looking for