JSP中的request对象可以设置多个属性吗?也就是多个request.setAttribute()可行吗?具体怎么使用?
展开全部
当然可以啊。
像这样request.setAttribute(“a”,a);
request.setAttribute("b",b);
像这样request.setAttribute(“a”,a);
request.setAttribute("b",b);
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
当然可以。request.setAttribute("key","value");
"key"只要不重复就行。
"key"只要不重复就行。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
就是用setAttribute();
setAttribute
void setAttribute(String name,Object o)
Stores an attribute in this request. Attributes are reset between requests. This method is most often used in conjunction with RequestDispatcher.
Attribute names should follow the same conventions as package names. Names beginning with java.*, javax.*, and com.sun.*, are reserved for use by Sun Microsystems.
If the object passed in is null, the effect is the same as calling removeAttribute(java.lang.String).
It is warned that when the request is dispatched from the servlet resides in a different web application by RequestDispatcher, the object set by this method may not be correctly retrieved in the caller servlet.
Parameters:name - a String specifying the name of the attributeo - the Object to be stored
以上是标准的API 文档
setAttribute
void setAttribute(String name,Object o)
Stores an attribute in this request. Attributes are reset between requests. This method is most often used in conjunction with RequestDispatcher.
Attribute names should follow the same conventions as package names. Names beginning with java.*, javax.*, and com.sun.*, are reserved for use by Sun Microsystems.
If the object passed in is null, the effect is the same as calling removeAttribute(java.lang.String).
It is warned that when the request is dispatched from the servlet resides in a different web application by RequestDispatcher, the object set by this method may not be correctly retrieved in the caller servlet.
Parameters:name - a String specifying the name of the attributeo - the Object to be stored
以上是标准的API 文档
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
可以多个名/值对的形式,
名/值对的形式啊,名是Sting 类型,值只要是ObJect就OK啦。。。。
名/值对的形式啊,名是Sting 类型,值只要是ObJect就OK啦。。。。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询