Redirecting to a page using restful methods?

前端 未结 5 722
广开言路
广开言路 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:19

    change your code like this, the addUser() should return a Response Object

    public Response addUser(@FormParam("username") String username,
            @FormParam("password") String password,
            @FormParam("id") String id,
            @FormParam("group_name") String groupName,
            @FormParam("authority_name") String authorityName,
            @FormParam("authority_id") String authorityId
            )
    {
        //Something will be done here
    
        java.net.URI location = new java.net.URI("../index.jsp?msg=A_User_Added");
        return Response.temporaryRedirect(location).build()
    
    }
    

提交回复
热议问题