...设置多个属性吗?也就是多个request.setAttribute()可行吗?具体怎么...
发布网友
发布时间:2023-12-29 04:49
我来回答
共5个回答
热心网友
时间:2024-08-17 06:39
可以啊 。没问题啊。不是带参数的嘛。
request.setAttribute(“a”,a);
request.setAttribute("b",b);
取的时候。就按照“”里面的值取就可以了
热心网友
时间:2024-08-17 06:40
当然可以啊。
像这样request.setAttribute(“a”,a);
request.setAttribute("b",b);
热心网友
时间:2024-08-17 06:35
当然可以。request.setAttribute("key","value");
"key"只要不重复就行。
热心网友
时间:2024-08-17 06:41
就是用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 文档
热心网友
时间:2024-08-17 06:41
可以多个名/值对的形式,
名/值对的形式啊,名是Sting 类型,值只要是ObJect就OK啦。。。。