Easiest web development method from Java perspective? - java

I have always been a front-end Java programmer, sometimes had to do C# on .NET but for the most part, Java is probably all I know about.
Just currently I have to do a small-scale website doing extremely simple thing and I really don't know where to start. My HTML skill is probably as good as I am with XML on Android, which is fair to say far less complicated than the HTML source code modern website have. I have almost no experience with PHP either, and no strong background on building or managing a database.
Is there some sort of technology that builds fully working website using mainly Java? It may have other languages I have to familiarize with but for the most part, I'd like to have little learning curve. For the backend I'm very sure I'm going to use cloud server services like Azure or Parse.
This is a very special project of me so I can't let anyone code it rather than me and myself only. Thank you and have a good day.

Use Servlets and JSPs for web development it's a start point and then java webservices as you already know XML.

I suggest you to build all your front-end using the following set of technologies: HTML5, AngularJS, JQuery, javascript, bootstrap. Your backend could exchange json with the front-end. The Bootstrap is the base for all your website and you could get a free template from the web itself, which would severely reduce your hard work at web designing. You would need just to adapt the links and calls, and the AngularJS would handle the controller and other stuffs ( have a chance to learn about ). Some JQuery components, or even AngularJS components would enhance your system usability and combined with javascript would bring most of hard work to front-end. I had the chance do start a system from zero and this is what I did, and now I have an AngularJS app working together with java by having java on the backend ( spring, hibernate, etc ) receiving and providing json data. At github you find some angularjs seed examples which you could use in your app and, again, save time and effort.

My apologies in advance, My answer is a bit broader in scope,
The Best Development Model for developing any website regardless of your language choice in Azure App Service is to take advantage two powerful features offered by Azure App Service, the Continuous Deployment feature and Deployment slots.
Start your website on a git repository and you may have node modules or bower packages, but on build your git will crunch it down to a working website with proper gulp files. Check out this blog to understand the process.
Once you have the git repo working for a simple website, your development process becomes much smoother. You can commit a change and Continuous deployment will automatically start a deployment for you to get your latest bits into your web app.. Check this blog for more details on Continuous Deployment.
You can use deployment slots to stage your changes and swap to maintain multiple versions of your web app on the cloud to easily build a production level application that has a last known good state. Check this blog for more details on Deployment slots.
The two features are the most used features while developing, deploying and servicing any project I work and I have found them very useful to understand them and use them in all their glory.
I am not a Java developer, but from the your question I can see you are looking to start on web development, the quick and powerful way (purely subjective here :D) is to use Asp.Net 5 with Angular 2 Beta. Here is an end to end tutorial on how to setup a development environment. Asp.Net 5 should be friendly toward Java developers as it is very light weight and simple to use and works great with vscode and visual studio community edition.
Let me know if the long answer helped, if you need a pure java environment that should be possible too :).

Related

advantages of play framework for people coming from php / ruby / python

One of the strongest selling points of play framework is it's development cycle, just fix the code, go back to your browse, hit reload, and go one, all without the write, compile, deploy, hassle typical of j2ee web development.
Nevertheless, for web developers coming from php, ruby or python this is hardly surprissing, moreover it's considered the natural way to develop web apps.
Moreover, many of the advantages of play, (efficient template system, resolve errors quickly, stateless, fun & productive) are taken for granted in those frameworks...
So I'd like to know what do you think are the main advatages that play framework brings to web developer coming from dynamic languages.
From my point of view these are the main advantages
it's java, so if you don't feel confortable with java, and you are not willing to learn it, that might not be an advantage. On the other hand, if you HAVE to use java, coming from php or rails you will feel right at home with play
it's static (except for templates and routes, that's about to change on the next version), so you have compiler checks and safe refactoring.
tool support: IDE support (eclipse, intellij, netbeans)
endless collection of libraries to do everything you want, well, it's just java
runs on the jvm, which has years of experience and optimizations
it's compiled, so you may expect better performance
it's really fullstack: it comes with everything you need to develop a web app, compiler, web server, in memory db server, offline documentation, integrated database manager, local and distributed cache management, fixtures, evolutions, dependency management, lots of utility libraries, unit tests, selenium tests, ide support. You need no apache or mysql setup to get up and running
it has advanced features, like asynchronous requests, web sockets, asynchronous jobs
zero development environment setup: just unzip play.zip, play new my app, play run myapp
excellent documentation
great and fast growing community
scala is firmly in it's horizon, if you come from a dynamic language you might feel more comfortable with a language like scala, even though it's static
can be deployed to any servlet container, like tomcat, but also comes with it's own lightweight server
it's got an ever growing collection of community contributed modules
it's cloud friendly, works on gae, heroku, playapps, cloudbee, dotcloud, etc... (see this question)
source code: this is one of it's main advantages, even though it's often neglected. The source code is pretty readable, understandable and not over engineered. Even without much java knowledge, it's possible to have a look at the code, understand it, and begin contributing to the project
In my particular case, coming from a php & classic asp background, play allowed me get a web application up and running while learning java at the same time. it really let me enjoy my transition from dynamic languages to java...
Play has some advantages compared to other dynamic web frameworks, but I think that if you are proficient in codeignter, rails, django, etc, and if you are not willing to benefit from java's (or scala) ecosystem, you should stick to what you know...
A similar debate has been running on Google Groups recently, but more specifically comparing Play and Ruby (on Rails). I have tried to collate some of the feedback the community has provided on this topic, rather than just give me personal view. Hopefully this will make for a more rounded answer!
statically types business logic layer (and using the new templating engine, even your views will be statically typed). This has therefore the advantage of better IDE support as well.
Can use Java as well as Scala, so you are not restricted to a single technology stack.
Play just works out of the box, but is also highly configurable, so does not force you to work in a particular method.
In memory DB. Great for new developers, who just want to get started. No need to go through setting up WAMP/LAMP server etc, just to get started. Just download play, and you are ready to go!
Its Java (or Scala)! I got hooked on Play because I used PHP begrudgingly because it was the easiest way to host a personal website, but hated that I was building software in a way that I did not feel was well structured. Play allowed me to use Java without the bulk of a J2EE application.
Play framework. Play is heavily inspired by Ruby on Rails and Django. A developer familiar with any of these frameworks will feel at home.
1) Play leverages the power of Java to build web applications,By lifting away the Java EE constraints, Play provides developers with an easy-to-develop and elegant stack aimed at productivity.
2) It focuses on developer productivity and targets RESTful architectures. Play is a perfect companion to agile software development.
3) Folder structure of the play mostly match with the Rails.
4) Play loads the code dynamically. Just fix the bug in Java file and hit reload, the change will get reflected instantly on webpage. No need to go through those sluggish rebuild / deployment / server restart.
5) No configuration: No configuration required just download, unpack and start development.
6) Error discovery is very easy, When an error occurs, play shows the error message, the file path, line number, and relevant code snippet right in the browser.

Migrating a 2-tier Java application to...?

