0
在SOF中搜索,但无法找到需要params传递的类似内容。如何将params从java中的Restful方法传递给jsp页面
我在WAS 7中的java中有一个Restful web服务,它从URL中获取很少的参数。我怎么把这个传给一个jsp。 这个类不是一个servlet。
当我做如下:
@Context
HttpServletRequest hsRequest;
@Path("myRestPath)
public void myRestMethod(@QueryParam("user") String userName)
{
hsRequest.setAttribute("username",userName);
hsRequest.getRequestDispatcher("myRestJsp.jsp").forward(hsRequest,hsResponse);
}
我得到这个错误:
500: RuntimeException:RequestWrapper objects must extend ServletRequestWrapper or HttpServletRequestWrapper
什么是我的错误,或者是有没有更好的方式来传递PARAMS把jsp?
您正在使用什么jax-rs提供程序,内置(使用功能包)还是自定义?我有这个工作在WAS 8.5.5(使用wink)。没有v7手头不幸的尝试。 – Gas 2014-09-27 20:48:07
@Gas我使用Websphere 7自带的那个。有没有其他方法可以从我的java方法调用jsp? – james2611nov 2014-09-29 03:05:05