I am still having issues with the action setters not being called. I have already spent several hours on this problem. Here is additional information:
Struts 2 + Struts 2 struts2-convention-plugin version: 2.2.1.1 Absolutely *none* of my actions setters are called. This problem is happening across board with all my actions. I have re-factored all my actions recently to make use of Struts 2 annotations. I have also done some refactoring on the JSPs and Spring security filters. All actions were working fine before. And I *did* see the parameters passed from the browser to the struts 2 ParameterInterceptor (see previous logs). Below is my struts.xml and an action class with the setters that are *not* being called. Am I doing something wrong on my configurations and java code? <?xml version="1.0" encoding="UTF-8" ?> <!-- * @(#) $$Id: struts.xml 3763 2011-02-03 06:56:24Z rgomes $$ --> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1.7//EN" "http://struts.apache.org/dtds/struts-2.1.7.dtd"> <struts> <constant name="struts.devMode" value="false" /> <constant name="struts.action.extension" value="do" /> <constant name="struts.convention.default.parent.package" value="defaultPackage" /> <constant name="struts.convention.package.locators" value="action" /> <constant name="struts.custom.i18n.resources" value="struts/resources" /> <constant name="struts.date.format" value="dd/MM/yyyy hh:mm" /> <constant name="struts.freemarker.templatesCache" value="true" /> <constant name="struts.i18n.encoding" value="UTF-8"/> <constant name="struts.serve.static" value="true" /> <constant name="struts.ui.theme" value="simple" /> <include file="struts-default.xml" /> <package name="ajaxPackage" extends="json-default"> <interceptors> <interceptor name="secureInterceptor" class="com.softlagos.web.struts2.interceptor.SecureInterceptor" /> <interceptor-stack name="ajaxStack"> <interceptor-ref name="params" /> </interceptor-stack> <interceptor-stack name="secureAjaxStack"> <interceptor-ref name="ajaxStack" /> <interceptor-ref name="secureInterceptor" /> </interceptor-stack> </interceptors> </package> <package name="defaultPackage" extends="struts-default"> <interceptors> <interceptor name="fontSizeInterceptor" class="com.softlagos.web.struts2.interceptor.FontSizeInterceptor" /> <interceptor name="valueStackInterceptor" class="com.softlagos.web.struts2.interceptor.ValueStackInterceptor" /> <interceptor name="localeInterceptor" class="com.softlagos.web.struts2.interceptor.LocaleInterceptor" /> <interceptor name="secureInterceptor" class="com.softlagos.web.struts2.interceptor.SecureInterceptor" /> <interceptor-stack name="myDefaultStack"> <interceptor-ref name="fontSizeInterceptor" /> <interceptor-ref name="valueStackInterceptor" /> <interceptor-ref name="defaultStack"> <param name="exception.logEnabled">true</param> <param name="exception.logLevel">ERROR</param> </interceptor-ref> <interceptor-ref name="localeInterceptor" /> </interceptor-stack> <interceptor-stack name="secureStack"> <interceptor-ref name="myDefaultStack" /> <interceptor-ref name="secureInterceptor" /> </interceptor-stack> </interceptors> <default-interceptor-ref name="myDefaultStack" /> <default-action-ref name="default-action" /> <global-results> <result name="exception">/WEB-INF/content/${browser}/error.jsp</result> </global-results> <global-exception-mappings> <exception-mapping exception="java.lang.Exception" result="exception" /> </global-exception-mappings> <action name="default-action" class="com.softlagos.web.struts2.action.DefaultAction"> <result>/WEB-INF/content/${browser}/error.jsp</result> </action> </package> <package name="home" extends="defaultPackage" namespace="/"> <action name="about"> <result>/WEB-INF/content/${browser}/about.jsp</result> </action> <action name="error"> <result>/WEB-INF/content/${browser}/error.jsp</result> </action> <action name="help"> <result>/WEB-INF/content/${browser}/help.jsp</result> </action> <action name="language-help"> <result>/WEB-INF/content/${browser}/language-help.jsp</result> </action> <action name="pending-email-help"> <result>/WEB-INF/content/${browser}/pending-email-help.jsp</result> </action> <action name="privacy"> <result>/WEB-INF/content/${browser}/privacy.jsp</result> </action> <action name="remember-help"> <result>/WEB-INF/content/${browser}/remember-help.jsp</result> </action> <action name="terms"> <result>/WEB-INF/content/${browser}/terms.jsp</result> </action> <action name="terms-service"> <result>/WEB-INF/content/${browser}/terms-service.jsp</result> </action> </package> <package name="secure-tools" extends="defaultPackage" namespace="/secure/tools"> <default-interceptor-ref name="secureStack" /> <action name="view-google-contacts-import"> <result>/WEB-INF/content/${browser}/tools/google-contacts-import.jsp</result> </action> <action name="view-export-tools"> <result>/WEB-INF/content/${browser}/tools/export.jsp</result> </action> <action name="view-tools"> <result>/WEB-INF/content/${browser}/tools/tools.jsp</result> </action> </package> <package name="account" extends="defaultPackage" namespace="/account"> <action name="request-pwd-confirmation"> <result>/WEB-INF/content/${browser}/account/request-pwd-confirmation.jsp</result> </action> <action name="reset-pwd-confirmation"> <result>/WEB-INF/content/${browser}/account/reset-pwd-confirmation.jsp</result> </action> </package> <package name="secure-account" extends="defaultPackage" namespace="/secure/account"> <default-interceptor-ref name="secureStack" /> <action name="confirm-email"> <result>/WEB-INF/content/${browser}/account/confirm-email.jsp</result> </action> <action name="view-change-user-language"> <result>/WEB-INF/content/${browser}/account/change-user-language.jsp</result> </action> </package> <package name="secure-ssl-account" extends="defaultPackage" namespace="/secure/ssl/account"> <default-interceptor-ref name="secureStack" /> <action name="change-login"> <result>/WEB-INF/content/${browser}/account/change-login.jsp</result> </action> <action name="view-change-email"> <result>/WEB-INF/content/${browser}/account/change-email.jsp</result> </action> <action name="view-change-password"> <result>/WEB-INF/content/${browser}/account/change-password.jsp</result> </action> </package> </struts> package com.softlagos.web.struts2.action.account; import java.util.ArrayList; import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.struts2.convention.annotation.Namespace; import org.apache.struts2.convention.annotation.Result; import org.apache.struts2.convention.annotation.Results; import org.springframework.security.web.authentication.WebAuthenticationDetails; import com.softlagos.common.Message; import com.softlagos.common.Response; import com.softlagos.common.validator.PasswordValidator; import com.softlagos.domain.account.AccountResponse; import com.softlagos.domain.account.PrivilegeType; import com.softlagos.domain.account.RoleNameType; import com.softlagos.domain.account.UserAccount; import com.softlagos.domain.address.Email; import com.softlagos.web.cookie.CookieManager; import com.softlagos.web.cookie.CookieManagerFactory; import com.softlagos.web.struts2.action.common.BaseAction; /** * Handles the registration form submit to register a user account on the * system. * * @author Rubens Gomes * @version $Id: RegisterAction.java 3657 2011-01-27 17:38:40Z rgomes $ */ @Namespace("/ssl/account") @Results({ @Result(name="cancel", location="/", type="redirect"), @Result(name="error", location="/WEB-INF/content/${browser}/account/register.jsp", type="dispatcher"), @Result(name="input", location="/WEB-INF/content/${browser}/account/register.jsp", type="dispatcher"), @Result(name="success", location="/secure/addressbook/address-book.do", type="redirect") }) public final class RegisterAction extends BaseAction { private static final long serialVersionUID = 1; private static final Log logger = LogFactory.getLog(RegisterAction.class.getName()); static final Log newAccountLogger = LogFactory.getLog("NewAccountLogger"); private String email; private String password; private String confirmPassword; private String termsAgreed; private boolean cancel = false; public RegisterAction() { super(); } @Override public void validate() { if (this.isCancel()) { return; } if (StringUtils.isBlank(this.termsAgreed)) { this.addFieldError("termsAgreed", this.getText("error.account.termsNotAccepted")); } if (StringUtils.isEmpty(this.email)) { this.addFieldError("email", this.getText("error.account.emailRequired")); } else if (!Email.isEmailValid(email)) { this.addFieldError("email", this.getText("error.account.emailInvalid")); } // password if (StringUtils.isBlank(this.password)) { this.addFieldError("password", this.getText("error.authentication.passwordRequired")); } else if (!UserAccount.isPasswordValid(this.password)) { List<String> args = new ArrayList<String>(); args.add("" + PasswordValidator.MIN_PASSWORD_LENGTH); args.add("" + PasswordValidator.MAX_PASSWORD_LENGTH); this.addFieldError("password", this.getText("error.authentication.passwordInvalid", args.toArray(new String[0]))); } // confirm password if (StringUtils.isBlank(this.confirmPassword)) { this.addFieldError("confirmPassword", this.getText("error.authentication.passwordRequired")); } else if (!UserAccount.isPasswordValid(this.confirmPassword)) { List<String> args = new ArrayList<String>(); args.add("" + PasswordValidator.MIN_PASSWORD_LENGTH); args.add("" + PasswordValidator.MAX_PASSWORD_LENGTH); this.addFieldError("confirmPassword", this.getText("error.authentication.passwordInvalid", args.toArray(new String[0]))); } else if (!this.confirmPassword.equals(this.password)) { this.addFieldError("confirmPassword", this.getText("error.account.passwordsDifferent")); } } @Override public String execute() { if (this.isCancel()) { return "cancel"; } AccountResponse response = BaseAction.accountService.createUserAccount(this.email, this.password, this.getClientIpAddr(), RoleNameType.ROLE_USER, PrivilegeType.READ_WRITE, this.email, this.getLocale()); Message error = response.getErrorMessage(); if (error != null) { String errorMsg = this.getErrorTextMessage(error); if (logger.isInfoEnabled()) { logger.info("error occurred creating account: " + errorMsg); } this.addActionError(errorMsg); return ERROR; } UserAccount account = response.getUserAccount(); Response notificationResponse = BaseAction.notificationService.newAccountConfirmation(account.getUserProfile().getPrimaryEmail(), this.getConfirmationUrl("/account/confirm-new-account.do")); error = notificationResponse.getErrorMessage(); if (error != null) { String errorMsg = this.getErrorTextMessage(error); if (logger.isInfoEnabled()) { logger.info("error occurred submitting new account notification: " + errorMsg); } this.addActionError(errorMsg); return ERROR; } WebAuthenticationDetails details = new WebAuthenticationDetails(this.getRequest()); Response securityResponse = BaseAction.securityService.establishSecurityAuthentication(details, account.getId()); error = securityResponse.getErrorMessage(); if (error != null) { String errorMsg = this.getErrorTextMessage(error); if (logger.isInfoEnabled()) { logger.info("error occurred creating account: " + errorMsg); } this.addActionError(errorMsg); return ERROR; } // at this point an authentication has been placed on the security context, // and we can safely redirect the user to the contacts list page. // store prefered language on the cookie to remember user's prefered language. CookieManager cookieManager = CookieManagerFactory.getInstance(this.getRequest(), this.getResponse()); cookieManager.setLanguageCookie(this.getLocale().getLanguage()); // store the account Id on the session this.getUserSession().setAccountId(account.getId()); if (newAccountLogger.isInfoEnabled()) { newAccountLogger.info("-------------------------------------------------------------------"); newAccountLogger.info("Account created [" + account.getUsername() + "]"); newAccountLogger.info("Client IP address [" + account.getRegisteredClientIpAddress() + "]"); } return SUCCESS; } /** * @param password the password to set */ public void setPassword(String password) { this.password = password; } /** * @return the password */ public String getPassword() { return this.password; } /** * @return the confirmPassword */ public String getConfirmPassword() { return confirmPassword; } /** * @param confirmPassword the confirmPassword to set */ public void setConfirmPassword(String confirmPassword) { this.confirmPassword = confirmPassword; } /** * @return the user primary email */ public String getEmail() { return this.email; } /** * @param primaryEmail the user primary email to set */ public void setEmail(String primaryEmail) { this.email = (primaryEmail != null) ? primaryEmail.trim() : null; } /** * @return the terms */ public final String getTermsAgreed() { return this.termsAgreed; } /** * @param terms the terms to set */ public final void setTermsAgreed(String terms) { this.termsAgreed = terms; } /** * @return the cancel */ public boolean isCancel() { return cancel; } /** * notice that if the corresponding button is pressed the cancel should be set to true. * * @param cancel the cancel to set */ public void setCancel(boolean dummy) { this.cancel = true; } } --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org