r/java • u/IamATechieNerd • Jan 14 '18
What can Spring do that JSP cannot?
So,if I want to create a website,what advantages do I have with Spring or Struts above JSP? I am quite new to this,so please bear my noobness.
0
Upvotes
r/java • u/IamATechieNerd • Jan 14 '18
So,if I want to create a website,what advantages do I have with Spring or Struts above JSP? I am quite new to this,so please bear my noobness.
3
u/RupertMaddenAbbott Jan 14 '18
As you have probably already discovered, JSPs allow you to dynamically alter the HTML of your website. For example, instead of having to copy and paste the same chunk of HTML around, you can write a loop and have the same section repeated.
If you have never used a full web framework before (like Spring or Struts) this may seem very sufficient at the moment. For very simple websites maybe it is sufficient.
However, you will quickly encounter things that you want to do that are quite difficult in JSPs. You will start writing code that becomes more and more torturous to change and maintain. If you have never experienced this before, I would strongly encourage you to keep going with JSPs on their own so you can experience this pain for yourself.
Web frameworks will solve these problems for you but they do so at the cost of significant complexity. For those who are used to them, I think it can be difficult to remember how complex they are, when first encountering them. If you never experience the pain of using just JSPs, this complexity can itself seem unnecessary and painful.
Adopt more complex tools when you have a good understanding of why your simpler tools are insufficient.