Reputation:
I have a Servlet where i have two fields username and password that is coming from database and now i want to view the data in a grid in ExtJs i dont know what to do..
public class LoginServlet extends HttpServlet {
try {
String Username=request.getParameter("username");/* i want to show these two data to the grid
String Password=request.getParameter("password");*/
JSONObject JSONobj=new JSONObject(); //this is json Object
JSONArray json=new JSONArray();//this is json array
JSONObject obj=new JSONObject();
obj.put("username",UserVO.getUsername());
obj.put("password",UserVO.getPassword());
json.add(obj);
JSONobj.put("employee", json);
response.sendRedirect("data-retrive.html");
} catch(Exception e){
System.out.println("Exception"+e);
}
}
Upvotes: 2
Views: 1441
Reputation: 2349
You are sending response in JSON
format from server. To read and to display, this response in ExtJS, you have to use Ext.data.Model, Ext.data.reader.Reader, Ext.data.JsonStore, Ext.grid.Panel
.
You can find more details about Ext.grid.Panel
on following link -
http://docs.sencha.com/ext-js/4-1/#!/api/Ext.grid.Panel
Also, take a look at ExtJS Grid examples
Upvotes: 2