public String program() {
try {
for(long i=startnum;i<endnum;i++) {
importProgramInfoService.importProgramPreviewInfo(i,creator);
}
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
action中有如上方法,我发出两次请求,一个是http://localhost:8080/xxx/program.do?startnum=1&endnum=300
另一个是http://localhost:8080/xxx/program.do?startnum=300&endnum=600
为什么他们不能同时进行,我断点查看了一下,是轮流实行的
try {
for(long i=startnum;i<endnum;i++) {
importProgramInfoService.importProgramPreviewInfo(i,creator);
}
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
action中有如上方法,我发出两次请求,一个是http://localhost:8080/xxx/program.do?startnum=1&endnum=300
另一个是http://localhost:8080/xxx/program.do?startnum=300&endnum=600
为什么他们不能同时进行,我断点查看了一下,是轮流实行的
默认情况下是单例的注解的话,加上@Scope("session")或者@Scope("prototype")
xml的类似,在scope属性上配置
在表单中加入:<s:token></s:token>
在struts配置文件:
<action name="xxxx" class="xxxxx">
<interceptor-ref name="token"/>
<interceptor-ref name="defaultStack"/>
<result name="invalid.token">/WEB-INF/jsp/generic/home.jsp</result>
</action>
就三步就能解决重复提交问题.