日期:2014-05-18  浏览次数:20649 次

请问这条语句什么意思 (struts)
public class UpdateAction extends BaseAction {
  public ActionForward execute(ActionMapping actionMapping,
ActionForm actionForm, HttpServletRequest request,
HttpServletResponse response)throws Exception {
AlbumContentForm userForm = (AlbumContentForm) actionForm;

IdentityBean idBean = this.getIdBean(request);请问 this.getIdBean是什么意思,()里的request具体的代表什么啊

------解决方案--------------------
this.getIdBean(request);指调用当前对象的实例中的getIdBean(HttpServletRequest request)的方法
request是由struts封装的HttpServletRequest对象的一个实例,里面含有所有的被封装过的请求的信息。
------解决方案--------------------
HttpServletRequest是一个Servlet接口,接口里面的方法楼主可以点进去查看。
这个接口由servlet容器实现,通过它可以得到一个http请求的一些信息。
比方说,我想得到提交的表单中一个名为"userId"的输入框的内容,可以用
request.getParameter("userId")来得到。

struts2.0以前的版本的struts是依赖于servlet的,action里面的execute方法的参数就有HttpServletRequest request,HttpServletResponse response


------解决方案--------------------
public interface ServletRequest

Defines an object to provide client request information to a servlet. The servlet container creates a ServletRequest object and passes it as an argument to the servlet's service method.

定义一个为servlet提供客户端请求信息的对象,servlelt容器创建ServletRequest对象并把它当做一个参数传入servlet's的service方法。

A ServletRequest object provides data including parameter name and values, attributes, and an input stream. Interfaces that extend ServletRequest can provide additional protocol-specific data (for example, HTTP data is provided by HttpServletRequest. 

一个ServletRequest对象提供的数据包括参数名、值、属性和一个输入流。继承ServletRequest接口可以附加特定的协议(例如:http)
---------------------------------------------------------------
public interface HttpServletRequest
extends ServletRequest

Extends the ServletRequest interface to provide request information for HTTP servlets.

继承了ServletRequest借口,为HTTP servlets提供request信息。

The servlet container creates an HttpServletRequest object and passes it as an argument to the servlet's service methods (doGet, doPost, etc). 

servlet container创建一个HttpServletRequest对象,并把它当做一个参数传递给servlet的服务方法(doGet,doPost,等等)。

查金山词霸也得把他翻译出来。