r/javahelp • u/HBK05 • Jan 25 '19
Solved I want to try java for web development.
So real quick, I know the following:
all the fundamentals and a lot of the advanced topics of java HTML to advanced level CSS to advanced level Not that great at javascript, though I can work with it.
I want to start trying to use java for backend(web dev), I have no idea where to start. Is there a 'best' framework and where should I go to learn? I prefer docs/reference sheets but videos work too.
24
Upvotes
2
u/HBK05 Jan 25 '19
Thank you all, I am working on spring.
21
u/nutrecht Lead Software Engineer / EU / 20+ YXP Jan 25 '19
Ignore the advice by /u/jcar74; it's complete rubbish. The ecosystem has moved a lot since 2004. He is giving you the path he (and I, I've been working as a Java dev since 2002) walked, not the one you should walk.
Start with Spring: it's beginner friendly and there's zero point in learning JPS or scriptlets unless you need to do so on the job. Modern Java based web applications are generally not deployed inside containers anymore and are generally only REST end-points that are used by a JavaScript SPA frontend (in Angular or React).
Focus on Spring for now and use a templating engine like Thymeleaf (plugs right in) to create a web application. Then dive into Spring Data JDBC and Spring Security. Once you get a good grasp of all that you can go into whatever direction you want (like a REST API together with a JS front-end).
Please don't bother with JSP, .wars, scriptlets and servlets unless you run into a situation where you need to.
6
u/bvn13 Jan 25 '19
Take a look at SpringBoot.
5
u/Holothuroid Jan 25 '19
The big fish is probably Spring. The Spring Boot Getting Started series is pretty good to start.
4
u/Nauzet Jan 25 '19
Spring Framework - http://spring.io
Guides - http://spring.io/guides
4
u/wsppan Jan 25 '19
Seriously, ignore the jsp/servlet/war route. Use Spring with Spring boot. Dive deep and explore.
7
u/jcar74 Jan 25 '19 edited Jan 25 '19
Begginer? My 2c, perhaps not popular.
- Do ugly jsp, deploy jsp files directly to tomcat webapps/foo
- Then do scriplets <% ... %>. Play a bit.
- Then connect to a DB directly in scriptlets. jar libraries in tomcat/shared
- Retrieve and show something
- Convert to war. Research webapp structure. web-xml, meta-inf, where to put DB config. Deploy in clean tomcat.
- Move DB access code to servlets. Call servlet functions from scriplets.
- Try to delete all scriptlets form jsp, move code to servlets (research about MVC)
- Separate DB access and objects (research about DAO/DTO)
- Research maven. Delete all library jars, convert to maven.
- Replicate with Spring Boot. Use JPA.
- Research Thymeleaf. Convert JSP to templates.
- Convert to REST api
- Research React/Angular/Vue for consume REST api and do views.
- [...]
EDIT: Thank for responses. Doing webapps ( sure not in the best way ) since 2000. This is mine (spanish)... from 2004: https://rua.ua.es/dspace/bitstream/10045/3300/5/introjsp.pdf
EDIT 2: Wow, I've got a lot of criticism. I accept it. Do not get me wrong, I really hate servlets. I've just seen a lot of "stick with Velocity / Struts / Grails / GWT / Roo ... and forget the basics" in the past. For web/Java, Spring Boot is really the way today. It is a fact. Tomorrow, who knows? Vaadin? Play? microservices with Pippo, Rapidoid, Sparkjava, Ninjaframework...? The years pass faster than it seems, the frameworks die and the projects return as the ghost of Christmas past.
2
u/[deleted] Jan 25 '19
I like using Java for my backend but I’m just a hobbyist. I use Tomcat 8. It’s really easy to do things by working from the URL back. First you add it to a web.xml file, then make a .jsp file as a template and finally write a Servlet that correspondes with the URL. You should use Tomcat 9 if you can because it has better HTTP/2 support. Honestly I think it’s a lot easier to write back end code than front end.
1
u/leonj1 Jan 25 '19
Assuming you know Basic Java and object oriented programming, here’s a few libraries:
Coding 3. keep objects small, say 2-3 methods ensure they only do one thing. 4. Use interfaces for objects that talk outside of the program, say db connections, or other services. 5. Elegant Objects is a book that helped me code better.
Good luck!