• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JSP/Servlet library for standalone application?

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
I don't know much about JSP and Servlets but was wondering if a package which is intended for the use with JSP/Servlet also can be used for a java application. Can this be done easily or is it more complicated?
Thanks,
Tom
 
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Mostly you can not because they are HTTP based and require javax.servlet package to work.
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can embed a servlet engine in a Java application so that it could run servlets and JSP but you would still have to use a browser to see the resulting HTML.
Article on embedded Tomcat
http://www.onjava.com/pub/a/onjava/2002/04/03/tomcat.html
Bill
 
Saloon Keeper
Posts: 27763
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
... Either that or use an HttpURLConnection!
 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Servlets can be thought of a 'plug ins' to a web browser. Bits of logic you write that take a web request, do a bit of work and return a new page (usually via JSP).
It is totally possible to write your logic as a series of Servlets and then have a stand along front end (using an HttpURLConnection as stated) to connect to the web server, get the bit you want and parse the output (HTML or even XML).
The more common approach is to deploy the logic as a series of EJBs. Both the Servlet and Stand Alone App would be clients of the EJB. This allows you to code and deploy the logic only once while making use of it in several locations.
 
Tom Rodrigo
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi vikinsa, William, Tim & Ken,
thanks for all of your answers, this is what I needed to know!
Regards,
Tom
 
Check your pockets for water buffalo. You might need to use this tiny ad until locate a water buffalo:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic