带有服务器端绑定的kendo ui JSP dropdownlist
我正在使用kendouijsp包装控件,并尝试使用带有服务器绑定的kendodropdownlist 我正在使用Struts2执行控制器操作带有服务器端绑定的kendo ui JSP dropdownlist,jsp,struts2,Jsp,Struts2,我正在使用kendouijsp包装控件,并尝试使用带有服务器绑定的kendodropdownlist 我正在使用Struts2执行控制器操作 **Here is my code for Action class** public String execute() throws Exception { editMode = false; HttpServletRequest request = ServletActionContext.getRequest();
**Here is my code for Action class**
public String execute() throws Exception {
editMode = false;
HttpServletRequest request = ServletActionContext.getRequest();
DiseaseTrackingDelegate dtd = new DiseaseTrackingDelegate();
//Below call will get list of all objects
List<DstLookupType> allDstLookupTypes = dtd.getDstLookupTypes(dstLookupType, user.getCurrentClientId());
//Below call will get specific list of objects from the above list
List<DstLookupType> specificDstLookupTypes = getSpecificDstLookupTypes(Constants.DST_LOOKUP_GRP_TYPE_1, allDstLookupTypes);
//this.primaryDiagnosisTypes = dstLookupTypes;
//I am setting the specific list to the request.setAttribute. Can I use the below code?
request.setAttribute("primaryDiagList", specificDstLookupTypes);
return SUCCESS;
}
public List<DstLookupType> getSpecificDstLookupTypes(int grpLookupTypeId, List<DstLookupType> allDstLookupTypes)
{
List<DstLookupType> lookupTypes = new ArrayList<DstLookupType>();
allDstLookupTypes.forEach(dstLTypes->{
if( Integer.parseInt(dstLTypes.getFDstLookupGrpTypeId()) == grpLookupTypeId){
lookupTypes.add(dstLTypes);
}
});
return lookupTypes;
}
***Below is the code in JSP***
<kendo:dropdownlist name="primarydiagnosis" dataTextField="lookupValue" dataValueField="dstLookupTypeId">
<kendo:dataSource data="${primaryDiagList}"></kendo:dataSource>
</kendo:dropdownlist>
**这是我的动作类代码**
公共字符串execute()引发异常{
editMode=false;
HttpServletRequest=ServletActionContext.getRequest();
DiseaseTrackingDelegate dtd=新的DiseaseTrackingDelegate();
//下面的调用将获得所有对象的列表
列出所有DstLookupTypes=dtd.getDstLookupTypes(dstLookupType,user.getCurrentClientId());
//下面的调用将从上面的列表中获取特定的对象列表
List specificDstLookupTypes=getSpecificDstLookupTypes(Constants.DST_LOOKUP_GRP_TYPE_1,allDstLookupTypes);
//this.primaryDiagnosisTypes=dstLookupTypes;
//我正在将特定列表设置为request.setAttribute。我可以使用以下代码吗?
setAttribute(“primaryDiagList”,specificDstLookupTypes);
回归成功;
}
公共列表getSpecificDstLookupTypes(int-grpLookupTypeId,列出所有DstLookupTypes)
{
List lookupTypes=new ArrayList();
allDstLookupTypes.forEach(dstLTypes->{
if(Integer.parseInt(dstLTypes.getfdstlookuprptypeid())==grplookupptypeid){
添加(dstLTypes);
}
});
返回查找类型;
}
***下面是JSP中的代码***
我使用在action类中设置的http请求属性作为kendo:datasource数据元素。但它不起作用
我甚至将其设置为一个表单元素,我在上面的操作代码中对此进行了注释,但这也不起作用
如何使用Struts 2和JSP将Kendo dropdownlist与服务器绑定一起使用
谢谢您应该澄清哪些地方不起作用,以便更清楚地了解,就编写而言,一切看起来都很好。我在操作的请求属性中设置了DSTLOOKUPTYPE对象列表,并尝试在JSP的kendo:dataSource数据元素中使用相同的属性。但下拉值未填充,剑道下拉列表控件也未显示。您应该澄清哪些不起作用,以便更清楚,就编写而言,一切看起来都很好。我在操作的request属性中设置了DSTLOOKUPTYPE对象列表,并尝试在JSP的kendo:dataSource数据元素中使用相同的属性。但是不会填充下拉值,也不会显示剑道下拉列表控件。