BTW, to debug have you tried to do mapping.findForward("success") and
mapping.findForward("fail") to see what happends?


-----Original Message-----
From: Bailey, Shane C. [mailto:[EMAIL PROTECTED] 
Sent: Thursday, July 31, 2003 5:35 PM
To: 'Struts Users Mailing List'
Subject: RE: Repost: Clicking "Submit" returns a blank page


A couple of observations:


1. Not that it is the solution but could you do <forward name="logon"
path="/pages/Logon.jsp" /> ?  Only because Logon.do is a forward (action
anyway).

2. Again, probably not necessary but add method="post" to the form tag.

3. I doubt it is a problem but I am so used to seeing the action attributes
on the same line you could move all the attributes like name="logonForm"
onto their own line.  You just never know when things should work and
aren't.

You already verified that LogonSuccess.jsp exists and isn't blank.  

I agree though with the post about verifying that the constant is the right
value. I have seen the blank page problem when I changed the name of my
forward in the struts config and didn't rename it in my action.

There is no null pointer exceptions or other exceptions being thrown in your
container output window?

I have exhausted everything I could think of for now.


-----Original Message-----
From: todd thorner [mailto:[EMAIL PROTECTED] 
Sent: Thursday, July 31, 2003 4:40 PM
To: [EMAIL PROTECTED]
Subject: Repost: Clicking "Submit" returns a blank page

I have reached this far in my debut logon page
development...
 
The first JSP page comes up fine, showing me a form
<html:form action="/LogonSubmit"> with a rendered
<html:text> tag for each required field (username
and password), plus a "Reset" and a "Submit" button.
Code sample below comes from my struts-config.xml
file:
 
<form-beans>
 <form-bean name="logonForm"
  type="mystrutsforms.LogonForm"/>
</form-beans>
 
<global-forwards>
 <forward name="logon" path="/Logon.do"/>
</global-forward>

<action-mappings>
 <action path="/Logon"
  type="org.apache.struts.actions.ForwardAction"
  parameter="/pages/Logon.jsp"/>
 <action path="/LogonSubmit"
  type="mystrutsactions.LogonAction" name="logonForm"
  scope="request" validate="true"
  input="/pages/Logon.jsp">
    <forward name="success"
      path="/pages/LogonSuccess.jsp"/>
    <forward name="fail"
      path="/pages/LogonFail.jsp"/>
 </action>
</action-mappings>
 
****************** struts-config.xml code above
******************

I can enter data into the <html:text> fields and
they will erase if I click "Reset"
I can click "Submit" with nothing filled in (passing
nulls with the request), and the proper
<html:errors/> are displayed.

However...

If I enter any values for the "username" and
"password" fields, then click "Submit," a blank page
is always returned (neither "LogonSuccess.jsp" nor "LogonFail.jsp" are
blank).

What's up with that?  The browser says it's trying
to display results from "LogonSubmit.do" (which is
what I expect).  I have a file called
"users.properties" in the directory
"WEB-INF/classes" and in my LogonAction.java code:

public final class LogonAction extends Action {
 
   public ActionForward execute( ActionMapping mapping,
              ActionForm form,
              HttpServletRequest request,
              HttpServletResponse response )
          throws Exception {
  
          String username = ( ( LogonForm ) form ).getUsername();
          String password = ( ( LogonForm ) form ).getPassword();
          boolean validated = false;
        
          try {
  
              validated = isUserLoggedOn( username, password );
          }
          catch ( SimpleUserDirectoryException sudexc ) {
              ActionErrors errors = new ActionErrors();
              errors.add( ActionErrors.GLOBAL_ERROR,
                 new ActionError( "error.logon.connect" ) );
              saveErrors( request, errors );
              return ( new ActionForward( mapping.getInput() ) );
          }
  
          if ( !validated ) {
  
              ActionErrors errors = new ActionErrors();
              errors.add( ActionErrors.GLOBAL_ERROR,
                 new ActionError( "error.logon.invalid" ) );
              saveErrors( request, errors );
              return ( new ActionForward( mapping.getInput() ) );
          }
  
          HttpSession session = request.getSession();
          session.setAttribute( Constants.USER_KEY, form );
        
          return ( mapping.findForward( Constants.SUCCESS ) );
      }
  
      public boolean isUserLoggedOn( String username,
          String password ) throws SimpleUserDirectoryException {
  
          return ( SimpleUserDirectory.getInstance().passwordIsValid(
                username, password ) );
      }    
  }
  
****************** mystrutsactions.LogonAction.java code above
******************
  
Note: The LogonAction.java file above makes use of the following
SimpleUserDirectory.java code:
  
 private static final String SimpleUserDirectoryFilepath =
"users.properties";
        InputStream ips =
this.getClass().getClassLoader().getResourceAsStream(
SimpleUserDirectoryFilepath );
        
****************** mystrutsforms.LogonForm.java code above
******************
 
Also, my web.xml file has:
 
 <init-param>
  <param-name>application</param-name>
  <param-value>application</param-value>
 </init-param>
 
****************** web.xml code above
******************
 
Any suggestions or guesses are appreciated.



____________________________________________________________
Get advanced SPAM filtering on Webmail or POP Mail ... Get Lycos Mail!
http://login.mail.lycos.com/r/referral?aid=27005

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to