Hmm.. I can get the user, but the preferences are not getting saved.

In preferencesForm I have:

<s:form id="preferencesForm" action="savePreferences" method="post"
validate="false">
<li>
    <s:checkbox key="user.preferences.haveCompany" cssClass="checkbox"
theme="simple"/>
    <!-- For some reason, key prints out the raw value for the label (i.e.
true) instead of the i18n key:
https://issues.apache.org/struts/browse/WW-1958-->
    <s:label for="preferencesForm_preferences_haveCompany"
value="%{getText('user.preferences.haveCompany')}" cssClass="choice desc"
theme="simple"/>
</li>

and other preferences like it.

In preferencesAction:

 public String save() throws Exception {
    if (cancel != null) {
      return "cancel";
    }

    try {
      userManager.saveUser(user);    // save the related user and his
preferences
    } catch (AccessDeniedException ade) {
      // thrown by UserSecurityAdvice configured in aop:advisor
userManagerSecurity
      log.warn(ade.getMessage());
      getResponse().sendError(HttpServletResponse.SC_FORBIDDEN);
      return null;
    }

    String key = "preferences.updated";
    saveMessage(getText(key));

    return SUCCESS;
  }
}

In Preferences.java:



In User.java:

  private Preferences preferences;

  @Embedded
  public Preferences getPreferences() {
    return preferences;
  }

The save action does save the user, but his preferences either stay
unaltered or get cleared right away. Reading back the person produces an
object with empty preferences. I would expect that the form submits the
checkbox values directly to the user object and I just need to save the user
object in my action.

I cant find the reason why the save doesnt work. Any suggestions?
-- 
View this message in context: 
http://www.nabble.com/exception-thrown-when-trying-to-get-current-user-tp25458093s2369p25460126.html
Sent from the AppFuse - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@appfuse.dev.java.net
For additional commands, e-mail: users-h...@appfuse.dev.java.net

Reply via email to