4

Introduction

I am basically coming from two sides of the development teams. I started building web applications using PHP. This way, I had to implement everything by hand. Forms, graphical elements, how everything is tied together (i.e. what happens when you click a button).

On the other hand, some time ago I entered the Java Web world, namely JSF. Which is in my opinion a nice way to build a "serious" applications. (why I think so, read below)

Problem

I would like to build a web app that is made of a nice and useable frontend that is designed after my specifications (basically doing the HTML and graphical layout as a horizontal prototype first - as far as possible -, then make a complete webapp out of it). But on the other hand I would like to do all the business logic in Java because of its many nice frameworks out there - Hibernate, Morphia, Lombok, Dozer, just to name a few I met and fell in love with.

I could build the frontend with JSF myself but I still think, that I'm too limited because I have to use the built-in components that can only be customized to a certain amount. What if I want to use my own design patterns and UI elements and behavior but still want them to work together with a Java "backend"?

What would be the "best" choice of tools to achieve my goal? Choose a different web framework like Wicket or similar?

My idea: Build a web application in Java that understands the good old GET commands and translates it to the Java methods. Sort of a RESTful service - although I'm not a great fan of making everything RESTful in the frontend - unless you tell me, that's fine and reliable.

1
  • Then why not build your app as J2EE app? Use servlets and/or JSP to produce your html, add css and any javascript framework you like (jquery, mootools, etc.) - and keep all your heavy lifting in java. Commented Feb 3, 2012 at 18:54

2 Answers 2

6

Have you considered / looked at Google Web Toolkit for what you're trying to craft?

GWT is Java behind the scenes yet still can get you where you want to go, if I understand what you're asking.

Just an update:

If GWT isn't your thing, take a look at the Groovy / Grails route.

Just some elaboration here based on a comment...

With Groovy/Grails you don't actually have to merge your front and back end. I have seen that done, but its not necessarily always 100% required.

For example, you could create a web app in Grails where your AJAX functions could be formed and stored with the UI code being delivered out to the client for Great-UI-Justice. For added fun, you can even instruct Grails to include a JS framework such as jQuery to help you out with the UI.

Now on the back end, you should be able to take your Java back end and apply it directly with little to no change. However, I would recommend looking into adjusting anything you've done so far to take advantage of the Grails methodology.

Sign up to request clarification or add additional context in comments.

5 Comments

Yes, I had a look into it and saw it in action but I'm not too happy with the UI construction. Reminds me too much of Swing/SWT/etc. which is absolutely not what I want.
Have you considered the Groovy / Grails route then? It's Java on the backend, though not so much Swing/SWT/etc up front.
Thanks for the hint with Grails. Seems VERY much like my style of developing this. One more question: Developing this in Grails means the frontend and backend is combined, right? But I can use those GSP-pages to make use of the different functions and also implement my own AJAX functions and UI animations that come along with it, right? It would be great if you could elaborate a little more on that point. Going to accept your answer though, since this is what I wanted.
I don't mind elaborating at all! I'll add to the answer for a longer reply.
Thank you very much. Helped me out a lot. I think I am going to start by doing everything in Grails, since it seems to be very powerful already. If I ever feel the need to seperate front- and backend, I can still do so. Is that correct?
0

There are many JSF libraries like ICEfaces, RICHfaces etc, that make use of things like AJAX, etc.

In my personal opinion it's always a good idea to have a RESTful API and treat your web page just like any other client ;)

1 Comment

Using those, I feel somewhat limited in my UI design, since the technology dictates somehow how thinks look like and work (dataTables, buttons, other UI components) - do you have any helping resources on connecting a vanilla HTML/CSS/JS frontend with a Java RESTful backend? How can I provide a secure area with a session-based login? RESTful is pretty stateless, so that is what bothers me most about the idea.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.