I recently tried upgrading MyFaces 1.1.4 to the latest 1.1.5 version. When I
do this, my tests start failing because I have a couple pages that use
JavaScript to call an managed bean's method. Here's my password hint page:
<f:view>
<f:loadBundle var="text" basename="#{basePage.bundleName}"/>
<title>#{text['user.passwordHint']}</title>
<p>Looking up password hint for ${param.username}...</p>
<h:form id="passwordForm">
<h:inputHidden id="username" value="#{passwordHint.username}"/>
<h:commandLink action="#{passwordHint.execute}" id="execute">
<f:param name="username" value=""/>
</h:commandLink>
</h:form>
<script type="text/javascript">
var f = document.forms['passwordForm'];
f.elements['passwordForm:_link_hidden_'].value='passwordForm:execute';
f.elements['username'].value='${param.username}';
f.submit();
</script>
</f:view>
In PasswordForm.execute(), I have:
public String execute() {
// ensure that the username has been sent
if (username == null || "".equals(username)) {
log.warn("Username not specified, notifying user that it's a
required field.");
addError("errors.required", getText("user.username"));
return null;
}
if (log.isDebugEnabled()) {
log.debug("Processing Password Hint...");
}
// look up the user's information
try {
User user = userManager.getUserByUsername(username);
StringBuffer msg = new StringBuffer();
msg.append("Your password hint is: " + user.getPasswordHint());
msg.append("\n\nLogin at: " +
RequestUtil.getAppURL(getRequest()));
message.setTo(user.getEmail());
String subject = '[' + getText("webapp.name") + "] " +
getText("user.passwordHint");
message.setSubject(subject);
message.setText(msg.toString());
mailEngine.send(message);
addMessage("login.passwordHint.sent",
new Object[] { username, user.getEmail() });
} catch (Exception e) {
e.printStackTrace();
// If exception is expected do not rethrow
addError("login.passwordHint.error", username);
}
return "success";
}
This worked fine in 1.1.4, but for some reason - 1.1.5 keeps redirecting
back to the same page. Any ideas?
Thanks,
Matt
--
View this message in context:
http://www.nabble.com/Upgrading-from-MyFaces-1.1.4-to-1.1.5-tf3271040.html#a9094577
Sent from the MyFaces - Users mailing list archive at Nabble.com.