ドロップダウンリスト項目の選択に基づいてリストを取得したい。そのために、私は動作していない次のコードを使用しています:
<p:selectOneMenu style="width: 150px" value="#{watchBean.exchange}">
<f:selectItem itemLabel="NSE" itemValue="nse"/>
<f:selectItem itemLabel="BSE" itemValue="bse"/>
<p:ajax event="change" update=":frm" listener="#{watchBean.doScripList}" />
</p:selectOneMenu>
ビーンコード:
public void doScripList(ValueChangeEvent e)
{
sl=getAllScripByExchange((String)e.getNewValue()); //sl is of type List<MasterScrip>
}
デバッグすると、イベントが発生していないことがわかり、次のエラーが発生します。
javax.el.MethodNotFoundException: Method not found: beans.watchBean@9ac2e4.doScripList(javax.faces.event.AjaxBehaviorEvent)
at com.sun.el.util.ReflectionUtil.getMethod(ReflectionUtil.java:155)...
p:ajax を省略すると、「交換」タイプも取得/設定されません。この問題の原因は何ですか? その解決策は何ですか?
編集 されたメソッドの名前を wow() に変更しても、同じエラーが発生します:
javax.el.MethodNotFoundException: Method not found: beans.watchBean@1732d83.wow(javax.faces.event.AjaxBehaviorEvent)
編集済み: マネージド Bean コード
import java.util.List;
import javax.inject.Named;
import javax.enterprise.context.RequestScoped;
import javax.faces.context.FacesContext;
import javax.faces.event.ValueChangeEvent;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import javax.xml.ws.WebServiceRef;
import service.MasterScrip;
import service.StatelessWebService_Service;
@Named(value = "watchBean")
@RequestScoped
public class watchBean {
@WebServiceRef(wsdlLocation = "WEB-INF/wsdl/localhost_8080/StatelessWebService/StatelessWebService.wsdl")
private StatelessWebService_Service service;
/** Creates a new instance of watchBean */
public watchBean() {
}
String uname,scripSym,exchange;
Integer scripID;
List<UserTrack> ut;
List<MasterScrip> sl;
public List<MasterScrip> getSl() {
return sl;
}
public void setSl(List<MasterScrip> sl) {
this.sl = sl;
}
public String getExchange() {
return exchange;
}
public void setExchange(String exchange) {
sl=getAllScripByExchange(exchange);
this.exchange = exchange;
}
public void wow(ValueChangeEvent e)
{
sl=getAllScripByExchange((String)e.getNewValue());
// setSl(sl);
//FacesContext.getCurrentInstance().renderResponse();
// sl=getAllScripByExchange(exchange);
}