後でバッキングBeanによって読み取られるURLでいくつかのIDを渡したいです。IDごとに、特定の操作が続きます。
Fg URL:localhost:8585 / monit / accepted.jsf?acceptMsg = 948&acceptMsg = 764
豆:
@ManagedBean
@RequestScoped
public class AcceptedBean {
@EJB
private MessageService messageService;
@ManagedProperty("#{paramValues.acceptMsg}")
private String[] acceptMsg;
public String[] getAcceptMsg() {
return acceptMsg;
}
public List<Message> getMessages() {
return messageService.getAcceptedMessages();
}
public void setAcceptMsg(String[] acceptMsgs) {
this.acceptMsg = acceptMsgs;
if(acceptMsg != null) {
try {
for (String accept: acceptMsg) {
final Message o = messageService.find(Integer.parseInt(accept));
messageService.accept(o);
FacesContext.getCurrentInstance().
addMessage(null,
new FacesMessage(FacesMessage.SEVERITY_INFO,
"Message was accepted:", o.getSubject()));
}
} catch (Exception e) {
FacesContext.getCurrentInstance().
addMessage(null,
new FacesMessage(FacesMessage.SEVERITY_ERROR,
"Error:", e.getMessage()));
}
}
}
}
acceped.xhtml:
....
<f:metadata>
<f:viewParam name="acceptMsg" value="#{acceptedBean.acceptMsg}" />
</f:metadata>
....
.xhtmlで値をバインディングに置き換えようとすると、
Cannot convert javax.faces.component.UIViewParameter@ee2549 of type class javax.faces.component.UIViewParameter to class [Ljava.lang.String;
変換エラーを解決する方法についてのアイデアをいただければ幸いです。