From Java GUI to Java Web - java

I've been doing quite large application recently with Java - Swing. Now I'd like to move to web. Basically - I am not Microsoft guy, Java is fine with me. I've checked some basics of Java EE framework and decided that my choice will be Spring. I already am familiar with JDBC. Learning Spring is one thing, but working just with GUIs (C++ and Java) means that I have very poor knowledge of web development.
Before I start reading tutorials of Spring MVC, what should I know to develop web solutions? I am mainly interested "how to" with graphics ... start from scratch or some nice IDE RAD-like development ? I kind of like f.e. Silverlight and integrating to web or asp.net win forms - allows us 'GUI' people develop faster. So can you please give me some useful advices?
Thanx

You might want to check http://code.google.com/webtoolkit/ for some client-side GUI javascript code compilationn from Java language. The code might even look like Swing in a way :)
Another thing of note is, perhaps you might want to use something like Hibernate with Spring instead of using JDBC.

In web, the GUI is mainly done by CSS. You can find here a quick CSS tutorial/reference. You get here some ideas of the capabilities of CSS. The "raw" UI part is done by plain HTML, which are in case of a Java EE webapplication usually served up from good old JSP files or in case of JSF, Sun's own MVC framework, also from XHTML files, powered by Facelets.
Talking about JSF, there exist several rich UI component libraries which can be used on top of JSF, such as RichFaces (showcase here) and IceFaces (showcase here). With those libraries you don't need to pull the hairs out to do the CSS based look'n'feel work.
Spring MVC doesn't offer any rich UI component libraries like that. Spring is in my honest opinion also obsolete in the improved Java EE 6 API which (finally) offers many Spring-like facilities out of the box.

Before you start learning Spring, consider Grails. It is built on top of Spring and Hibernate and it is much easier to learn and use. Grails use Groovy, but if you know java, learning groovy is very fast. Developing Java EE or Spring apps is just too painful and boring. And you can use grails with NetBeans or Eclipse.

Related

MVC for Java Desktop App

