An:     [EMAIL PROTECTED]
Kopie:
Blindkopie:

Absender: [EMAIL PROTECTED]




Thema:  problem with javascript and jsp


Hello to all, perhaps somebody has a useful hint ...

The JSP-File f2_logon1.jsp invokes f2_logon2.jsp. When doing this,
I need to change 4 HTML-frames simultaneously.
This is performed by the following JavaScript (which functions well):

/**
 * Xch4Frames() exchanges 4 frames simultaneously
 * @param URI1 first URI
 * @param F1 first Frame as destination of URI1
 * @param URI2 second URI
 * @param F2 second Frame as destination of URI2
 * @param URI3 third URI
 * @param F3 third Frame as destination of URI3
 * @param URI4 fourth URI
 * @param F4 fourth Frame as destination of URI4
 */
function Xch4Frames(URI1,F1,URI2,F2,URI3,F3,URI4,F4) {
     Frame1=eval("parent."+F1);
     Frame2=eval("parent."+F2);
     Frame3=eval("parent."+F3);
     Frame4=eval("parent."+F4);
     Frame1.location.href = URI1;
     Frame2.location.href = URI2;
     Frame3.location.href = URI3;
     Frame4.location.href = URI4;
}


But when changing the following code-snippet in file f2_logon1.jsp


<!-- code-snippet 1 -->

    <%
      String sUserName   = null;
      sUserName   = (String) session.getAttribute("User");
      if(sUserName == null)
      {
    %>
     <!-- next statement to be changed -->
    <form action="../d2navigator/f2_logon2.jsp" method="post" target
="fr_content">
    <table border="0" width="400" cellspacing="0" cellpadding="0">
       ...
       <tr>
         <td height="40">Username:</td>
         <td><input type="text" name="userName"></td>
       </tr>

<!-- end of code-snippet 1 -->


by


<!-- code-snippet 2 -->

    <%
      String sUserName   = null;
      sUserName   = (String) session.getAttribute("User");
      if(sUserName == null)
      {
    %>

     <!-- by this statement -->
    <form action="javascript:Xch4Frames(
     '../f1launch.htm','fr_start_stop',
     '../f2history.htm','fr_history',
     '../f3options.htm','fr_options',
     '../d2navigator/f2_logon2.jsp','fr_content');" method="post" target
="fr_content" >
    <table border="0" width="400" cellspacing="0" cellpadding="0">
       ...
       <tr>
         <td height="40">Username:</td>
         <td><input type="text" name="userName"></td>
       </tr>

<!-- end of code-snippet 2 -->


then I receive a zero-pointer exception in file f2_logon2.jsp at the
commented statement


<!-- code-snippet 3 -->

    <%@ page import="java.util.*, java.io.*" %>

    <%
      String sUserName   = null;
      ...
      sUserName   = request.getParameter("userName");
      session.setAttribute("User", sUserName);
      ...
      if(sUserName.length() > 0 && sUserPassword.length() > 0)    // shit
happens here ...
      {
    %>

<!-- end of code-snippet 3 -->


Has anybody an idea, why the content of the field username is not
transferred
between f2_logon1.jsp and f2_logon2.jsp using the script x4frames() ???

Thanks

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

Reply via email to