How do I get started building web apps with Java? [closed] - java

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 8 years ago.
Improve this question
I want to start web developing with java. I don't know how to start, what to learn,
or what is the best web framework to learn and use. Help me out?

I assume, that you're only new to web apps and not to Java itself.
For a starter, I can recommend the Apache Wicket framework for the front end. Their web site is full of examples, the mailing lists are a great place to get started, and Wicket in Action was an enjoyable read.
If you want to work with Java Server Pages (JSP), then you should definitely also include Java Server Faces (JSF) which make working with JSPs a lot easier. I can't advocate any good books to you as I went for web tutorials mainly. You might want to have a look at Apache MyFaces.
For the business logik, I guess the standard is Enterprise JavaBeans (EJB). I liked Mastering Enterprise JavaBeans 3.0. An older version of the book is available for free at TheServerSide.com. You should avoid EJB versions older than 3.0, because they are a PITA!
A separate part of the EJB 3.0 specification is the Java Persistence API 1.0 (see, e.g., Apache OpenJPA though the documentation is patchy). Other frameworks that support JPA are, e.g., Spring or JPOX (now being called DataNucleus).
Finally, if you want an application server for testing, there are JBoss by RedHat, SUN's Glassfish and Apache Geronimo (I preferred the last one, but you may have noticed my preference for Apache projects already ;-))
Good luck!

Well if you do not know much about Java, then first I suggest going back and getting your foundation in Java strong first (cause after all JSPs are java code embedded inside HTML), then proceed to learning about servlets and then move on to JSPs.
As far as learning JSPs is concerned, I would suggest buy a book, Head First Servlets and JSP is pretty good book.
Head First Servlets and JSP
JSP Tutorial
Getting Started with Web application - JSP/Servlet

I think Grails is a great way to get started. You can use the scaffolding to get started quickly, which allows you to dip down into the more complex aspects of Java web development at your own pace. I recommend you watch this screencast to see what you think.

This is a big subject and you will need to learn a lot.
I can recommend first learning Java very well.
Head First Java - http://books.google.dk/books?id=5VTBuvfZDyoC
The Java Tutorial - http://java.sun.com/docs/books/tutorial/
You will need to be very proficient in Java, as most framework documentation expect this of you.
When you have those under your belt, you are much better equipped to determine which framework is best for you, as that very much depends on which facilities you actually need, and which you do not have any use for.

The WEB4J tool is likely worth a look.
It has a much smaller number of classes in comparison with other tools. It is "full stack", so it helps you build all parts of your web app. Thus, you don't have to learn several different tools - just one.
A college instructor related to me that he felt it was "almost perfect" for his students, since it was at just the right level, and didn't hide things behind complicated abstractions - it was plain to see how all the parts worked together.

If you know java you can always start reading this book, https://secure.manning.com/books/deshmukh It will give you the basic foundation for java web development.

Related

