正如标题所说,我想执行以下代码
<%
String res = "response.sendError ( HttpServletResponse.SC_UNAUTHORIZED,\"You don't have enough privileges\" );";
%>
<%=res%>
所以当我执行这段代码时,我需要得到http 401 Unauthorized error
.
因为它是字符串格式,所以我在浏览器中得到以下字符串而不是 gethttp 401 Unauthorized error
response.sendError ( HttpServletResponse.SC_UNAUTHORIZED,"你没有足够的权限" );
那么如何将此字符串转换为对象,以便获得http 401 Unauthorized error
.