-2

register.jsp

<body>
<div id="container" >
<div id="header-container">
<div id="header">
    <div id="logo"><h2>Loc</h2></div>
</div>
</div>
<hr id="line">
<div id="content">
<form name="newUserForm"  onsubmit="return validate()" method="POST" action="rest/user/registerUser">

RegisterUser.java

@Path("/registerUser")
@POST
//@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
@Produces(MediaType.APPLICATION_JSON)
public LocResponse  registerUser (
@FormParam("userName")      String userName,
@FormParam("userEmail")         String userEmail,
@FormParam("loginIp")           String loginIp,
@FormParam("userGrp")           String userGrp,
@FormParam("pwd")           String password,
)

We are using Jersey and are able to create a JSON as response but not sure how to get it as a reposne and parse it using register.jsp.

  • possible duplicate of [Sending and Receiving JSON data from a restful webservice ?](http://stackoverflow.com/questions/22454427/sending-and-receiving-json-data-from-a-restful-webservice) – Brian Roach Mar 22 '14 at 14:11
  • @BrianRoach - I am looking as to how to handle JSON as a response on a JSP page but I don't see and JSP on the link you have mentioned so how come it is a duplicate of (http://stackoverflow.com/questions/22454427/sending-and-receiving-json-data-from-a-restful-webservice] ? – Mohit Guleria Mar 24 '14 at 06:27

1 Answers1

0

This is form post, the controller will try to send it to new page once the form is posted.

if you want to parse json response from the controller in that case you may need to use AJAX to received LocResponse .

try

how to parse json data with jquery / javascript?

http://www.tutorialspoint.com/json/json_ajax_example.htm

Community
  • 1
  • 1
Pranav T
  • 156
  • 1
  • 5