Search code examples
web-applicationsplayframeworkextjsmobile-applicationsencha-touch-2

Web application using Play framework and sencha


Ok, I have been thinking of developing a web application using the play framework as my back-end service and sencha for my front end stuff.

Now I have been also looking into sencha touch and phonegap, which can help me make a native android application. So the problem here is how do i render data to two different devices. One is a touch device and other opens in a proper desktop browser.

Should I detect from which device the request has been made and then load the appropriate controller or what ? I am really confused right now ! I am very new to the web and mobile application scene, so please if someone can explain to me how to proceed would be a great help ! Thank you.


Solution

  • I use Sencha too, not Touch but Ext Js. What I have done is the following:

    Play! Server contains my logic and provides me the Restful URLs:

    POST   /user/create          AccountController.createUser
    GET    /user/userid          AccountController.getUser
    

    With Sencha I have defined a Store that retrieves JSON data from a specific URL, that URL point to my Play! urls.

    In my method in Play I retrieve an Model from my database and just return the JSON that Sencha will parse/read like:

    Query userQry = JPA.em().createQuery("select * from Account");
    List<Article> accounts= userQry .getResultList();
    renderJSON(accounts);
    

    Cheers