Friday, April 12, 2013

(Preview) Reminders: the RESTful web version with HTML5 and JAX-RS

Because I'll be teaching mostly web applications for the remainder of the semester, I decided to rewrite my JavaFX + JPA example 'Reminders' as a web application.

I have used a clean separation of back-end (RESTful web services) and front-end (responsive web application). On the back-end, Java EE (JAX-RS, EJB, JPA) takes care of all the business logic and persistence. The front-end is built using HTML5, jQuery and Twitter Bootstrap.

Some notes:
  • This preview version does not yet support user accounts, authentication or authorisation, but that's #1 on my to-do list.
  • I only used Safari (OS X) and Mobile Safari (iOS 6) for testing.
  • The date and time picker isn't very responsive. On mobile devices, manually enter the date in the text field. It should work just fine.

Have fun playing around with this, and let me know if something isn't working for you!


Screenshots:




How to use this application:

First, you need to set up the database. There's two ways to do this:
  1. In NetBeans, go to the Services window. Under Databases, right-click Java DB and create a new database with the following settings:
    • Name: Reminders
    • Username: APP
    • Password: APP
  2. Or create your own empty database and edit glassfish-resources.xml and  persistence.xml to use this database.
Second, edit script.js. On the first line, replace the contents of BASE_URL with the URL where your web services will be hosted. Even if you're running it on localhost, it's best to replace localhost with your IP address, so you can test with multiple devices.

Then, simply deploy and run the application. The database schema will be created upon first use. Once this is done, you can edit persistence.xml to set the table generation strategy to none.


Source code:

No comments:

Post a Comment