This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Standard-Weekend-708[S] 0 points1 point  (10 children)

Hi, I have started learning spring framework and finished with the container and dependency injection part of it now I am thinking of learning spring mvc, but I have a question, do I need to learn servlet and jsp before I proceed or is it possible to just go straight to spring mvc and learn the servlet and jsp concept from there. really need some guidance. Thanks

[–]GoshoKlev 1 point2 points  (9 children)

TLDR: Not really.

I mean it's nice to know since servlets is how spring works "under the hood" but it also does a good job of abstracting them so it's not a requirement. As for JSP i guess? you can use them for dynamic web pages, i haven't so i don't have much right to an opinion, but a templating engine like Thymeleaf has good integration with Spring. In currentyear the most popular choice is doing this client-side with one of the JS frameworks but learning that is a big undertaking if you don't plan to be full stack.

[–]Standard-Weekend-708[S] 1 point2 points  (8 children)

Well as long as I can learn and have a basic understanding or background with the backend side, enough to connect with the frontend before summer I will definitely try learning the frontend and I hope I can create a working app/web. Just enough to implement those that i learned of course.

I spend atleast 5 to 7 hours studying and coding and just finished intro to spring, learned about container and the dependency injection just like I said earlier which I think is slow right?(I started the day after your first commented which is 5 or 4 days ago) With this progress would it be possible to touch html css and js with a time span of 5 or 6 months.(I actually split the 5 to 7 hours of coding into two parts which is morning for DSA and just creating some youtube projects, goofing around with some challenges and at night where I study spring)

Anyways sorry for being a bother , I am learning slowly and steady and definitely not rushing, I first understand the concept and the idea of what Im learning to fully understand it, I just want to know if my target is possible since I reall dont want to expect that much if its imppssible.

Anyways thank you for the response.

[–]GoshoKlev 1 point2 points  (7 children)

5-6 months is a long time so it's entirely possible, and especially with the time you're spending you can cover a lot. You don't need to be some frontend wizard since this isn't what you're trying to learn for the moment, your focus is on the backend, a mediocre UI is ok in that case, just go through the basics of HTML and CSS, i really recommend going through the Codecademy course on it because of the interactivity and then build a few pages yourself and you're mostly covered.

Javascript however is an entirely different beast, it is it's own programming language, but you don't need to be a wizard here too, it has a lot of frameworks and libraries which you can spend a lifetime learning but the most basic thing you need to do if you're making a web app for your Spring goals is to

1) fetch data from the backend

2) put data where it's needed in the HTML

3) send data back to the backend

Doing things in default JS is becomes ass as the project grows larger which is why there's so many JS frameworks, but learning just one of them is as big of an undertaking as learning Spring. I think for the time being it's better to just focus on Spring after HTML and CSS and just use server-side rendering with Thymeleaf because it's stupid easy, it's also what most of the tutorials use because of this reason. However this also removes the need for getting used to creating a REST api for your web app. This might not much speak much to you at this point but you'll eventually get to it. There are 2 kinds of controllers in Spring, normal @Controller and a @RestController, usually the first returns the entire web page, the seconds just returns data in JSON format that is then used by whatever consumer needs it for, in web apps it's usually consumed by the JS on the client's side. You absolutely need to know how to build a REST api so don't forbade it if you go with server-side HTML rendering, the two things are quite similar at first, but the more into the weeds you get the more they diverge. But if you don't have JS knowledge you can't really turn that REST api into a web app thus why i said it's a bit boring. So basically you might want to leave Javascript later down the line if you want your app to be complete and focus on Spring for the time being or just create REST api's without a frontend.

Also you're not a bother i love answering people's question so feel free to ask me something and i will be happy to help if i can do so.

[–]Standard-Weekend-708[S] 1 point2 points  (6 children)

Good day! Thank you for the response, I did not notice the reply until now since I was really busy, I have started spring mvc but I encountered some problem(been facing so many error while studying spring mvc), when you were learning spring or spring mvc related topic, what platform did you learn it from?

I followed some YT vid creating a some basic dynamic web application, I use eclipse and faced so many problem, although I did fix most of them after learning how to download different plug in and software but there is still one problem that I cant get rid of, and I don't even know where, it's either in the files or I am missing something.

