Just a quick look and noticed you aren't being consistent with your use of the findForward. You should be consistent in your code in regard to whether you plan to use a Constants class or not. In one place (EvaluatiePreAction) you are hardcoding "success" but in LoginAction you are using the Constants value. Are you sure you don't have a value in for Constants.SUCCESS that represents some global forward that doesn't map to a valid jsp path? Also, are you sure you getting past your own validation test? Put some logging in your "if (!validated)" code block. I never really like doing return (new ActionForward(mapping.getInput())); either. To me, it's clearer to just use soemthing like mapping.findForward(Constants.ERROR). In your currrent set up, if later on you decided to rip out the validation="true" stuff and by accident ripped out the input also from your config, you'll end up with an error when your own manual validation failed. Lastly, are you sure you aren't seeing something in the actual server logs? I'd be curious also to know at exactly what point are you are leaving from your LoginAction. I'm also super confused because in your initial post you show all these logging statements yet I don't see any of them in the code below. For example, In your initial post you mention you have this in your logs: INFO: action: SUCCES!!, yet I don't even see that code anywhere below?

Brij Naald wrote the following on 11/24/2004 5:10 PM:
Not unless you would like to try posting
non-private parts of your action class for list members to review.

In advance: thanks for all the work you put in some 'newbie'-problems! I've checked the "success"-issue, but this was'nt the problem.

Here are the java-files

**********************
* EvaluatiePreAction *
**********************


public final class EvaluatiePreAction extends Action {

public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
servlet.log("Does he get here?"); //==>The output never gives this!!


HttpSession session = request.getSession();
LogonForm logon = (LogonForm) session.getAttribute(Constants.USER_KEY);


        if (logon == null)
            return (mapping.findForward("logon"));
        EvaluatieForm evaluatieForm = readEvaluatie(logon.getUsername());
        EvaluatieForm evform = (EvaluatieForm) form;
        try {
            PropertyUtils.copyProperties(evform, evaluatieForm);
        } catch (InvocationTargetException e) {
            Throwable t = e.getTargetException();
            if (t == null)
                t = e;
            throw new ServletException("RegistrationForm.populate", t);
        } catch (Throwable t) {
            throw new ServletException("RegistrationForm.populate", t);
        }
        return (mapping.findForward("success"));
    }

    /**
     * @param username
     * @return
     */
    private EvaluatieForm readEvaluatie(String username) {
        EvaluatieForm form = null;
        try {
            FileInputStream fis = new FileInputStream(username + ".txt");
            ObjectInputStream ois = new ObjectInputStream(fis);
            form = (EvaluatieForm) ois.readObject();
            ois.close();
        } catch (Exception e) {
        }
        if (form == null) form = new EvaluatieForm();
        return form;
    }
}

********************************************
* LogonAction-Class (as in struts-examples *
************************************

public final class LogonAction extends Action {


/** * Validate credentials with business tier. * * @param username The username credential * @param password The password credential * @returns true if credentials can be validated * @exception UserDirectoryException if cannot access directory */ public boolean isUserLogon(String username, String password) { return true; }


/** * Login the user. * The event is logged if the debug level is >= Constants.DEBUG. * * @param mapping The ActionMapping used to select this instance * @param actionForm The ActionForm bean for this request (if any) * @param request The HTTP request we are processing * @param response The HTTP response we are creating * * @exception IOException if an input/output error occurs * @exception ServletException if a servlet exception occurs */ public ActionForward perform(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { // Obtain username and password from web tier String username = ((LogonForm) form).getUsername(); String password = ((LogonForm) form).getPassword();

       // Validate credentials with business tier
       boolean validated = false;


validated = isUserLogon(username,password);




if (!validated) { // credentials don't match ActionErrors errors = new ActionErrors(); errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("error.logon.invalid")); saveErrors(request,errors); // return to input page return (new ActionForward(mapping.getInput())); }

       // Save our logged-in user in the session,
       // because we use it again later.
       HttpSession session = request.getSession();
       session.setAttribute(Constants.USER_KEY, form);
       // Log this event, if appropriate
       if (servlet.getDebug() >= Constants.DEBUG) {
           StringBuffer message =
               new StringBuffer("LogonAction: User '");
           message.append(username);
           message.append("' logged on in session ");
           message.append(session.getId());
           servlet.log(message.toString());
       }

       // Return success
       return (mapping.findForward(Constants.SUCCESS));

   }



*******************
* Action-mappings *
*******************
<action-mappings>

       <action
           path="/Logon"
           type="org.apache.struts.actions.ForwardAction"
           parameter="/pages/Logon.jsp"/>

       <action
           path="/LogonSubmit"
           type="app.LogonAction"
           name="logonForm"
           scope="request"
           validate="true"
           input="/pages/Logon.jsp">
           <forward
               name="success"
               path="/EvaluatiePre.do"/>
       </action>

<action path="/EvaluatiePre"
type="app.EvaluatiePreAction"
name="evaluatieForm"
scope="request"
validate="false">
<forward name="logon" path="/Logon"/>
<forward name="success" path="/pages/Evaluatie.jsp" redirect="true"/>
</action>




       <action
           path="/EvaluatieSubmit"
           type="app.EvaluatieAction"
           name="evaluatieForm"
           scope="request"
           validate="true"
           input="/pages/Evaluatie.jsp">
           <forward
               name="success"
               path="/pages/Evaluatie.jsp"/>
       </action>

   </action-mappings>

_________________________________________________________________
Is jouw domeinnaam nog vrij? http://hostbasket.msn.be/domains/index.asp


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



--
Rick

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



Reply via email to