Thanks for the suggestion, I'll give it my newbie best.
--

--------- Original Message ---------

DATE: Thu, 31 Jul 2003 14:04:57
From: Michael Ruppin <[EMAIL PROTECTED]>
To: Struts Users Mailing List <[EMAIL PROTECTED]>,[EMAIL PROTECTED]
Cc: 

>Check that
>
>Constants.SUCCESS=success
>
>m
>
>--- todd thorner <[EMAIL PROTECTED]> wrote:
>> 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]
>> 
>
>
>__________________________________
>Do you Yahoo!?
>Yahoo! SiteBuilder - Free, easy-to-use web site design software
>http://sitebuilder.yahoo.com
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>
>



____________________________________________________________
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]

Reply via email to