• 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 newbie - how to run .jsp

 
Ranch Hand
Posts: 208
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have registered myself with mycgiserver.com. I am trying to run a .jsp file which I created in my notepad. I don't have Apache/Tomcat in my machine. I am trying to run in directly in mycgiserver. I did an ftp transfer of c:\my documents\sridevi\jsp\ex1.jsp to my root in mycgiserver. I know that .jsp has to become .java and .class to run. How does that happen? I tried to load www.mycgiserver.com/servlet/shree.ex1 and it doesn't work. (500 Servlet exception) For that matter, even HelloWorld pgm gives the same exception. Is there anything I am missing?
------------------
Regards,
Shree
 
Ranch Hand
Posts: 625
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think you may have to contact those people to find out where you specifically should put the jsp files. I use tomcat on my own machine along with apache, and I have to put my jsp and servlets in specific directories for the server to recognize them and do what it has to do. I'm not sure how to solve your problem exactly.
Sorry,
Sean
 
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
A JSP page is placed in the same directory as normal HTML pages - you point your browser at it just like a normal HTML page.
The conversion to a Java servlet and execution are done by the servlet container "transparently". If you have any support classes, such as Java beans, you must put those classes in the normal servlet directory. As Sean says, you should contact the server tech support to find out what their convention is.
Bill
 
Desperado
Posts: 3226
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"I know that .jsp has to become .java and .class to run. How does that happen?"
This happens automatically in the app server (mycgiserver.com) the first time a JSP is requested by a client. You don't have to do more than place the JSP on the correct DIR in the server.
Some servers compile a new JSP the moment they detect it to speed up the first delivery of the JSP that is requested.
For servlets in mycgiserver.com, they all have to belong to the package name that is your userid. If your userid is peter, then all your servlets must be of that package.
Assume a servlet called PetersEMailServlet in your base DIR. It has to have
package peter;

as the first line of code.

If it's placed in your home DIR then it is accessed from the Internet as:
<A HREF="http://www.mycgiserver.com/servlet/<B rel="nofollow">peter</B>.PetersEMailServlet" TARGET=_blank>http://www.mycgiserver.com/servlet/peter.PetersEMailServlet
You can have sub directories if you like with the corresponding pkg names:
A servlet /myservlets/AnotherServlet.class
would be accessed
http://www.mycgiserver.com/servlet/peter.myservlets.AnotherServlet
and of course must belong to the package
peter.myservlets
 
shree vijay
Ranch Hand
Posts: 208
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Sean,Bill and Tony for responding. I guess I have some problem in placing my file.
If I open the browser with
http://www.mycgiserver.com/~shree/test.jsp
then the files are working.
But I am not able to do that with
www.mycgiserver.com/servlets/shree.test
Any help will be appreciated.
------------------
Regards,
Shree
[This message has been edited by shree vijay (edited July 09, 2001).]
 
William Brogden
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 said:
"But I am not able to do that with
www.mycgiserver.com/servlets/shree.test "
This leads me to believe that you are expecting the resulting servlet name to be test. This is not correct - the servlet engine will have its own scheme for creating unique names for the compiled JSP page servlet. There is no reason for you to try to address it directly. After initial compilation the servlet engine will automatically direct requests to the right servlet.
Bill

------------------
author of:
 
reply
    Bookmark Topic Watch Topic
  • New Topic