我用这种方法可以获取到
HttpServletRequest request=ServletActionContext.getRequest();
String username=request.getParameter("user");
System.out.println(username);
但是用这种怎么报错,是不是我想错了
Map parame=ActionContext.getContext().getParameters();
String username=(String)parame.get("user");
System.out.println(username);
错误提示:
java.lang.ClassCastException: [Ljava.lang.String; cannot be cast to java.lang.String请教大神解释~~strutsactionstring
HttpServletRequest request=ServletActionContext.getRequest();
String username=request.getParameter("user");
System.out.println(username);
但是用这种怎么报错,是不是我想错了
Map parame=ActionContext.getContext().getParameters();
String username=(String)parame.get("user");
System.out.println(username);
错误提示:
java.lang.ClassCastException: [Ljava.lang.String; cannot be cast to java.lang.String请教大神解释~~strutsactionstring
String类型的数组(Stringp[])不能强制转换成String。
也就是parame.get("user")得到了一个String[]的值。
您的语句应该是:
String[] username=(String[])parame.get("user");
<c:when test="${gender==MAN}">
性别:<input type="radio" name="employee.gender" value="MAN" checked="checked"/><label>男</label>
<input type="radio" name="employee.gender" value="WOMAN"/><label>女</label>
</c:when>
<c:otherwise>
性别:<input type="radio" name="employee.gender" value="MAN"/><label>男</label>
<input type="radio" name="employee.gender" value="WOMAN" checked="checked"/><label>女</label>
</c:otherwise>
</c:choose>为什么这段话怎么执行都是执行的otherwise里的句子啊,,命名传过来显示的就是MAN,但是他就是执行出来otherwise里的话,,那个判断有错吗?