Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 770
aradhya Avatar asked Feb 18 '12 18:02

aradhya


People also ask

Is Sencha a framework?

Sencha Touch is a user interface (UI) JavaScript library, or web framework, specifically built for the Mobile Web. It can be used by Web developers to develop user interfaces for mobile web applications that look and feel like native applications on supported mobile devices.

What is the use of Play framework?

Play Framework makes it easy to build web applications with Java & Scala. Play is based on a lightweight, stateless, web-friendly architecture. Built on Akka, Play provides predictable and minimal resource consumption (CPU, memory, threads) for highly-scalable applications.

Is play open source?

Play Framework is an open-source web application framework which follows the model–view–controller (MVC) architectural pattern. It is written in Scala and usable from other programming languages that are compiled to JVM bytecode, e.g. Java.


1 Answers

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

like image 83
adis Avatar answered Oct 28 '22 19:10

adis