cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Madu" <andrewm...@gmail.com>
Subject Java Flow/
Date Tue, 21 Mar 2006 14:29:26 GMT
Hi,
I have created a  java flow class which does the following:

//Load in validation file
FormInstance form = new FormInstance("forms/login.xml");

My login map is as follows:

Login.xml:
    <fd:validation>
        <fd:javascript>
            var success = true;
            var newUserReg = new Packages.test.User();
            var username = widget.lookupWidget("username");
            var password = widget.lookupWidget("password");
            cocoon.session.setAttribute("user", null);

            try {

                var checkUserTest = newUserReg.getUser(username.value,
password.value);

                if (checkUserTest != null) {
                    cocoon.session.setAttribute("user", checkUserTest);
                    success = true;
                }else{
                    username.setValidationError(new
Packages.org.apache.cocoon.forms.validation.ValidationError(e, false));
                    password.setValidationError(new
Packages.org.apache.cocoon.forms.validation.ValidationError("The password,
username combination does not exist. Please enter another one.", false));
                    success = false;
                }
            } catch (e) {
                    username.setValidationError(new
Packages.org.apache.cocoon.forms.validation.ValidationError(e, false));
                    password.setValidationError(new
Packages.org.apache.cocoon.forms.validation.ValidationError("The password,
username combination does not exist. Please enter another one.", false));
                    success = false;
            }

            return success;
        </fd:javascript>
    </fd:validation>

I am getting an error message when the line:

cocoon.session.setAttribute("user", null);

is hit. What is the issue with this when using javaflow instead of
flowscript? How can I alter thsi map so that it is java flow complient? I
tried:

<fd:java>

as a starter but got an error with that.

Andrew

Mime
View raw message