We currently have a 2-tier Java Swing application sitting on top of MS SQL Server 2005. All the business logic is in the database. The client is quite old (and not very friendly), and for reasons of performance and scalability, we've already started porting some services to a middle tier in Java.
However, we still have a number of short and long term goals:
Pick a technology stack for a new front-end
This isn't easy - I can see everything from a web app at one end of the continuum to a traditional desktop app at the other being viable choices. The current front-end isn't really complex (mostly form-based), so I can see web/AJAX fitting, but it's an area where we don't know what we don't know.
Stacks on my list are:
Eclipse RCP, Netbeans RCP
Flex/Flash, Silverlight, JavaFX
Pure Javascript frontends (Sprout Core, Javascript MVC, ...)
Java-based Web frameworks (Wicket, JSF, ...)
Find a way of making the current application perform acceptably in a remote situation
We have some clients who resale our app to smaller clients and need to be able to remotely deploy it. Due to the 2-tier nature of the current architecture this leads to terrible performance (for example, calling a stored procedure that returns 18 result sets). We've used a Citrix solution in the past, but no-one likes that approach. Tunneling JDBC through port 80 also sounds like a bad idea. I was starting to wonder if there's anything that could use a X-Windows like approach to remote just the GUI part.
To simplify development and leverage your experience in Swing consider using Vaadin for your frontend. It is a Java framework for building modern web applications that look great, and perform well. All the code is written in Java and looks very similar to Swing.
As far as overall application architecture I would advise multi-tier, service oriented architecture. The best way to do it is by using Spring framework with Hibernate for database access.
If you want to easily redeploy your application, for an update, security reasons, etc. and if you want your application to be it to be accessed remotely, you should really consider a web based front end.
Plus, this way, only one app, your web app, will handle connection to the database, so no JDBC tunneling or whatever.
Concerning the best framework, it depends on your team knowledge, the way your application will be used (more or less javascript), etc.
We've just gone through a very similar evaluation process as we're migrating a legacy application.
For us the biggest deciding factor in what front-end framework to use was the prior knowledge of the development team. We wanted something that everybody would be comfortable with immediately. We had a couple of the senior developers that have worked with X or Y, but the framework that everybody knew was Swing.
In the end we decided on the NetBeans platform using RESTful webservice to communicate with an EE server.
As a bonus you can get your NetBeans platform application to deploy as a Java WebStart application, which means you get the benefit of not having to worry about individual installations.
If the frontend is mostly form-based, I would stay away from Flex. Flex is great for some applications (I'm using it for a canvas based application), but the form components of Flex has some usability issues. They just don't work like you expect from todays web. (like missing support for mousewheel, typing in dropdownlist only take first character into account etc.)
Assuming that you are going to force all your clients to install a new middle tier, I can't think of an argument against making it a Java web app. As already mentioned you have the benefit of controlling all access into your platform over HTTP, which allows easy resale, just with firewall configuration. There's no reason you can't make use of Javascript within a web front end, you may be interested in DWR, which allows you to interact directly with Java objects via Javascript. I've used this before to add some simple Ajax interaction to a Spring MVC webapp.
The reasons I like this approach, you're already migrating code into Java middle tier, so
Already imposing Java server hardware cost on clients, hosting app server / web server is comparable
Already have Java expertise, can be leveraged with DWR
Can use as much/little Javascript as appropriate (I've used DWR with IE6, Firefox 3, Chrome)
I think you're right to be wary of pushing too much functionality to the client, I'd go for as thin a client as possible. The only reason I'd look at the first two stack choices would be if you have some developer expertise in a particular area, and not Java webapp/Javascript.
I'd suggest to create a short list of candidate frameworks and create a small test application with all of them. This way you will get a sense of good and bad aspects from all of them and also get a picture what the community activity and documentation is like for each project (there is a lot of variance on those).If you end up doing this I hope you'll include Vaadin in your short list, I think it would fit you very well. If you have any questions just come over to our forums and we'll help you to get started.

Beginning Google App Engine Java - Which Framework to start with?

I am new to both JAVA and Google App Engine. My Interest in Java stems from its compiled nature, speed and widespread enterprise use, whereas my interest in app engine is mainly because of it's initial free nature along with scalalbility.
I have been through Google's Getting Started and FAQ, I have modified the guestbook app and generally played around with the datastore, creating a simple entry system for use at work, using database schemas similar to the guestbook app. I come from a hackish PHP background, and most of my app consists of JSP pages with HTML and scriptlets mixed, with classes for the datastore stuff.
I have read about JSP, JSTL & JSF(not much) and also the basics of appengine, it's limitations,strengths and quotas. I also understand that my current approach is flawed. I have searched for JAVA frameworks and found one too many. I have been through the Will it play in App Engine list, but I do no half of the stuff mentioned there. I understand that webapp(used in the overview) is a framework and so is GWT. I understand I have to learn core java first.
What framework should I begin with which is easy to use and also robust/secure enough to handle a financial app? The framework should also have value, if I were to host it in a pure J2EE environment independent of App Engine.
I would appreciate a word on study resources too. Currently I see this book on amazon as a resource but are there cheaper alternatives like a library with a monthly subscription from where I can peruse similar books.(and I know that Google is a real good resource.)
Are there any developers here who have apps hosted on appengine java and would like to share their personal experience of appengine java with a beginner?
I use Eclipse with the Google App Engine plugin to develop and upload my apps.
Regardless of what you want to do in Java you absolutely need to learn your way around the core language and the basic part of the runtime library.
The Java Tutorial covers this and is pretty straightforward.
Then you need to learn the Servlet API which underlies almost all Java-based web solutions today. Sun puts this in the full Java EE tutorial (which is a bit heavy) so have a look at this quick overview.
When you have gotten so far, you have a much better idea of what your basic toolbox is, and can give information allowing to give better advice on what technologies you should choose.
Sorry for the steep learning curve, but the view on top is fantastic.
If you aren't doing Java development currently, and/or haven't done much web development. I definitely wouldn't complicate things with adding frameworks.
What are you trying to accomplish that you need a framework for outside of the Google App Engine stack?
I've been developing with Java for years and only started using Spring with my Google App Engine app because I need a good security and authentication option. I wish I didn't have to use it since it's a rather steep learning curve.
You should be able to do most everything you need to for a simple app with JSP. If done correctly you can even do it in MVC if you wish.
On top of everything else people have recommended, I suggest you take a look at Objectify, a much simpler datastore API than the JDO/JPA ones included in the App Engine SDK.
This is, of course, after you've gotten familiar with the core of Java first.

Is it possible to create Desktop Application using Java backend & Web Technologies UI [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 months ago.
Improve this question
I would like to create a desktop application in Java & web technologies. The main reason for selecting Java is that it is free, open source, and hence our investment would be minimal and we would save lots of investment with respect to licensing costs, etc. Also, the main reason for selecting web technologies is because our current programmers are well versed with web technologies like HTMl, css, Ajax, and we have good experience in creating amazing UI in web technologies.
I will give you some idea about the software that we would like to create. It would be a desktop based software, namely something like an ERP software.
The key requirements are that there should be a great UI and it should be fast and not very resource intensive.
I have heard that implementing a great GUI is possible, but difficult in Java. It can be done but is complex, whereas it is pretty simple to do the same in Visual Studio, Microsoft products.
I have also checked Adobe Air, Nokia QT, etc but they all are pretty expensive for us and we are looking for front-end browser UI and backend embedded server/database using java technologies.
Is it possible to create a desktop software in which the UI is created using the web technologies and there is an embedded server (like jetty or tomcat) and database and the backend programming would be in Java. How does JavaFX fit into this?
So basically, the desktop application would have an embedded browser (mozilla or some java browser which can packaged with the software), but the end user should never realize this.
I look forward to getting feedback about the same. Can you please provide some examples of software created in a similar combination of java + web technologies.
I did study some softwares like PulpTunes & Zimbra which were along similar lines, but they seem to be connecting to internet to display data. Our software would be totally an offline desktop application.
First of all, it is possible. If you are looking for example, check http://wiki.eclipse.org/Hudson-ci/Meet_Hudson.
You can get basic architecture if you dig into their code. It does not use any embedded db.
You are saying your application will always be offline, in that case I suggest you to go for pure desktop application using technologies like Eclipse plugin development.
If you already made up your mind, here are some points that can help you based on my experience with similar application,
Although your application is offline(I assume, your application need not connect to any server for any use case but the user machine can access internet ), you need to deliver changes(for example, change in html or jsp page )/bug fixes transparently to end user. JNLP/Java web start is a good fit for this.
If you are going for JNLP way of installing, you launcher should take care of embedded db installation and ports at the end user machine(this is big problem than it appears).
Also if you are launching server(in my case, Jetty) through JNLP, you will come across Class loading errors due to permission issues. Be prepared to dig through server code. I have done it long time ago and I do not have code now to point exact issues.
Show progress bars during installation process and during your application startup. Your war deployment takes some time and user needs some of knowing that application is startup is in progress. You will end up writing some swing UI.
Launch URL of the application automatically in default browser of the user system, after application startup. You do not need embedded browser.Check http://java.sun.com/developer/technicalArticles/J2SE/Desktop/javase6/desktop_api/.
I used MySql as embedded data base. Check Embedding mysql in java desktop application. It worked for me, I did not come across any problems.
Yes, it is possible. See https://github.com/jreznot/electron-java-app demo. There you will find an easy way to build Electron based application on Java, without compilation to JS, just Java application inside of embedded Jetty instance with Vaadin UI.
You are truly right, java is great if you are developing a project by self.
Server side coding can be done using Spring (For MVC, Database etc...Very rich and ligthweight framework, easy to learn and understand) with hibernate(ORM framework for Database handling, provides dialects for any Database server).
For UI, you can use Spring MVC OR JSF OR GWT OR javaFX. JavaFX provides JNLP download, which runs on java and without browser. check the link for more JavaFX samples. http://javafx.com/samples/
So its on you, what you want to use for UI side. If you prefer web UI (Not javaFX i mean) then you can have many options.
For Ajax, you will have libraries which support easy ajax. like DWR (Easy Ajax, JS to JAVA) and many other JS libraries like yahoo, jQuery etc.. can be used.
hope this helps.
IMHO the whole idea of running a web-server just to create a desktop app with js and ajax and stuff is horrible... I heard about Apple-creator Titanium which is allows to create crossplatform apps using web techniques. There are couple other similar programs as well.
I think you'll end up better buying a good wyswing Swing design tool for java ui which will cost you couple hundred bucks but will save you lots and lots development trouble. It is very hard to believe that laying out a nice desktop app is more complicated than laying out a web page.
I didn't get the embedded jetty/tomcat part. You want the desktop app to run an embedded server that talks to the database? So each desktop app would open a DB connection?
Why not have a Java desktop app that sends HTTP requests to a JavaEE server that connects to the DB and processes the requests? So basically, a Java client (which could be as rich as your developers can make it) replacing a browser. This gives you a lot more scalability, etc.
We have a similar (albeit much more complex) product developed using
- Swing + Apache Commons HttpClient on the desktop. This makes an HTTP POST request with serialized binary data to the server.
- A dispatcher servlet running in a web container that recreates the Java object on the server and executes the request.
I will probably get stoned for this, but I suggest JavaFX for this. We have successfully implemented a JavaFX-application for internal use in a larger company. The advantages are that the software is "controlled" on the server side (thus, nobody will have an "old" version). Installation effort is minimal (Java Web Start fixes this for you, it will even trigger a minimal JRE-installation if none exist) and last but not least, JavaFX can be run in the browser and as a pure desktop application alike without having to change the code.
Adobe FLEX is another contender, but it lacks the "Web Start" bit and is not quite as flexible when it comes to easy migration between browser and desktop.
Anyway, JavaFX is not quite feature complete as FLEX but version 1.3 can be considered battle-ready and you can create neat stuff with the free JavaFX plugins for Adobe Creative Suite (if your app will contain any graphics, that is).

What do I need to learn to build a web app in Java? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
I've been doing PHP/MySQL web development for a while and I'm fairly competent in it. Lately however, I've learnt Java and fallen in love with it, and I'd really like to do more Java work now.
I've gotten my first opportunity with a client who needs a web 2.0ish web app built, and he has agreed to let me use anything I want to, including Java. However, I haven't done any web dev. in Java before, I've only went through the official Java tutorial, learnt a bit about applets and build a 2D pacman game, and have done some simple work in Google Web Toolkit.
I need to get started with this project in the next 2-3 days max, so I don't have much time to read long books about the topic. This is what I've learnt so far:
Setup a Tomcat on my dev machine to work with Eclipse
Learnt the basics of servlets, the doPost(), doGet() and init() methods, etc
Built a mini MVC app which displays a HTML page, lets you pick something from a dropdown and when you hit submit, it retrieves your submitted value through request.getParameter() in the doPost() function, and then forwards on to a JSP page which shows which value you picked.
I think these are the next few things I'd need to learn:
How to access/use databases
Sessions and Cookies
Possibly more about the syntax of JSP pages.
There seem to be hundreds of topics about Java web dev which I don't know anything about., but I don't have time to learn everything. I need someone to point out any other crucial things I'd need to learn, in order to build this web app (with perhaps 20 screens) using Java and Google Web Toolkit.
Also, I'm coming from a CodeIgniter background which is an MVC framework in PHP that makes things like form validation, sessions management (it uses database sessions), pagination, and common tasks like these very easy. If there is a similar, lightweight framework in Java that can take care of things like this, please mention it as well.
Thanks.
You should skip basic servlets and use a web framework, from Struts + Tiles (simple to get to grips with - a few hours at most) to Spring, etc. In your case I would also use Hibernate for database abstraction - you don't get up to speed with JDBC in such a short time.
There are so many different Java Enterprise technologies it's pretty hard to know where to start. As previously mentioned, the head first JSP & Servlets book is excellent. I currently work on an Enterprise app that was made years ago with just Servlets. We have migrated over to JSP's as time has gone on but we are not using any of the newer frameworks. So it is for sure a valid way to do it, although dated.
The thing about java, is that most enterprise development is a conjunction of a bunch of different technologies. For example, you could create an app using JSP's for the views with a Servlet back-end, using Hibernate for you DB connections, JDOM for your XML, JUnit for your testing framework, Log4j or AspectJ for your logging framework, Lucene for search, JBoss for deployment (and deployment can be pretty non-trivial) etc. etc. etc. You aren't going to go out and learn all of those technologies in the next 3 days.
What I would suggest is (as previously mentioned) to pick a framework, and there are many to choose from such as Tapestry, JSF, Wicket, Struts, etc. that will abstract away a lot of the underlying technologies. Any java technology you pick will have a good community behind it willing to help.
Another thing to consider, since you seem to be in a hurry to get things working, is that (in my opinion at least) Java is not a FAST language to build things in. It is very verbose and unless you grasp the nuances of good Java web design it is very easy to shoot yourself in the foot. Perhaps you should look at some of the other technologies that are available on the JVM (so that you have all the Java libs available) such as Groovy.
Groovy allows you the ability to program with Java syntax if you choose, or a dynamic Ruby-like syntax. Additionally, Grails is pretty much a Rails clone for Groovy and will let you write a web app in no time at all.
Whatever you choose to do, good luck and welcome to the wonderful world of Java Web Apps.
As a start, I would recommend you pick up Head First Servlets & JSP. It will give you a nice overview of Java web development. From their you would be better able to pick a web framework to use.
I'd recommend Matt Raible's app fuse .
It will give you a crash course in hooking your app up to a database, using a mvc framework, as well as some of the java build tools.
This App fuse demo will show how quickly he gets things rolling.
For basic simple java based web-app follow below things
Install IDE (eg. eclipse,netbeans)
Install web/application server (eg. Tomcat/Jboss)
Configure server in IDE
Create new dynamic web project with JSP/Servlet
learn/develop and run sample applications which includes advance technology like Spring,Struts,Hibernate,EJB etc.
I believe design is more important than technology, so keep learning design patterns. all major frameworks are based on different design pattern.
I would suggest that you try JSP first. JSP is simpler since you don't have to deal with the underlying server technology, not for simple applications atleast. It will get you up to speed. Later, as you gain experience, you can use servlets directly.
It will also fit well with your PHP intuitions.
It's true that starting with Java Web development is not as easy as PHP, especially with CodeIgniter, a framework that I've fallen in love with.
I'd recommend Grails, but first pick up a book on the subject. I've found that in order to get productive quickly you'll need a proper reference. Personally I used The definitive guide to Grails.
I would recommend grabbing a copy of the Servlet 2.5 Specification for reference purposes. It's a fairly nice read, and not too dry for a specification.
It explains about Sessions, Filters, Listeners, threading model, etc...
Also, take a look at the JSP Model 2 architecture (better link) which explains the best use of servlets and JSPs.
I wouldn't recommend looking at Struts or Spring if you only have a few days to get up to speed from scratch. Once you have gained familiarity with servlets and JSPs, then you could look at Spring MVC for an approach that supports easier unit testing for controllers.
You should better learn basic servlet and JSP lifecycles before you touch any framework.. that ll be better, coz you will have a good grasp of the inner workings.. Head First Servlets and JSP is the book you should go for..
I would consider using Groovy on Grails. It's a lot easier to get started and it has a lot of of things that you need built-in. GWT is available via a plugin as is JQuery.
The nice thing about Groovy is that it is basically a superset of Java with the great quick start speed of Rails.
And it will deploy as a .war to your Java EE app server.
I love the Sam's book, 'Teach yourself J2EE in 21 Days'. Awesome for concept reference and basic syntax. Should be pretty cheap by now too.

Categories

Resources