Java 在struts2框架中,DTO由列表<;字符串>;。它不是从S:select标记填充的
我是struts2新手,看看现有代码和网络中的其他地方,我认为下面的代码应该可以工作。我试图在JSP的s:select框中选择一些用户ID,我想在我的action类中使用这些ID。我正在使用modelDriven,用户在列表中 JSP代码片段Java 在struts2框架中,DTO由列表<;字符串>;。它不是从S:select标记填充的,java,jsp,struts2,Java,Jsp,Struts2,我是struts2新手,看看现有代码和网络中的其他地方,我认为下面的代码应该可以工作。我试图在JSP的s:select框中选择一些用户ID,我想在我的action类中使用这些ID。我正在使用modelDriven,用户在列表中 JSP代码片段 <s:select id="selectedAgents" name="selectedUserList" multiple="true" list="sel
<s:select id="selectedAgents"
name="selectedUserList"
multiple="true"
list="selectedUserList"
/>
页面中选定的用户ID将显示在此框中。提交表单时,我希望看到selectUserList正在运行
在我的行动中
public class WorkLoadReportAction extends GenericAction implements ModelDriven<WorkloadReportDTO>
...
private WorkloadReportDTO userReportInputData = new WorkloadReportDTO();
...
@Override
public WorkloadReportDTO getModel() {
return userReportInputData;
}
公共类WorkLoadReportAction扩展了GenericAction实现了模型驱动
...
private WorkloadReportDTO userReportInputData=new WorkloadReportDTO();
...
@凌驾
公共工作负载报告数据到getModel(){
返回userReportInputData;
}
WorkloadReportDTO
具有List selectedUserList
及其getter和setter
现在,在操作方法(从提交调用)中,我看不到已填充的selectedUserList
我缺少什么?在Jsp中:
<s:select id="selectedAgents"
name="selectedUserList"
multiple="true"
list="selectedUserList"
您的名称属性
值和列表属性
值相同。尝试更改名称属性
或列表属性
的值
希望这能解决您的问题默认拦截器堆栈?您能发布一个模型的代码吗?正如我所提到的,我是新手。我不明白你的问题。你能详细说明一下吗?@user2353827我想看看WorkloadReportDTO.java
@romac我想他是在回答我。OP:您是否使用默认的拦截器堆栈(您的包扩展了“struts default”,并且您还没有定义任何自定义的拦截器堆栈)?