Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to use both JSP and Servlets in an application

 
Sunny Raj
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it possible to use both JSPs and Servlets in developing a single application? Call Servlets from JSPs?
I am fairly new to server-side programming and I was looking for tutorials on this subject but have been unsuccessful so far. Can anyone help?
Thanks.
 
Pradeep bhatt
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is possible to call servlets from JSP and vice-versa. For tutorial on servlets visit http://java.sun.com/docs/books/tutorial/servlets/ and http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/Servlets.html.
For JSP http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/JSPIntro.html.
 
Gagan Indus
Ranch Hand
Posts: 346
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Links at this page might help too :
http://www.javaranch.com/scwcdlinks.jsp
 
Jessica Sant
Sheriff
Posts: 4313
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And two more resources.... check out Core Servlets and JavaServer Pages by Marty Hall -- it's available online. It covers the Servlet 2.2 and JSP 1.1 specifications.
More Servlets and JavaServer Pages by Mary Hall is the follow-upbook which covers the Servlet 2.3 and JSP 1.2 specifications.
Both are excellent books.
 
Darryl Failla
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the information. You always learn something when you visit the Ranch.
 
Angela Margot
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Marty's tutorial on Servlets is at:
http://www.apl.jhu.edu/~hall/java/Servlet-Tutorial/
And yup, you can implement servlets in JSP!
 
arun sahni
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
After learning you can use MVC framework like Struts to make life easier.
 
Sunny Raj
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for all the information. So far, it is only in the "Core Servlets..." book by Marty Hall that I noticed a chapter on "Integrating JSPs and Servlets". While I am waiting to get this book, can someone give me a quick example of how a Servlet can be called from a JSP? I know how to call beans and XML parsing and SAX etc.
Thanks.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic