Hello all
Im thinking about web technology to use in my further web application
I know Java very well and I know c++ very well I know java well enable me fast development
But I know Java is resource hangry , and as single developer that probably will need to pay for web hosting
Im a afraid, this will cost be fortune because using Java.
Is my fear is justified
I like Java, but more than that i like JVM itself. From my experience, Scala works just perfectly for high-load data processing and frequent calls, serving critical data.
Groovy / Grails is a great thing, as for me too. You get a JVM and a whole lot of Java Libraries accessible from Groovy code, but also dynamic typing and, more or less, lightweight framework. That's if you're already familiar with Java. I think that it's going to be pretty easy for you. There're way more things laying around, such as JRuby that runs on JVM. But that all highly depends on what you're going to develop, or what tools you're most familiar with...
Nginx (static content + page caching) and Jetty make a good pair on a virtual server. H2 is a fast and lightweight database server and can also go on the same VS. I've had no problems with this technology stack at all - it should be fine until you get such a load that you can afford to upgrade your server setup.
My personal bias is to stay away from frameworks and use JDBC and a text templating library.
I would also stay away from most frameworks. Both the Play and Wicket groups have posts from people wondering where their memory has gone to.
Java web technologies are a mess. I finally gave up using JSP / Tiles / Sruts / JSF and started using HTML / CSS / JavaScript communicating to JSON services that I write using JAX-RS. After doing that my productivity went through the roof and would say it is comparable to ROR or PHP. I can rapidly prototype interfaces and then build the services to back them. The Java web technologies are a huge over-engineered time sink, the good part is there is really no need for them anymore.
It is actually pretty easy, If I am doing a multi-page site, I tend to use a CMS to do all of my static page templating and export them out as static pages onto the webserver. Then any dynamic stuff I build as widgets with either Dojo or jQuery depending on how complex the site it. Both toolkits have API's for calling JSON services and building UI widgets, but Dojo provides a more robust API for developing complex applications.
I usually create a Javascript file per-page that is outside of the frameworks that I call "pagename"_controller.js I put all of the controller code in this file and general make it procedural. So this file will put widgets on the page, glue communication between widgets, and generally act as the view controller for that page.
The controllers as wells as the server side services, I generally develop internally, because they require the most application knowledge. But if it is a huge product, I usually define the requirements for the widgets and sub them out.
The nice part is in the end, the pages are pure HTML, CSS and all of the Javascript is external to the HTML and CSS so it allows the designers to work in a pure technology that they are comfortable with. It also allows me to sub out work very easily because all of the technologies are well encapsulated. I can sub out a widget by just defining the requirements for that widget and the input and output calls. They do not need to understand the whole system rather just their box. As well my designers are able to take those widgets and drop them on the page and I am able to wire it all up. It is very clean, while maintaining the ability to rapidly develop and application.
Finally, I use JAX-RS and JPA to build server side services. This part is pretty straight forward as JAX-RS provides all of the marshaling and unmarshaling of objects as well as all of the web API's for things like grabbing cookies and security.
I use Alfresco for multi-page apps and nothing for a single page app. As for performance, the difference posting a form via form post or as a JSON call is negligible but the nice part about jax-rs is you can change use multi-inputs so if you wanted to you could set a forms action to post directly to the REST service and write a handler for form post. So if you want to form post data you can. As well, you can still provide a json post service as well as make the get and put json services. So you can have handlers for plain text, XML, json, and form post for a single rest service and jab will serialize them into the same object for your routine. Personal I do it all via xhr request becase dojo and jquery have a nice API for serializing a form into a json object.
I have been using JSF 2.0 with Tomcat for some personal projects and it's pretty nice. Using JSF you can quickly prototype things and the EL makes it simple to tie your java code (beans) to the web page (jsp).
With JSF 2.0 the faces-config.xml is gone and you just use annotations which has really simplified the whole JSF experience.
Edit: I should also add that JSF 2.0 makes ajax simple.
Groovy / Grails is a great thing, as for me too. You get a JVM and a whole lot of Java Libraries accessible from Groovy code, but also dynamic typing and, more or less, lightweight framework. That's if you're already familiar with Java. I think that it's going to be pretty easy for you. There're way more things laying around, such as JRuby that runs on JVM. But that all highly depends on what you're going to develop, or what tools you're most familiar with...