下图代码中的request.getAttribute("a");
这样不就写死了吗,可以灵活指定bean的名字吗?
比如request.getAttribute((String)request.getAttribute("bean"));
就是这个意思,写成上面这样编译不通过,应该怎么写呢?
request.getAttribute("bean")这个拿出来的未必是String型的吧
你直接强制转换(String)request.getAttribute("bean"),有可能失败
下图代码中的request.getAttribute("a");
这样不就写死了吗,可以灵活指定bean的名字吗?
比如request.getAttribute((String)request.getAttribute("bean"));
就是这个意思,写成上面这样编译不通过,应该怎么写呢?
request.getAttribute("bean")这个拿出来的未必是String型的吧
你直接强制转换(String)request.getAttribute("bean"),有可能失败