从Struts源程序中可看出,处理表单请求的主函数process()中确实是对是否有ActionForm进行判断,如果处理ActionForm则不直接返回。
我个人认为,如果没有ActionForm Bean,即不用直接读取商业逻辑数据,那就没有必要采用Action,你可直接链接或转发到目标地址就行了。下面是Struts源程序中处理表单请求的主函数process():public void process(HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException { // Wrap multipart requests with a special wrapper
request = processMultipart(request); // Identify the path component we will use to select a mapping
String path = processPath(request, response);
if (path == null) {
return;
}
if (log.isDebugEnabled()) {
log.debug("Processing a '" + request.getMethod() +
"' for path '" + path + "'");
} // Select a Locale for the current user if requested
processLocale(request, response); // Set the content type and no-caching headers if requested
processContent(request, response);
processNoCache(request, response); // General purpose preprocessing hook
if (!processPreprocess(request, response)) {
return;
} // Identify the mapping for this request
ActionMapping mapping = processMapping(request, response, path);
if (mapping == null) {
return;
} // Check for any role required to perform this action
if (!processRoles(request, response, mapping)) {
return;
} // Process any ActionForm bean related to this request
ActionForm form = processActionForm(request, response, mapping);
processPopulate(request, response, form, mapping);
if (!processValidate(request, response, form, mapping)) {
return;
} // Process a forward or include specified by this mapping
if (!processForward(request, response, mapping)) {
return;
}
if (!processInclude(request, response, mapping)) {
return;
} // Create or acquire the Action instance to process this request
Action action = processActionCreate(request, response, mapping);
if (action == null) {
return;
} // Call the Action instance itself
ActionForward forward =
processActionPerform(request, response,
action, form, mapping); // Process the returned ActionForward instance
processForwardConfig(request, response, forward); }
我个人认为,如果没有ActionForm Bean,即不用直接读取商业逻辑数据,那就没有必要采用Action,你可直接链接或转发到目标地址就行了。下面是Struts源程序中处理表单请求的主函数process():public void process(HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException { // Wrap multipart requests with a special wrapper
request = processMultipart(request); // Identify the path component we will use to select a mapping
String path = processPath(request, response);
if (path == null) {
return;
}
if (log.isDebugEnabled()) {
log.debug("Processing a '" + request.getMethod() +
"' for path '" + path + "'");
} // Select a Locale for the current user if requested
processLocale(request, response); // Set the content type and no-caching headers if requested
processContent(request, response);
processNoCache(request, response); // General purpose preprocessing hook
if (!processPreprocess(request, response)) {
return;
} // Identify the mapping for this request
ActionMapping mapping = processMapping(request, response, path);
if (mapping == null) {
return;
} // Check for any role required to perform this action
if (!processRoles(request, response, mapping)) {
return;
} // Process any ActionForm bean related to this request
ActionForm form = processActionForm(request, response, mapping);
processPopulate(request, response, form, mapping);
if (!processValidate(request, response, form, mapping)) {
return;
} // Process a forward or include specified by this mapping
if (!processForward(request, response, mapping)) {
return;
}
if (!processInclude(request, response, mapping)) {
return;
} // Create or acquire the Action instance to process this request
Action action = processActionCreate(request, response, mapping);
if (action == null) {
return;
} // Call the Action instance itself
ActionForward forward =
processActionPerform(request, response,
action, form, mapping); // Process the returned ActionForward instance
processForwardConfig(request, response, forward); }
解决方案 »
- 那位大虾用了“Java爬虫”
- spring+ibatis整合的一个奇怪问题,问题解决给分
- 我想自己写个struts1的程序
- 新手求助 hibernate继承关系的配置问题
- 请问:Jboss4.0.3sp1作为web容器的问题。高手请进,高分回报
- axis里所带例子部署时出现以下错误怎么解决!!!
- 刚学struts,请教个问题
- 求助,哪位有Informix的jdbc driver?
- 求救:J2EE环境已配置好(J2sdkee1.3),但当程序用到ejb时老报错找不到ejb的包
- html代码中使用正则匹配字符串
- 在hibernate查询语句参数中如果有中文,hibernate返回数组越界
- resultset类只能从左到右,从前到后浏览,这从左到右是什么意思呀?
但我认为这样不安全!
我已经找到答案了。一定要加上actionForm!
<a href="xxx.do?param=xxx&¶m1=xxx">xxx</a>