SCJP 1.6(91%), SCWCD 1.5(100%), SCBCD in progress
Pat Farrell wrote:In the olden days, one had to write servlets ... So modern code has a JSP page with EL and a Java Bean.
Gaurav Sagar wrote:Most important of all, the servlets are not only to be used in web-applications. You could very well extend the GenericServlet class and create a servlet which say, adds functionality to an email server on smtp.
Conclusion: Its not just HTTP the servlets are used (HttpServlet is a customized servlet for HTTP), they could be well used in for a server application running at SMTP, FTP, etc.
The secret of how to be miserable is to constantly expect things are going to happen the way that they are "supposed" to happen.
You can have faith, which carries the understanding that you may be disappointed. Then there's being a willfully-blind idiot, which virtually guarantees it.
Tim Holloway wrote:Almost invariably there's a servelet (or servlets) at the heart of the framework.
Pat Farrell wrote:
Tim Holloway wrote:Almost invariably there's a servelet (or servlets) at the heart of the framework.
Of course, there are servlets under the covers, but with these frameworks, the application developer does not write servlets. All that stuff is just technical plumbing.
The secret of how to be miserable is to constantly expect things are going to happen the way that they are "supposed" to happen.
You can have faith, which carries the understanding that you may be disappointed. Then there's being a willfully-blind idiot, which virtually guarantees it.
Tim Holloway wrote:Then again, the original question was about unadorned JSPs versus unadorned servlets.
Pat Farrell wrote:
Tim Holloway wrote:Almost invariably there's a servelet (or servlets) at the heart of the framework.
...but with these frameworks, the application developer does not write servlets...
Thanks, leo
leo donahue wrote:
Pat Farrell wrote:
Tim Holloway wrote:Almost invariably there's a servelet (or servlets) at the heart of the framework.
...but with these frameworks, the application developer does not write servlets...
Pat, not to divert this thread or incite a riot, I disagree. What about Listeners? What about Filters?
Thanks, leo
A servlet is a JavaTM technology-based Web component, managed by a container,
that generates dynamic content.
Thanks, leo
Bear Bibeault wrote:You're just being argumentative. Filters and listeners do not extend any Servlet base class and are not considered servlets.
Thanks, leo
All servlets implement the Servlet interface, or extend a class that implements the Servlet Interface
Bear Bibeault wrote:That's a description, not a definition.
Bear Bibeault wrote:If you take it as a definition, a PHP file is a "servlet".Anything that doesn't extend HttpServlet (or more recently, SipServlet) isn't a servlet.
Thanks, leo
Thanks & Regards
Sidharth Pallai
leo donahue wrote:
Bear Bibeault wrote:That's a description, not a definition.
That is your opinon, and I am the only one in this thread so far citing a source, without which we wouldn't be having this conversation.
leo donahue wrote:That is your opinon, and I am the only one in this thread so far citing a source, without which we wouldn't be having this conversation.
JSPs are only for generating HTML. Modern JSPs should have no Java code or scriptlets within them. Processing and control belong in Java classes such as servlets. Putting anything but view in a JSP is an extremely poor practice.
Spencer Fingleton wrote:What is the point in servelts if we can use JSP's? Can someone give me examples of when you would use a servlet rather than a jsp page?
Spencer
Everything has got its own deadline including one's EGO!
[CodeBarn] [Java Concepts-easily] [Corey's articles] [SCJP-SUN] [Servlet Examples] [Java Beginners FAQ] [Sun-Java Tutorials] [Java Coding Guidelines]
Spencer Fingleton wrote:What is the point in servelts if we can use JSP's? Can someone give me examples of when you would use a servlet rather than a jsp page?
Spencer
Glenn Murray
Author of Yo Soy Una Vaca De Hoy
Spencer Fingleton wrote:What is the point in servelts if we can use JSP's? Can someone give me examples of when you would use a servlet rather than a jsp page?
Spencer
Won Cho wrote: It's best to use both for what it was intended for...
Then again, using Servlet & JSP is 10 years ago...
you should consider using MVC frameworks.
My material for SCJP (2008), SCWCD (2010), SCBCD (2010). About me
T. Huy Nguyen wrote:I rarely write servlet, but I still write lots of JSPs. They are very handy, easy to use, rich collection of JSP tags (and is backed by a well known certification program
). I can't see why it is "10 years ago".
Won Cho wrote:I should've said servlet ^_^
Won Cho wrote:
One of my favorite instructor told me this phrase.
If your JSP file starts to look like Java, then it should be Servlet.
If your Servlet starts to look like HTML, then it should be JSP.
As 100 others pointed out...accurate response would be to use Servlets to do business logic and use JSP for view. So they really go together like peanut butter and jelly. It's best to use both for what it was intended for... Then again, using Servlet & JSP is 10 years ago... you should consider using MVC frameworks.
SCJP 6
FrankW Brown wrote:...Also, I would generalize, and say a JSP is intended to simplify creating not just HTML, but XML as well, or any kind of markup. One could conceivably use JSP to output CSV or even JSON. (some might say there are better ways to convert beans to xml or json, and I wouldn't disagree)...
Villains always have antidotes. They're funny that way. Here's an antidote disguised as a tiny ad:
Low Tech Laboratory
https://www.kickstarter.com/projects/paulwheaton/low-tech-0
|