2016-05-16 113 views
0

通常我用“正常”之类的servlet这样才能显示在JavaEE的观点一个观点:我如何可以显示注释

public class MyServlet extends HttpServlet { 

    private static final long serialVersionUID = 1L; 

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException 
    { 
     this.getServletContext().getRequestDispatcher("/WEB-INF/views/myview.jsp").forward(request, response); 
    } 

但我是在一个项目中仅有标注到处都是,我不明白我怎么可以这样显示一些视图...

@RequestScoped 
@Path("/user") 
@Produces("application/json") 
public class UserController extends Controller{ 

    @Path("v1/{pseudo}") 
    @GET 
    public String getUser(@PathParam("pseudo") String pseudo){ 
    ... 

有人可以帮助我吗?

THX

+0

它是一个安静的web服务,所以你应该阅读。对于这个问题,你可以从你的servlet中调用它。或者注入它? –

回答

0

对不起我的谷歌searsh是坏,我发现我的finnaly答案: @Path( “/文件”) 公共类DocumentationController延伸的HttpServlet {

@GET 
    public void getHome(@Context HttpServletRequest request, 
         @Context HttpServletResponse response) throws ServletException, IOException { 
     request.getRequestDispatcher("/WEB-INF/views/test.jsp") 
       .forward(request, response); 
    } 

} 

THX为响应不管怎样