• 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

Stupid question, but I need clarification...

 
Ranch Hand
Posts: 238
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok, I need to go back to the mainframe and quit bugging you guys, but they (those who control my Paycheck) won't let me (they say they want to keep me on the bleeding (OOPs! Leading) edge of technology).
I am trying to understand how JSP's (and Servlets) are published for use on a server. I gather they need to be compiled on the host to run as long as the host supports them and they can't just be compiled at the developer's level and then loaded directly to the server... correct? If so, what about external classes for the JSP / servlet?
Thanks
 
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

Originally posted by Sam Smoot:
I am trying to understand how JSP's (and Servlets) are published for use on a server. I gather they need to be compiled on the host to run as long as the host supports them and they can't just be compiled at the developer's level and then loaded directly to the server... correct? If so, what about external classes for the JSP / servlet?


That's one of the major points of java "Write once, run (almost) anywhere" -- so you can compile your Servlets and pre-compile your JSPs on a developer's machine and then move them to a production environment.
Quite often in the JSP/Servlet environment you create a Web Application Archive (WAR file) it compromises all the parts of your application and holds them in the .zip format. You can then deploy this single file on to your application server (nice and convenient that way).
Check out More Servlets and JavaServer Pages by Marty Hall. Or you can check out Chapter 4 of the HP Application Server Developer's Guide. It covers Web Components (JSPs and Servlets) as well as WAR files. That section is relativly application-server neutral.
Hope that helps!
 
Sam Smoot
Ranch Hand
Posts: 238
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok. so I need to create a WAR file (catchy name) and that contains ?all? of my classes that have been compiled on my machine and it will interpret corrcetly on the host machine (without compiliation)? How is this created?
Please forgive the ignorance... Too much radiation from the CRT....
 
Jessica Sant
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
correct, you'll need to compile the Servlets... the JSPs wil be compiled on the first request.
Once you have the correct directory structure all laid out you can use the commandline jar tool to create the war file.
check out these threads for more info:
What is a .war file?
how to make war file
and definatley check the book I listed or the documentation I mentioned in my last post.
 
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"Simple answer but a valid one"
To run a jsp or a servlet u must need a webserver,forget abt the application server at present.(of course u shud have the jsdk.jar and javac for compiling the servlets and jsp's)
So u can have a webserver for ur testing env,later on put those jsps and the servlets(class files) in the required directories.
i.e
jsps in the web-inf directory and classes of servlets in the web-inf/classes directory.
SO WEBSERVER IS A MUST.
 
If you live in a cold climate and on the grid, incandescent light can use less energy than LED. Tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic