Redirecting to a page using restful methods?

前端 未结 5 723
广开言路
广开言路 2021-02-14 11:36

I\'ve created a page which asks user to fill some form fields and when he submits, the form is sent to a Restful method which you can see below:

@POST
@Path(         


        
5条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-14 12:18

    Finally I come to this conclusion that there are no other way than what I did:
    So here is my solution:

    try {
            java.net.URI location = new java.net.URI("../index.jsp?msg=A_User_Added");
            throw new WebApplicationException(Response.temporaryRedirect(location).build());
        } catch (URISyntaxException e) {
            e.printStackTrace();
        }
    


    By adding this block to my code, I got what I needed. Hope it helps you as well.

提交回复
热议问题