struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Abhijeet Mahalkar" <Abhijeet.Mahal...@indussoft.com>
Subject Re: No Error Message But A Blank Page Is Displayed.
Date Tue, 30 Sep 2003 04:21:34 GMT
have u updated the Resource files... ?
abhijeet
 
----- Original Message ----- 
From: "Caroline Jen" <jiapei_jen@yahoo.com>
To: <struts-user@jakarta.apache.org>
Sent: Tuesday, September 30, 2003 9:45 AM
Subject: No Error Message But A Blank Page Is Displayed.


I am experimenting a basic application - logon.  I got
the first two screens working without problem. 
However, the third screen displays a blank page (no
error message).  I am having a very difficult time to
figure out the problem; henceforth, seeking help. 
Here is the history of my application:

1. http://localhost:8080/LogonPractice/index.jsp (no
problem and I clicked on "Sign in")
2.
http://localhost:8080/LogonPractice/Logon.do;jsessionid=170B50E4D8E07EE36290E98342E8BF9C
(no problem and the screen asked for username and
password.  I filled out the information and clicked on
"Submit")  
3. http://localhost:8080/LogonPractice/LogonSubmit.do
(displayed a blank page)

The Tomcat log file shows the following (no error
message at all):

2003-09-29 23:29:26 action: Processing a GET for
/Logon
2003-09-29 23:29:26 action:  Looking for Action
instance for class
org.apache.struts.actions.ForwardAction
2003-09-29 23:29:26 action:   Double checking for
Action instance already there
2003-09-29 23:29:26 action:   Creating new Action
instance
2003-09-29 23:29:35 action: Processing a POST for
/LogonSubmit
2003-09-29 23:29:35 action:  Looking for ActionForm
bean under attribute 'logonForm'
2003-09-29 23:29:35 action:  Creating new ActionForm
instance of class 'org.apache.artimus.logon.LogonForm'
2003-09-29 23:29:35 action:  Storing instance under
attribute 'logonForm' in scope 'request'
2003-09-29 23:29:35 action:  Populating bean
properties from this request
2003-09-29 23:29:35 action:  Validating input form
properties
2003-09-29 23:29:35 action:   No errors detected,
accepting input
2003-09-29 23:29:35 action:  Looking for Action
instance for class
org.apache.artimus.logon.LogonAction
2003-09-29 23:29:35 action:   Double checking for
Action instance already there
2003-09-29 23:29:35 action:   Creating new Action
instance

in my struts-config.xml, I have:

        <action 
            path="/LogonSubmit"
           
type="org.apache.artimus.logon.LogonAction"
            name="logonForm"    
            scope="request"
            validate="true"
            input="/signin/Logon.jsp">
            <forward
                name="valid"
                path="/signin/Welcome.jsp"/>
        </action>

and my LogonAction.java is:

package org.apache.artimus.logon;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionServlet;

import org.apache.artimus.lang.Constants;

public final class LogonAction extends Action {

    public boolean isUserLogon(String username,
        String password) throws UserDirectoryException
{

        return
(UserDirectory.getInstance().isValidPassword(username,password));
        // return true;

    }


    public ActionForward execute(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;
        try {

            validated =
isUserLogon(username,password);
        }

        catch (UserDirectoryException ude) {
            // couldn't connect to user directory
            ActionErrors errors = new ActionErrors();
            errors.add(ActionErrors.GLOBAL_ERROR,
            new ActionError("error.logon.connect"));
            saveErrors(request,errors);
            // return to input page
            return (new
ActionForward(mapping.getInput()));
        }

        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.VALID));

    }

} // End LogonAction


The Constants.class is in the
ApplicationRoot/WEB-INF/classes/org/apache/artimus/lang
directory.  And I have 
public static final String VALID = "valid";

My Welcome.jsp in the ApplicationRoot/signin folder
looks like:

<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<HTML>
<HEAD>
<TITLE>Welcome!</TITLE>
<html:base/>
</HEAD>
<BODY>
<logic:present name="user">
<H3>Welcome <bean:write name="user"
property="username"/>!</H3>
</logic:present>
<logic:notPresent scope="session" name="user">
<H3>Welcome World!</H3>
</logic:notPresent>
<html:errors/>
<UL>
<LI><html:link forward="logon">Sign
in</html:link></LI>
<logic:present name="user">
<LI><html:link forward="logoff">Sign
out</html:link></LI>
</logic:present>
</UL>
<IMG src='struts-power.gif' alt='Powered by Struts'>
</BODY>
</HTML>



__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message