Why should I learn and use struts? [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 5 years ago.
Improve this question
I'm a java developer, not seasoned, but I am familiar with most concepts reasonably well.
I recently built a website using Tomcat/JSP (~30 dynamic pages). I made the newbie mistake of including large sections of core logic in the JSP, using the rationalization that it's "just a simple project".
I learned the hard way. So I'm re-building the app now in google app engine using servlets and planning to use Velocity to implement it using a Model-View-Controller design pattern.
I'm also looking at Struts, but haven't used the framework before.
Can someone convince me why I should incorporate struts into this project? Is it really going to buy me a lot for a medium sized project of one or two people?
There is a clear cost in an extra learning curve with strut, will the benefits outweigh the costs? Or will the use of Velocity be enough to segregate the logic? Opinions?
I would look longer term than this project. As you saw, first time you use any technology is largely about making mistakes and learning from them. So this first project won't likely be a shining example of Struts usage once you're done.
Using Struts (and Tiles from what you indicate was a main concern: JSP copy and paste) will however be an excellent delve into "proper" MVC, i.e. it forces you to do things in a particularly structured way, and one which I happened to appreciate a lot, I was a big Struts fan.
That said, there are other options, e.g. Spring contains Spring MVC plus much much more. If you're going to invest in overcoming a learning curve, think about which framework will most benefit you overall in the medium term: which frameworks do employers in your area tend to look for, for example? At this point in time, I would go with Spring where I feel the momentum is but Struts is very good at what it does.
If you're going to learn a framework then I'd recommend Spring MVC over Struts. The learning curve isn't too steep and there are lots of Spring resources available on the internet.
Once you've got Spring in place you will find your application is much simpler to maintain and support. You'll also be able to add enhancements, like security, a lot easier.
First: don't let the name confuse you: Struts2 and Struts are very different frameworks.
Second: changing from JSP to Velocity can be a good or bad decisition, but that's not exactly the point. The point is to switch away from Model1 (rather ancient nomenclature, but still useful). That is, decoupling your view layer from your logic layer. (You can use JSP or Velocity for your view layer).
Furthermore, to decide your view layer is just a part of your architecture: you still must decide who will process the request and produce the data that will be sent to the view. The most basic option is to use plain servlets, but, again, it's better to use some framework. For this, there are a lot of frameworks in Java. The "action based" ones are a subset among them, perhaps the most simple to learn. Among them, the oldest is Struts; today the most used for new projects are (in no particular order) Struts2 , Spring MVC and Stripes - they are quite similar.
Learning to separate the logic is excellent. You can do that without using Velocity, Struts or any framework whatsoever, and you'll likely learn more about what it takes to do this separation if you try it with minimal help first.
Learning a framework (in fact multiple frameworks) is also worthwhile, but I wouldn't personally choose Struts as a first framework unless it's the one used by your employer or a prospective employer. If your employer is using Struts, I hope it's Struts 2, as Struts 1 is getting ancient.
The framework I like to work with the most is Wicket, but it's a radical shift from what you're currently looking at. SpringMVC is also definitely worth a look.
If your employer is already doing web development in Java using a framework, try to learn the framework that's actually in use, and ask your co-workers for help learning it.
Why you should learn Struts? My answer is: because employers often require knowledge of it, especially for maintaining of older projects. I didn't make any precise measurements, but I think that at my region JSF and Struts are used for web application development most often.
Struts is a quite old web framework, and it's quite clumsy to write modern AJAX GUIs with it, so there were created better frameworks. JSF is for me a bit less clumsy, but also has some problems. My favourite web frameworks are Vaadin and GWT, but I'm not suggesting anything for you - you should make the decision by yourself.

Please recommend a good Java framework for web development [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I am new to Java framework.
I am looking for a good Java framework to help me build a JSP web site.
I googled for Java framework and it returned a few related terms for me:
struts, Cocoon, WebWork.
I have no clue which of them is for beginning learner.
Do I need to download netBean or eclipse to work along with any of these Java Framework? I need an auto-complete tool that helps when typing hundreds of lines of code.
Please advise and help.
Thanks
Edited reason,
I have just found out that netBean has got Struts Java framework, what do you think of it? Is it good for beginning learner?
The Play framework makes it easier to build Web applications with Java. I havn't tried it though, but I feel it's "with" the present day web-dev framework ecosystem. It seems inspired by Rails.
Very much depends on your concrete needs but I'd invest some time into looking at Spring. It is a really great and flexible framework that promotes best practices.
I admit it will be a bit difficult to understand initially, especially if you're a beginner. But if you're willing to learn it's real fun. For using Spring framework you can use any arbitrary IDE, it really doesn't matter, although personally I prefer the Eclipse IDE, in this special case the Edition for Java EE developers.
As Juri said, Spring is worth looking at. For the specifics of web development, take a look at the Spring MVC tutorial.
Spring is pretty good. Struts is another framework with a pretty easier learning curve IMO.
#kwokwai: I have seen your comment on #Juri post.
Spring IDE would be helpful if you plan to choose Spring for your application.
Grails is my favorite.
While it's not Java the language, it's Java the platform. It compiles to Java bytecode and runs on any appserver / servlet engine. And integrates well with existing Java code.
Grails is more than just a web framework, it's a complete web application stack. But you can use only the web part if you like.
Grails really brings speed of development known to e.g. Rails to the Java platform.
During development, you can edit your controllers and services, and just hit reload in the browser, no redeploy needed (as you also can in The Play framework).
Tag libraries are really easy to create. And being able to write Groovy code rather than EL in the views (GSP, Grails' variant of JSP) is really powerful.
I would recommend Apache Wicket, its very easy, no XML-Configuration-OVerhead. Just have a look a the examples on the website.
Play! Framework. This is by far the easiest one to use. Been a user of Apache Turbine (since 2002), Apache Struts, CakePHP, I finally landed on Play!. You can watch a 10 mins video on http://www.playframework.org/ but here I would like to mention some of my gotchas:
Easy, actually too easy to use. Many people's first impression on Play is it makes web dev become fun again on Java
Scalable. Because of the stateless model, the only thing you need to do to scale your 5 page hello world web app into a million vists per day busy site is to increase your box and running more instance of your app. You don't need to change one line of code to reach there.
Performance. Check this to see how Play! outperforms it's competitors when you use it as a standalone http server
Very active community and very good contributors. The questions you post on Play's google group get answered promptly. And you can find many interesting stuff contributed by community at here
You can also take a look at Spring Roo. It allows you work with Spring in a very lightweight fashion. In terms of ease of use this seems on par with Play framework or even better (due to tools support). Spring itself is a very established application framework and you are very likely to work with it during your professional career.
Although I'm spring user, I would encourage you to look at JBoss Seam. This framework is built on top of other powerful technologies, such as JPA, EJB3 and JSF. You will spent some time learning it of course. And keep in mind, that in order to run its applications, you will need java EE server such as JBoss, not an ordinary servlet container like Tomcat (actually you can run Seam on Tomcat, but you will get into some problems). And java EE hosting costs usually ~two times as much as Tomcat hosting.
Here is the comparison of Spring and Seam:
http://www.andygibson.net/articles/seam_spring_comparison
Just google seam vs spring if you want more details.

Java or Django for Liferay? [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 3 years ago.
Improve this question
I would like to get an opinion what language is better to use with LifeRay. I would like to build some app that I would like to integrate with LifeRay. What language do you suggest would I learn first?
Java? - A friend suggested that Java and LifeRay goes well.
Django? - I recently new this and seen the overview I find this pretty straight forward and I think would be easy for me to learn But I don't know if fits with LifeRay.
Liferay is written in 100% Java.
I don't know if there even exist a portlet in Python/Django. There is a Ruby/Rails bridge for Liferay Portlets http://rails-portlet.rubyforge.org/ , but I would definitely go for Java.
(Liferay) Portlets are based on Java Standards (JSR-268, JSR-186) so Java is the way to go.
Others have already answered that Liferay is a Java application. Let me add that there are definitely numerous ways to utilize other languages to customize liferay.
However, as you ask about what language to learn first be warned that a portal container is not the easiest environment to learn and - in addition to the language - you'll have to learn a great deal about the specifications implemented, the coding style and other used frameworks.
In code size, Liferay is huge. If you start to learn one of the two languages there are two aspects:
Regarding Liferay, support in the forums on www.liferay.com is best in Java, I've rarely seen support for other languages (neither questions nor answers)
Regarding your personal learning curve: If you're working closely together with django folks you might get better support for them in django.
Basically: You have to decide for yourself. Learning a new language and a new framework/server/environment is tough.
There are ways to write JSR compliant portlets in Ruby, PHP and Groovy as well as Java through Portal Pack - you could also run Django through Jython on the app server backing LifeRay and use this to back portlets. I'm not sure how preferable this would be to just doing it in Java though...
I thought Liferay was a Java-based portal product. If Django and Python are an option, I'm not aware of it.
This link suggests that I'm correct.
Liferay does support creating portlets in scripting languages.
Take a look at their wiki for help
I have worked with Liferay DXP with many languages: Java, Kotlin, Scala. Liferay also works with web frameworks like JSF, Lexicon, Groovy, GWT, JQuery, Twitter Bootstrap, Metal.js, React.JS, Angular JS and Angular 2, Node.js, Ruby and special mention Vaadin. Personally I´ve experience in Vaadin and Angular 2.
What I mean is that Liferay (just as develop portal, ant take out any content manager functionality) it is an excellent front integration for different developer teams, you can unified in a single security, look&feel, notification portal (and for the end-user it is seamless).
Django was developed with other objectives like reusability and pluggability, which it does an excellent work. But I don´t see any many Django portals.
So if you are looking to develop a portal using "micro-front" (term for web pages as micro-server is for back systems) using OSGi standard for many different system, go for Liferay. Django is more for monolitic systems.

Is Java suitable for "Web 2.0" applications? [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 8 years ago.
Improve this question
I was chatting to someone the other day who suggested that Rails and PHP are the most suitable platforms for web applications, and to avoid Java. My background is mainly Java, and I know that it is considered by some to be too verbose and "heavyweight", but is used occasionally (e.g. by LinkedIn).
So I'm wondering whether anyone has had success using Java for a recent web application that has gone live, either using the language itself (e.g. with Stripes/Spring + Hibernate), or the runtime with a dymamic language (such as JRuby, Groovy, Jython)? If so, please share what worked and what you would do differently.
Some background (added later):
Tim O'Reilly coined the phrased "Web 2.0" and here is his definition: http://www.oreillynet.com/lpt/a/6228
I think it's the "End of the release cycle" and "Lightweight programming model", involving rapid iterations and simplified deployment, where Java may be less suitable. Thoughts?
I would argue that there is no specific technology for Web 2.0. The main concept behind a Web 2.0 application is that much of the content is provided by it's users and not one specific person. If you can achieve this with Java, then that is fine. Many people are creating startup companies with technology that is free because they don't have the capital.
there are two totally different concepts called 'Web 2.0':
user generated content (usually with some 'social networking')
dynamic AJAX-based web apps
the second one somewhat dictates the technologies that you have to use (at least some JS, and machine-readable content in (some) responses). of course, there's nothing against using Java (or CGI, Perl, whatever) on the server.
the first one doesn't have anything to do with technology, and everything to do with the service itself you're providing. again, you can use anything you want.
why are these two mixed in the same therm? and more to your point: why are dynamic languages assumed 'more appropriate' for it? i'd guess it's just a temporal coincidence, all three things (user-generated content, AJAX, serious dynamic languages) jumped to the limelight roughly at the same time, and most of the proponents of each concept are using the other two.
in short, better avoid undefined marketroid terms like "web 2.0", and use proper descriptions. at least while working. when selling to the VCs and PHBs use any and all buzzwords that come near!
Of course it is. Java has some extremely mature and well tested frameworks for doing web applications, including so called Web 2.0 websites. Hibernate, Spring, even Struts and Tiles, or even Plain Old Servlets will do.
In addition, Java is very fast (see the Debian speed tests) compared to Ruby, which is good for websites handling lots and lots of requests, which Ajax does tend to inflate the number of! :)
Your friends, with all due respect, are dolts. Java is a rich language with incredible tools support. You could build a fantastic backend in Java and use anything you want for the front end.
It took me a while to figure out what to say in this answer because I was agape at the sheer craziness of the notion.
Where I work, all our applications are built using Java. They are web apps, built using either hibernate or direct JDBC on the data end, and using Struts or JSF for the presentation side. I would not work with JSF again unless we had access to the latest version (we were stuck on 1.0 because of our IDE) as we encountered MANY issues with it and were told that they had been fixed in later versions. As for the rest of the technologies, they work fine if you know how to use them.
In general, you are going to be better off developing in a language you know well and is capable of doing the job than in one you barely know but may be the "best" language for the job.
"Web 2.0" more often than not refers to the user interface than the underlying technology powering the webapp.
What's stopping a Java-based webapp from being totally flashy and AJAX-y in the UI layer? Nothing. You'll be writing the middle layers in Java - which is transparent to the user anyway.
I think that the people who gave you this advice are more concerned about being "hip" and (what they perceive to be) current with what is "hot" right now - which is totally irrelevant to the markup of your UI. I wouldn't listen to them.
Wonderful day, I get to post about Wicket again! :)
Java is very suitable for Web2.0 applications as long as you know how to use the tools which are available for you. The Apache Wicket I just linked is a POJO-based web application framework with such incredible way to hide all that boring server-client stuff that it allows you to do just about anything you can think of. The strong point here is that since Wicket is just POJOs, you can get very fast, iterative and unit tested code that works just as one would expect in browser.
To create Web2.0 sites with Java you don't of course have to use Wicket but I'd recommend it anyway.
I build Web apps at work in Java and then I use PHP for my personal projects. While Java is certainly capable of all that you might require it to do, I've found it a little cumbersome at times and have wished I was using PHP (or another language, for that matter). It does depend on what type and size of application you're building, but I think there are good reasons why many people choose PHP, Ruby and Python for their personal projects, i.e. where they get to choose what language they build Web apps in (and not their superiors).

What would you use to build a web app? [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 5 years ago.
Improve this question
At my current job I've been working on making web apps with Java, Tapestry, Hibernate, MSSQL, and Tomcat.
I've got an idea for a little web game I'd like to write. I'd like to know what the SO community would use for something like this.
Should I stick to what I know? I was thinking it would be very beneficial for me to learn different languages and frameworks. Any suggestions?
If its a personal project then take this as an opportunity to learn something new.
Spring Framework using Spring MVC 3.0
I recommend learning something new because even if your idea is a failure, at least you learned some new technology out of it.
I can suggest Grails as it is a modern and easy to use RAD Web-Framework, has a small learning curve and is proven to be scaleable.
It builds upon Spring MVC, Hibernate and other sophisticated frameworks and merges them with the dynamic nature of Groovy (dynamic language for the JVM) into a full-stack webframework. It follows modern principles like CoC (Convention over Configuration) and DRY (Don't repeat yourself). You can deploy the applications straightforward as .war file in tomcat or any other servlet container or applications server.
My recommendation would be to see what you could do with a combination of Google App Engine, Django, and JavaFX.
In doing so, you'd learn some new technologies (App Engine) and languages (Python for Django, JavaFX) while taking advantage of what you already know about web apps and Java.
I'd pick Haxe.
Haxe (pronounced as hex) is an open source programming language
While most other languages are bound to their own platform (Java to the JVM, C# to .Net, ActionScript to the Flash Player), Haxe is a multiplatform language.
It means that you can use Haxe to target the following platforms : Javascript, Flash, NekoVM, PHP, C++, C# and Java
If your thinking about an online game like a RPG or card game I might be selfish and suggest you have a look at Project Darkstar and let us know how you got on. I've been trying to get started with it and cannot get it up running in my environment.
PHP and MySQL is an easy place to start for web apps. Your ISP will support it and there are tons of tutorials on the web.
Once you have got the hang of it, take a look at MVC architecture. It's a way of structuring web apps.
Personally I'd then recommend looking at CodeIgniter.
However a game is a different matter, maybe try Flash?
If you want to improve your skills push what you already know. If you want to learn new languages and ways of doing things, then look at alternative technologies and stacks.
It all depends on what your goals are...

Categories

Resources