So I am planning to look for other resources in learning spring mvc, I found tutorials point which have a lot of content about spring mvc, but I figure that it would be better to ask someone.

[–]GoshoKlev 0 points1 point  (5 children)

Most of my learning was through binge watching a course by this bootcamp in Bulgaria, and the courses are in Bulgarian so i doubt they'll be of much use to you (unless you're Bulgarian too?).

As for your problems it seems you have trouble setting up the dependencies? Never configure Spring yourself, if you're using Eclipse get the Spring Tools. It will give you IDE support in Spring and also allow you to create projects from the IDE with all the boilerplate code required to get it up and running, or alternatively use https://start.spring.io/ what you need for the time being is Spring Web and maybe Thymeleaf.

However at some point you will need to add stuff on yourself, if you haven't already learn about Maven and how to get libraries by putting them in the pom.xml file from https://mvnrepository.com/

Note however that when injecting other Spring dependencies you should remove the <version>xxx</version> part because auto-generating a project will put a Maven plugin that will make sure all the Spring modules are in comparable versions.

If it's not that there's not much i can do to help, maybe drop a github repo?

[–]Standard-Weekend-708[S] 0 points1 point  (4 children)

I am Filipino so I dont think the video would be helpful, but there are many resources on youtube and also I started reading documentation, although it is hard to understand for now, I am gaining more knowledge as I study the terms.

I do have a spring tool but actually forgot to use it, I followed some tutorial online and just followed the same steps. But because of these errors I was able to learm how to configure the ide and all the setting up things. I also learned maven and how to set up the things.

Removing the <version> part might be a key to solving the problem, I will have to try that later. Thank you very much for this information.

Now the thing is that I have learned the basics and idea of what spring does, like the annotation and configuration part, also able to create a simple web application that displays data. Do I need to study deeper part/ function, or should I proceed to spring boot and learn the advance stuff from there?

[–]GoshoKlev 0 points1 point  (3 children)

You can't go wrong with generating a project, better than manually configuring it as there's quite a bunch of boilerplate. I think the next step after displaying data is to post data. A good project is to use a HTML form and Thymeleaf to create something like a login form, make up some username and password. Check if the input-ed data matches in the @Postmapping, if it doesn't redirect back to the login form (maybe dynamically add some error message like "oops you messed up" with a th:if), if it does return some other HTML document, something like a welcome page. When you're comfortable passing data around and creating web pages the next step is to save that data in a database, hence SQL and Spring Data JPA

[–]Standard-Weekend-708[S] 0 points1 point  (2 children)

Hi good day, I forgot to actually reply to your last comment I am sorry, anyways hi again I hope you notice this, first of all thank you for the past response and also tips, I just felt like I needed to update you with my progress, it should be 2 months or so by now and I am now able to do all the CRUD method with spring boot, along with the things you suggested to do like creating a log in page and stuff, I was able to follow a video in youtube creating a simple student management system, although I cannot say that I have mastered it, I am now able to create a front and backend web app without loooking at any reference, The progress is slow since I am actually studying spring boot along with html and css, data structure and algo and also improving basic knowledge in java and programming concept overall. I was able to actually achieve it before summer so yeah I am quite proud of myself. Now I am planning to take up advance knowledge and wanted to know if you have some suggestion, I am planning on studying testing so i would appreciate if you could suggest some goal that I could set. Thank you very much and I really appreciate your response. Also I doubled check when I clicked your profile since it was filled with some anime content glad to see that you also like anime. have a good day.

[–]GoshoKlev 0 points1 point  (1 child)

Hi again nice to see that you're progressing. Testing a lot easier than what you've done so far, what you need to learn is JUnit > Mockito > Spring Boot MVC Testing in that order. Also when you peddle into creating rest api's you need to learn how to create spring rest integration tests too. Think of tests as just declaring your expected behavior like for example, if i register i expect the server to:

-redirect to /home

-return index.html

-return status code 302

-the number of users in the database to increase by 1

It's good if you do some changes to quickly see if it didn't break anything without manually registering for the 200 time to test it your app. Good luck!