• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

A beginner question - JSP and Servlets - when to use and when not to use ?

 
Andy Jack
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I want to create a website like this forum would JSP and Servlets be good for the job ? Should I use something else ? How do i decide if JSP and Servlets are the right tool for the problem at hand ?
Please advise.

 
Raghvendra Pratap Singh
Greenhorn
Posts: 22
Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I want to create a website like this forum would JSP and Servlets be good for the job ? Should I use something else ? How do i decide if JSP and Servlets are the right tool for the problem at hand ?
Please advise.


I think if you are planning a website like this forum where you need complete MVC architecture , you need database connectivity, you need authentication, you need security of your data so i willl advise you that you should use some framework like Spring with hibernate, Only JSP and Servlet will not be sufficient without any framework. Also management of your code will be easy if you will use any framework.
 
J. Kevin Robbins
Bartender
Posts: 1745
19
Chrome Firefox Browser jQuery Linux MySQL Database Netbeans IDE
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I must respectfully disagree. I'm of the opinion that beginners should not use frameworks until they have a thorough understanding of exactly what that framework is doing for them. Otherwise they end up using the framework as a crutch and they don't even understand the resulting code.

The OP would be better served to learn to write a MVC application using servlet controllers, DAO's, and DTO's, before even cracking a book on Spring or Hibernate.

The only exception to this rule that I would support would be using the jQuery framework to assist in writing Javascript.

That's just my two cents worth...
 
Andy Jack
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jk Robbins wrote:I must respectfully disagree. I'm of the opinion that beginners should not use frameworks until they have a thorough understanding of exactly what that framework is doing for them. Otherwise they end up using the framework as a crutch and they don't even understand the resulting code.

The OP would be better served to learn to write a MVC application using servlet controllers, DAO's, and DTO's, before even cracking a book on Spring or Hibernate.

The only exception to this rule that I would support would be using the jQuery framework to assist in writing Javascript.

That's just my two cents worth...


Yeah. Bear also used to tell me that JSP and Servlets are important.
 
Hikari Shidou
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I suggest you to just use a CMS. It's not worthy developing a new software when there are so many many forum engines out there.

Just search for them, test them to see which has the features you want, and take a look on their license to be sure you can use them.

If there's some feature they don't have and you need, you'll just have to learn their API and develop plugin.
 
Andy Jack
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hikari Shidou wrote:I suggest you to just use a CMS. It's not worthy developing a new software when there are so many many forum engines out there.

Just search for them, test them to see which has the features you want, and take a look on their license to be sure you can use them.

If there's some feature they don't have and you need, you'll just have to learn their API and develop plugin.


No, i wanted to learn the nuts and bolts of software development. I don't want to make a new forum for others. As you mentioned, there are plenty of tools for that already.
 
Hikari Shidou
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well in that case, for sure Servlet+JSP is adequate.

But PHP has advantages that makes it better IMO
 
Andy Jack
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hikari Shidou wrote:Well in that case, for sure Servlet+JSP is adequate.

But PHP has advantages that makes it better IMO


Why do you say that PHP makes it better ? What does PHP do for me that JSP and Servlets cannot ?

 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64724
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It'd be best to ask about PHP in a new topic in the PHP forum, unless you would like this post moved to the PHP forum?
 
Hikari Shidou
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No need to move. He asked if Servlet is adequate and I cited PHP as alternative, that's all.

Answering the question, it's the contrary, pratically everything we can do in PHP we can do better with Java+Servlet+JSP. The only thing PHP can do and Servlet can't, is run each pageload on different unix user. That's great for shared hosting. For simple web apps that don't receive many hits, it's also good that the whole app is loaded on every (rare) pageload and frees all resources after, but once web app gets more complex and receives hits, that's a big trouble that makes hard for PHP to scale.

In the case of a web app that basically loads/stores data in DB and builds HTML documents, PHP is better because it requires less code to get things done. Java requires creating beans (in PHP just use arrays and add them anything on the run), use MVC, it's DAMN hard to test (deploy, stop tomcat, delete folder, start tomcat, reload... in PHP you just edit the file directly inside hosting folder [files of course managed by SVN and commited all the time], reload and it's there, with session still working!). PHP has a lot of built-in features that Java requires external libs, etc.

If the web app has little business logic to put in controller, MVC becomes a burden, and PHP is way way better than JSP.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic