Win a copy of Head First Android this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

How to use both JSP and Servlets in an application

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 8944
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 346
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Links at this page might help too :
http://www.javaranch.com/scwcdlinks.jsp
 
Sheriff
Posts: 4313
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the information. You always learn something when you visit the Ranch.
 
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic