Here is what I have:
Java class (adding user):
public String addUser() throws NoSuchAlgorithmException {
HttpSession currentSession = request.getSession();
User u = new User();
u.setUname(getUserName());
u.setPassword(StringHash(getUserPass()));
u.setUtype(getUserType());
plResponse = iUserDAO.addUser(u);
setActionMessage(plResponse.getMessage());
currentSession.setAttribute("actionMessage", this.actionMessage);
return SUCCESS;
}
Java class (adding associations):
public String saveAssoc() throws Exception {
HttpSession currentSession = request.getSession();
try {
plResponse = iUserDAO.saveUserAssoc(currentSession.getAttribute("selectedUser").toString(), countryId, langId);
refreshUserAssociations();
setActionMessage(plResponse.getMessage());
currentSession.setAttribute("actionMessage", this.actionMessage);
}
catch (Exception e) {
throw new Exception(e.getMessage());
}
return SUCCESS;
}
JSP (for both cases the same):
<s:if test="actionMessage != null && actionMessage != ''">
<div class="successMessage">
<br/><s:property value="actionMessage"/>
</div>
<br />
</s:if>
I have two cases of passing the return message to the page. After adding a user, and after adding user associations. In both cases the parameter is passed properly to session (I debuged the code), but it is being displayed only in the first case (adding user). The second case pretends like there is no actionMessage in session.
What may be the reason?