4

So i want to create my first web application. But there is simply too mush choose to know where to start i keep jumping from one thing to another.

The first thing is which ide should i use:

  • is one better for web development than another or is it just personal choice?

Currently i'm using netbeans and i can see that all the samples are using glassfish.

  • Should i use glassfish first? or should i look at tomcat, jboss,...
  • When i use a glassfish example and switch to tomcat server some classes are not recognized anymore. Does every server has it own classes ?
  • When i followed a spring tutorial it used tomcat but can it also be used with glassfish ?
  • Is there a big difference in cost between servers ?

What about jsp or servlets

  • a lot of examples use jsp some other prefer servlets what is still used nowdays ??
  • i also came across some websites where they prefer freemarker instead of jsp / servlets but is it not better to learn to work with jsp and servlets ?

And what about frameworks

  • is it better to use frameworks like spring to begin with as beginner or not ?

And build tools

  • Should i use build tools like maven,ant ,gradle ? or would it be overkill in the learning curve ?

And how are java web application stored on servers ?

  • I now normal website with html css and js you just need to drag all the files to the server and it is working. But what about java webapplication does it works the same way ?

All i want to do is start simple and build up from there. But i really need some directions on whats best to learn first and why.

Jordi Castilla
  • 26,609
  • 8
  • 70
  • 109
Greg
  • 1,690
  • 4
  • 26
  • 52
  • 3
    Java has a huge and diverse ecosystem. And you're about to experiment how that translates into a very diverse set of answers as well :) – sstan Jun 12 '15 at 12:36
  • This is an impossible question to answer - it's mostly opinion based. I'd start by picking a book or tutorial, and following it to the letter. If you're following a Spring tutorial that has been tested on Tomcat, follow that - you need to learn about Spring, not servlet containers. You'll need to read a few books, and follow a bunch of tutorials, and then you can make your own choices. – Neville Kuyt Jun 12 '15 at 13:04

4 Answers4

3

May be a too broad question, but to keep it simple:

If is your first app but is not only a little test:

Frameworks

Server

Database

Readings & Tutorials

Jordi Castilla
  • 26,609
  • 8
  • 70
  • 109
1

There is no universal answer, it all depends on your needs.

If you're already familiar with a Java IDE, you should probably stick with it, NetBeans sure will be sufficient for EE development.

For servers you should look at one issue:
If you need more than the web profile of Java EE (Java EE 6 Web profile vs Java EE 6 Full Platform), you need an application server like Glassfish or JBoss(WildFly), as Tomcat doesn't ship with the full Java EE profile. Otherwise you should find enough documentation on any of them. I personally use JBoss 7.x / WildFly 8 and never had an unsalvageable problem.

Both Servlets and JSP are already a bit oldfashioned, I would recommend JSF, if you want to build a larger application with clean code separation. But knowing the basics of Servlets or JSP helps with beginning JSF.

As of Java EE 6 / 7 I recommend sticking to the standards. E.g. using CDI or EJBs instead of Spring and just use standard JPA, that way you can always change your JPA-Provider or Webserver without many code changes, if you're experiencing some troubles. Hibernate is a good choice for JPA, but EclipseLink may do great as well.
If you do that, most of your code will be independent from your chosen server. What remains is configuration, which differs from server to server, but is only needed at the beginning in most cases.

Build and dependency management tools like Maven help a lot, but are not mandatory for the beginning. Note: They may require a special directory stucture, so it's better to start with a skeleton project.

As to how to deploy web applications, you normally package them (for example as WAR - Web Application Archive) and then drop them in your server's deploment folder.

Community
  • 1
  • 1
Zhedar
  • 3,480
  • 1
  • 21
  • 44
  • Great answer now i have some kind of direction where to start. And what is should learn first. But one question on your post. When do you need more than just the web profile. – Greg Jun 12 '15 at 13:09
  • Possibly, If you need some of the features, that aren't in the web profile: http://stackoverflow.com/questions/24239978/java-ee-6-web-profile-vs-java-ee-6-full-platform – Zhedar Jun 12 '15 at 13:14
  • Again thanks for your time and this answer. I really learned alot from this. – Greg Jun 12 '15 at 13:18
  • You should note, that this is really opinion based. But if you're starting with it as of today I can fully recommend using the provided standards, as they're kind of grown up. – Zhedar Jun 12 '15 at 13:21
0

To keep it simple to start and slowly to digest, I would recommend basic hello world web application using Spring Web MVC, Netbeans as IDE, Tomcat 7 as your server.

then you can jump on to Database integrations and then explore on hibernate. For database you can use MySQL.

Related links:

Community
  • 1
  • 1
Raj Pandiri
  • 111
  • 1
  • 1
-1

Vaadin

An alternative route to being a Java-based web app developer is to use Vaadin.

Comes in two editions:

  • A Java-based server-side web app framework (for Java programmers)
  • Web Components-compatible pieces (for JavaScript programmers)

The first is for Java-savvy developers who want to develop professional-looking sophisticated "single-page" web apps without having to know about the web technologies (HTTP, HTML, CSS, DOM, JavaScript, Ajax, Comet, Push, WebSocket, and so on). All those web-standards technologies are used at runtime, but behind-the-scenes, transparent to you as a Java programmer.

With Vaadin, the Java developer says “I want a layout to hold some widgets on screen, and those widgets should be this button, that button, a couple of text fields with labels, and a data grid.”. Vaadin automatically, at runtime, generates the necessary HTML+CSS+JavaScript+etc. to render that UI remotely on the client (any common web browser).

When a user clicks one of those buttons, or types in one of those fields, your Java code running on the server-side is automatically notified of that event. Your code can react by running business logic, saving data to a database, connecting to a web service or other data source/sink… all executing on the server-side without any involvement of the client/browser.

Vaadin is implemented internally as a Java Servlet. It runs on any web container with Servlet technology, such as Apache Tomcat and Eclipse Jetty. You may choose to selectively add libraries from Java EE to that container. Or you may choose to use a full-blown Java EE server such as Glassfish. If you like CDI/Spring, Vaadin can work with that too.

Basil Bourque
  • 303,325
  • 100
  • 852
  • 1,154