I want to create a desktop application using Java, but I'm new to desktop development and Swing. From web development I know I have to apply MVC to my project. Are there any tools or frameworks that simplify this task? Because I am a web developer I know such tools and frameworks exist for PHP. Are there any books that explain how to structure my project? My IDE of choice is Eclipse. So far I found this article http://www.oracle.com/technetwork/articles/javase/mvc-136693.html
Java Swing components are already the "V" and "C" of the MVC approach. You have to add the models part. In fifteen years of Java I have never found any tools that are better than knowing the Swing components back-to-front. The Swing tutorials from Oracle are the best free way to start.
The Eclipse Rich Client client platform (RCP). This PDF(http://wiki.eclipse.org/images/6/61/Frank_Gerhardt_Eclipse_Data_Binding.pdf) has a complete overview of applying MVC in RCP.
I know I read about people using the Spring framework for rich desktop applications. The Spring Rich Client Project (Spring-RCP) hasn't been updated since 2009, so I'm not sure how many people are doing this with Spring.
Griffon ( http://griffon.codehaus.org/ ) is a framework specifically built to make desktop MVC easy to do. It's in Groovy, a dynamic, Ruby-like language built on the JVM, in which you typically write code in Groovy, but can also mix in Java code.
You can see an introduction with an example that I posted on my employer's blog at http://blog.chariotsolutions.com/2010/12/painless-java-desktop-application.html

Eclipse/Java equivalent to Microsoft ASP.NET Model View Control Framework

Does anyone know if there is any equivalent to Microsoft's ASP.NET Model View Control Framework with Visual Studio/C# but for Eclipse with Java?
Or put it another way one could build a website in C# using MS Visual Studio with ASP.NET MVC, is there anything similar for Java using the Eclipse IDE?
I've built up good knowledge with Java and the Eclipse IDE creating some Android Apps that I'd like to leverage, now I need to turn my attention to web apps and I'd like to stick with Java and the Eclipse IDE. Cheers!
There are a bunch. I'd check out Play!
but there are also: Apache Wicket, Spring MVC and some others.
There is also a version of Play! for Scala which is a bonus if you intend on moving up from Java to Scala one day.
There is also a similar question with a more detailed answer here:
Choosing a Java Web Framework now?
Spring MVC is worth a look. Spring goes way beyond "just" MVC, with APIS for DB, JMS, and loads more, which may be a little offputting if you're just keen to get to grips with an MVC platform, but it's arguably worth it.
http://static.springsource.org/spring/docs/current/spring-framework-reference/html/mvc.html
http://static.springsource.org/docs/Spring-MVC-step-by-step/
Tapestry or Wicket is worth trying.
Yes, there are a lot of them. Your problem is that there are too many, actually. Narrowing down the list can be a challenge. Everybody has their favorites (mine is Apache Tapestry, because it's actually fun to use, and very powerful).
My recommendation is to pick 3 or 4 (I'd go with Tapestry, GWT, Spring MVC and Wicket), and then spend a couple days working through the introductory tutorial that each of them offers. You'll soon know which one feels right to you, and you'll be basing your decision on your own experience rather than the strongly-worded opinions of strangers.

Rails for Java Desktop MVC

I'm looking for a desktop application framework similar to Rails/Django but for Java desktop GUI's:
Good ORM (xml, db, whatever)
MVC
Default directory structure
View Helpers / CRUD support
Open Source & Mature
Basically, I want to define a large number of models for a desktop application either in Java or schemas and have a simplistic GUI framework generated to begin extending.
Does anything out there do this or come close?
Thanks.
You might try looking at Griffon: http://griffon.codehaus.org/. It's an MVC framework using the Groovy scripting language.
How about Monkeybars? It's a nice JRuby MVC framework (somewhat inspired by Rails, I think) that runs on top of Swing; you can use any ORM you like with it. I've had a lot of luck with it.
I was using Swinger for testing, but according to http://jeffkreeftmeijer.com/2011/capybara-ate-swinger/ , I think Capybara will now drive Swing apps.
While it isn't quite spot on, have you looked at grails (http://grails.org)?
You can take a look at scala. If you prefer Ruby, then you might try JRuby.
Today, Web applications run smoothly just like desktop apps using ajax. Ext js is a good example.

I would like to build a Java Web Application. What's the quickest start?

I am a reasonably competent programmer, with about 11 years experience.
I particularly like Ruby/Rails and ActionScript.
And Java is easy enough, I've used it for ordinary applications, and mostly as ones that run on the server, just not web-based ones.
I'd like to develop a web application in Java in order to leverage things like BlazeDS and help tie front-ends together with my previously-written Java apps. i.e. use existing Java code but in a web context.
But I'm having trouble - and confused - looking for a smooth start. I don't want to use Grails, been there, thanks, I want to use Pure Java, with whatever Framework you can think of. Spring, Hibernate, etc.
Where do I start?
Play Framework lets you get started quickly. http://www.playframework.org/
Spring Roo is a RAD framework for web apps. It's similar to like Rails or Grails, but uses code generation instead of metaprogramming magic.
This thread contains useful pointers on starting Java web development
http://www.daniweb.com/forums/thread249070.html
Since your goal is "Pure Java," how about Wicket? Straight from their feature list:
Wicket does not mix markup with Java code and adds no special syntax to your markup files. The worlds of HTML and Java are parallel and associated only by Wicket ids, which are attributes in HTML and Component properties in Java. Since Wicket HTML is just HTML and Wicket Java is just Java, coders and designers can work independently to a large degree and without relying on any special tools.
If you want more info, there's a web page on why you should use Wicket.
I've really enjoyed working with Spring MVC. It took a while to ramp up with Spring, but the whole affair has just made since after investing the time.
I have found JavaServer Faces 2.0 using Facelets to be a good compromise between power and ease of use, plus it allows you to use a lot of extra libraries when you get more advanced.
For JBoss you need to include JSF in your web application. Download the 2.0.2 distribution and see the documentation in there.

Porting from PHP to Java - framework recommendations?

Im porting a project from php to java. The project is a web-app based on php and ajax techniques with a javascript front-end. What java-frameworks would you use for something like this?
Does the result have to be written in Java, or does it just have to run on the JVM? In the latter case, you might want to consider Grails, which uses Groovy, a Java-based dynamic language that compiles to Java byte code and has full access to the Java standard API.
How well do you know Java?
Why are you porting it?
I can't really tell based on your description, but there are lots of Java web frameworks out there. Pick one. I prefer Spring.
I fear that you're about to be very disappointed. I anticipate a lot of questions like "Why can't I do X in Java? It's easy in PHP!"
Apache Wicket is a possible java based web framework you might consider. The default would be the java servlet and jsp frameworks.
without seeing the source code - you will need a complete rewrite. just "porting" will probably not work.
out of all available frameworks i'd recommend two: wicket if you want clean lightweight technology. with ajax. jsf/seam if you are in a corporate environment where it it easy to get tons of experienced developers.
I really like Stripes.
There's a really good book out on it too. Stripes ... and Java Web Development is Fun Again.
This question seems to come up alot. Related:
What Web Application Framework for Java is Recommended?
Best java mvc framework implementation for web apps
Does it make sense to use a framework for a simple java web app?
What language/platform to choose for a new web application?
In my opinion you would still do the same but generate the html with JSP and javabeans instead of php. javascripts and ajax will still work without a problem if the outputed html is the same.
It depends by the size of your project, the features and your resources.
If the project have'nt a lot of particular needs you can use Struts. Thsi is a stable framework, not really advanced but simple and powerfull for the development.
Another frameworks more recent and advanced are Spring and Wicket.
Before you start, I recommend you to do a check-list of your need:
Do you must porting a O/R mapping too?
Have you a stable developer knowing Java/J2EE?
Do you think to add some feature during the porting or in short-run?
etc etc
good luck! :)
I would port it to GWT
Google Web Toolkit (GWT) is a development toolkit for building and optimizing complex browser-based applications. Its goal is to enable productive development of high-performance web applications without the developer having to be an expert in browser quirks, XMLHttpRequest, and JavaScript. GWT is used by many products at Google, including Google Wave and the new version of AdWords. It's open source, completely free, and used by thousands of developers around the world.

Categories