Hello,

I've been racking my brain for a bit and hoping that someone will point
out my (probably obvious) mistake. 

[background]
This is my first Struts project. I downloaded the Struts 2.0.1 build and
started with struts-blank. I am basing my first action on the bootstrap
example. I have an input form with validation. When I go to the input
page the form is displayed without the validation errors. I reach it by
hitting registration!input.action. I've tested and the validation
appears to run correctly. If I fill out the form properly and attempt to
submit it, I don't get any errors, I am simply presented with the input
form again (with the values still intact). The form attempts to submit
to registration.action. I have the <s:actionerror /> tag in the input
JSP, but nothing is generated. Trying to figure out what is going on, I
launched Tomcat in debug mode and set a breakpoint in the execute
method. As you can see the execute method is very small. The breakpoint
I set in the execute method was never reached. However, other
breakpoints (such as ones I set in the setters and getters) are reached.
[/background]

[question]
Below, I have copy/pasted the Source for the Action as well as my
struts.xml file (actually another file that is included from the
struts.xml file). Are there any glaring errors that I am simply missing?
[/question]


---- Register.java
/**
 * 
 */
package com.writingcollab.Actions;

import java.util.Date;

import com.writingcollab.bl.user.User;

import com.writingcollab.persistence.user.PersistentUser;

import com.opensymphony.xwork2.ActionSupport;

/**
 * @author wesw
 *
 */
public class Register extends ActionSupport {
    static final long serialVersionUID = 20061105;
    
    private String userLogin;
    private String userPassword;
    private String realName;
    private String userEmail;

    public String execute() throws Exception {
        
        Date now = new Date();
        User newUser = new User();
        newUser.setCriticScore(0.0f);
        newUser.setDateCreated(now);
        newUser.setLastChangeDate(now );
        newUser.setLastLogin(now);
        newUser.setProfileID(0);
        newUser.setRealName(realName);
        newUser.setUserEmail(userEmail);
        newUser.setUserLogin(userLogin);
        newUser.setUserPassword(userPassword);
        
        PersistentUser newUserP = new PersistentUser(newUser);
        newUserP.insert();
        
        return SUCCESS;
        
    }

    /**
     * @return the realName
     */
    public String getRealName() {
        return realName;
    }

    /**
     * @param realName the realName to set
     */
    public void setRealName(String realName) {
        this.realName = realName;
    }

    /**
     * @return the userEmail
     */
    public String getUserEmail() {
        return userEmail;
    }

    /**
     * @param userEmail the userEmail to set
     */
    public void setUserEmail(String userEmail) {
        this.userEmail = userEmail;
    }

    /**
     * @return the userLogin
     */
    public String getUserLogin() {
        return userLogin;
    }

    /**
     * @param userLogin the userLogin to set
     */
    public void setUserLogin(String userLogin) {
        this.userLogin = userLogin;
    }

    /**
     * @return the userPassword
     */
    public String getUserPassword() {
        return userPassword;
    }

    /**
     * @param userPassword the userPassword to set
     */
    public void setUserPassword(String userPassword) {
        this.userPassword = userPassword;
    }
}
----

---- wc.xml
<!DOCTYPE struts PUBLIC
        "-//Apache Software Foundation//DTD Struts Configuration
2.0//EN"
        "http://struts.apache.org/dtds/struts-2.0.dtd";>

<struts>

    <!-- Add packages here -->
    <package name="wc" extends="struts-default">
        <action name="index" class="com.writingcollab.Actions.index">
            <result>/index.jsp</result>
        </action>
        
        <action name="register!*"
class="com.writingcollab.Actions.Register" method="{1}">
            <result name="input">/register/index.jsp</result>
            <result name="success">/register/complete.jsp</result>
        </action>
        
        <action name="portal/index">
            <result>/portal/index.jsp</result>
        </action>
        
        <action name="StyleSheetAction!*">
            <result>/css/{1}.css</result>
        </action>
        
        <action name="*">
            <result>/{1}.jsp</result>
        </action>
    </package>
    
</struts>


--
Wes Wannemacher
Director of Operations
Double A Trailer Sales, Inc.
[EMAIL PROTECTED]

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

Reply via email to