Creating a json object in jsp and using it with JQuery

后端 未结 4 1546
既然无缘
既然无缘 2020-12-01 22:54

I\'ve created a JSP application, which gets results based on a user search (using lucene). I store the results in a Bean.

I\'m also using Jquery Ajax to display the

4条回答
  •  执笔经年
    2020-12-01 23:31

    Pretty simple approach would be to use taglib - json something like this :

    <%@ taglib prefix="json" uri="http://www.atg.com/taglibs/json" %>
    

    Then you can use json tags to create it out of list:

    
    
        
        
        
    
    

    Above jsp when executes will O/P following :

    [
     {"username":"varun","password":"*****","email":"johndoe@sssdotcom"},
     {"username":"ved","password":"*****","email":"johndoe1@sssdotcom"},
     {"username":"von","password":"*****","email":"johndoe2@sssdotcom"}
    ]
    

    Thats all folks!

提交回复
热议问题