[jboss-user] [Beginners Corner] - Seam and JSON

froden do-not-reply at jboss.com
Thu Jun 12 12:03:14 EDT 2008


Hello, 

I'm creating a web application with Seam that, in addition to serving web pages, will also provide JSON objects for some Ajax calls.

My first thought was to simply let an xhtml page return JSON, as follows:

  | <html ...><head></head><body>
  | 
  | <ui:composition>
  | { "someKey": "someValue",
  |   "someOtherKey": "#{someBean.someValue}" }
  | </ui:composition>
  | 
  | </body></html>
  | 

This became cumbersome for a number of reasons, and I pressume this is not the most elegant way to do it.

My second thought was to create an old fashioned servlet to return the JSON data. I am, however, having some problems accessing Seam features, EntityManager etc in the servlet.

So, I am wondering, what is the best practice for doing this in a Seam web application? All suggestions are welcome.

~Frode

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4157741#4157741

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4157741



More information about the jboss-user mailing list