Porting from PHP to Java - framework recommendations? - java

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.

Related

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.

From Java GUI to Java Web

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.

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.

Tools for java web applications?

What are the different ways to create a web-application in Java? Are there tools available other than straight-up servlets?
Open source web frameworks in Java and related view technologies:
Tapestry
Apache Cocoon
Apache MyFaces
Spring MVC
Google Web Toolkit (GWT)
Java Server Faces (JSF)
Apache Struts
Turbine
Seam
Makumba
Java Server Pages (JSP)
Stripes
OpenXava
JPublish
wingS
Strecks
AribaWeb
Echo
RIFE
Anvil
WebOnSwing
Click
ThinWire
Facelets
Wicket
Check http://java-source.net/open-source/web-frameworks for more options and to read a brief overview of each one.
There are many many web frameworks for Java that allow you to build Web Applications. The vast majority are built on top of the Servlet API, but provide a layer of abstraction that you interact with instead of dealing with servlets directly
My favourite (for what its worth) is Wicket
An quite old and simple standard is CGI, and java can do that: http://www.apl.jhu.edu/~hall/java/CGI-with-Java.html
A more recommended today would be to use a web-framework. These usually abstract from the Servlet API and provide a ground for common patterns in web development.
Here is a quite long list of available choices: http://java-source.net/open-source/web-frameworks
In java there's also Facelets, JSF and many other frameworks, like Spring MVC.
JuanZe gives a good answer with the list of frameworks. Here's some more detail.
I'd say take a look at Struts, as it's one of the oldest and simplest frameworks. Struts v1 and v2 are two different beasts; Struts v1.0 was written mostly in a day, and you can learn it in an hour, and might be a very good introduction to web frameworks.
I currently use Spring, and wouldn't go back to Struts from there. The nice part of Spring is that it comes with the framework (Spring MVC), but there are dozens of other "nice to have" components that really help you out as you continue to learn 'em.
Other developers I work with complain regularly that Seam is the way to go. They've said some pretty intelligent things in the past, but I really like Spring, and our project is married to it.
Wicket also looks interesting; Spring is very heavy on XML, and Wicket gets rid of that, which is a very happy thought. That said, there's a pretty huge gain with some of the XML in Spring, so I'd worry about losing that.
As an addition, I'd take a look at Apache Commons, formerly called Jakarta Commons. It's a collection of useful libraries of stuff that probably should be included in the core Java API. Discursive has a wonderful book that walks you through it.
if you are asking about tools interface to develop a web application.i suggest eclipse coz its too convenient to use,flexible and can run on pcs with low configurations.i have just 512 mb ram and i m using it easily
As a quickstart you could download Netbeans http://netbeans.org/ , you can try almost all kinds of J2EE technologies with a preconfigured app-server and database using included sample projects. It tooks only seconds to build and run and if you like analyze the code.
and here there is another one, a very young one this time: (ยต)Micro. It is open source, Apache 2 license, and available on Github. I built this framework for fun and I was trying to port and simulate as much functionality as I could from my experience as a Sinatra/Rails developer. Cheers!

Categories