String[] b = (String[])session.getAttribute("test");/** 我没试过 */
API如是说到: HttpSession public void setAttribute(java.lang.String name, java.lang.Object value)Binds an object to this session, using the name specified. If an object of the same name is already bound to the session, the object is replaced. After this method executes, and if the object implements HttpSessionBindingListener, the container calls HttpSessionBindingListener.valueBound.Parameters: name - the name to which the object is bound; cannot be null value - the object to be bound; cannot be null由此看来是不行,他需要的对象是一个OBJECT的,不是String[]的.
我没试过
*/
HttpSession
public void setAttribute(java.lang.String name,
java.lang.Object value)Binds an object to this session, using the name specified. If an object of the same name is already bound to the session, the object is replaced.
After this method executes, and if the object implements HttpSessionBindingListener, the container calls HttpSessionBindingListener.valueBound.Parameters:
name - the name to which the object is bound; cannot be null
value - the object to be bound; cannot be null由此看来是不行,他需要的对象是一个OBJECT的,不是String[]的.