Forum Stats

  • 3,814,617 Users
  • 2,258,892 Discussions
  • 7,892,783 Comments

Discussions

Dev-kit demo problem (WebCommand)

3004
3004 Member Posts: 204,171 Green Ribbon
The demos that come with the development kit are quite helpful. I got the insurance demo up and running without problems but the WebCommand demo is bugged. The problem lies in the login.jsp that will never allow you to log in. By comparing it to the insurance demo I got it working by fixing several problems in it. Has anyone got the original version working?

Comments

  • 3004
    3004 Member Posts: 204,171 Green Ribbon
    There are some known bugs in the devkit release on OTN. We will be providing a patch that will fix the problems. Can you please post the changes you made to solve the problems you were having?
  • 3004
    3004 Member Posts: 204,171 Green Ribbon
    A working version of the file $ORACLE_HOME/ifs/ifsdevkit/sampleapps/webcommand/jsp/login.jsp can be found at:
    http://www.teymi.is/~heimir/javastuff/login.jsp

    You'll have to save-link-as file so my webserver does not try to run the .jsp

    Enjoy
  • 3004
    3004 Member Posts: 204,171 Green Ribbon
    I too am at the same point!
    Can you please paste the login.jsp here directly? I cannot get your url, it seems to always try to run it, even with save-as...
    TIA
    -Andy
  • 3004
    3004 Member Posts: 204,171 Green Ribbon
    Allow me to explain how to fix the problem. First, in the login.jsp, change the String "Local" to "IfsDefault" (or any other service properties file in the $ORACLE_HOME/ifs/settings/oracle/ifs/server/properties directory). This would be in the third argument to the bean method that logs in to iFS.

    If your schema password is the same as your schema name, the login should now work.

    To REALLY fix the problem, you should change the jsp to have two more input boxes (instead of just username and password). It should also include one for "service name" and one for "schema password". Sound familiar? It should -- you will now have the same four inputs in your jsp that ServerManager prompts when you start the iFS servers.

    Then, you'll have to change the jsp to use the four parameters. Add one more argument to the login method that the jsp calls. (Now, in the jsp, you will be passing all 4 input values to the bean method: username, password, servicename, schemapassword.)

    Finally, you'll need to change the bean code to accomodate these parameters. First change the login method so that it takes 4 arguments. Then, change the body of the method to use the following way to connect to iFS:

    LibraryService lsv = new LibraryService();
    CleartextCredential cred = new CleartextCredential( username, password );
    ConnectOptions opt = new ConnectOptions();
    opt.setServiceName( servicename );
    opt.setServicePassowrd( schemapassword );
    LibrarySession sess = lsv.connect( cred, opt );

    That should do it.
  • 3004
    3004 Member Posts: 204,171 Green Ribbon
    There seems to be a problem with my webserver you can download it now with this link:
    http://www.teymi.is/~heimir/javastuff/login_jsp.txt

    The full text is also below just in case. Remember the point from Luis if you want to have full flexibility in authenticating the user.

    <%@ page import = "ifsdevkit.sampleapps.webcommandapp.WebCommandLogin" %>
    <%@ page import = "oracle.ifs.adk.security.IfsHttpLogin" %>

    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <meta name="Author" content="Patricia Li">
    <title>Login</title>
    </head>

    <jsp:useBean id="wclogin" scope="session" class="ifsdevkit.sampleapps.webcommandapp.WebCommandLogin" />
    <jsp:setProperty name="wclogin" property="*"/>

    <%
    String REDIRECT_PATH = "/ifs/ifsdevkit/sampleapps/WebCommandApp/html/main.html";
    boolean loggedIn = false;
    if (wclogin.getSession() != null && wclogin.getResolver() != null)
    {
    // Use existing WebCommand login
    loggedIn = true;
    }
    else
    {
    // No existing Web login
    IfsHttpLogin login = (IfsHttpLogin) request.getSession(true).getValue("IfsHttpLogin");
    if (login != null && login.getSession() != null && login.getResolver() != null)
    {
    // Use existing IfsHttpLogin login
    wclogin.init(login.getSession(), login.getResolver());
    loggedIn = true;
    }
    }
    if(!loggedIn) {
    String username = request.getParameter("username");
    String password = request.getParameter("password");
    if (username != null && password != null)
    {
    // Login using username/password
    try
    {
    wclogin.init(username, password, "IfsDefault");
    request.getSession(true).putValue("IfsHttpLogin", wclogin);
    loggedIn = true;
    }
    catch (Exception e)
    {
    %>
    <SCRIPT LANGUAGE="JavaScript1.2">
    alert("The username or Password was not valid, please try again.");
    </SCRIPT>
    <%
    }
    }
    }

    if (loggedIn == true)
    {
    // Go to main page...
    response.sendRedirect(REDIRECT_PATH);
    }
    else
    {
    %>
    <title>Web Command App Login</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>
    <body bgcolor="#FFFFFF">
    <h2>WebCommand Application Login</h2>
    <form METHOD=POST NAME="loginform" ACTION="login.jsp">
    <table>
    <tr>
    <td><b>Username:</b></td>
    <td><input type="text" name="username" value=""></td>
    </tr>
    <tr>
    <td><b>Password:</b></td>
    <td><input type="password" name="password" value=""></td>
    </tr>
    <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    </tr>
    <tr>
    <td>
    <input type="submit" value="Log in">
    </td>
    <td>
    <input type="reset" value="Reset">
    </td>
    </tr>
    </table>
    </form>
    </body>
    </html>

    <% } %>
    null
This discussion has been closed.