Amy:

Not sure what happened with your application creation.  JRun's 'create application' 
allowed me to auto-create the subdirectory structure per the servlet 2.2 spec for the 
application in question and it created a rudimentary web.xml file (almost empty) in 
the WEB-INF directory.  It also automatically registered the web app with JRun and 
when I re-started the default server.

Not sure about what your experience has been with servlets, so please forgive me if I 
am being too basic. The "web application" must have something that it does in terms of 
server-sided processing or it can be simply a web subdirectory. For the application to 
do something, you need to write either servlets or jsp that will be invoked when the 
web app is invoked. All the 'create application' does is automatically generate the 
right subdirectory structure for you according to the 2.2 api.  You need to put the 
servlets into the /WEB-INF/classes directory, the web pages and or .jsp pages in the 
default root directory (/yourwebapproot    ie, the directory above the WEB-INF), 
etc...  Any supporting classes (ie, imported classes needed at run time) should go as 
.jar files in the WEB-INF/lib directory. All .jar files for the web-app in that 
directory are automatically loaded at startup (so you don't have to add them to the 
system CLASSPATH as we did in prior days).  To .jar those files, you can use the jar 
tool provided by Sun with the JDK.  The documentation on using the jar tool is in the 
JDK docs.

To create a web app that does somethig, here is a very simple example----print  the 
string "Hello from JRun" when the URL is invoked.  Once you have your application 
deployed (I presume /test is the URL), create a .jsp page with the following code:

<html>
<body>
<%out.println("Hello from JRun");%>
</body>
</html>

Save it under your /test directory as index.jsp.

Make sure to have index.jsp be the default document under the "File Settings" for the 
web app. You should be able to restart JRun and have the index.jsp run when you invoke 
http://localhost/test

HOWEVER, I did notice that despite making the changes in the JMC and restarting, my 
JR3 did not automatically make index.jsp the default document. Open the web.xml file 
and make sure there is a line like:
<welcome-file-list>index.jsp</welcome-file-list>

After I forced JMC to use index.jsp by hitting the update button on the admin, it only 
added the <welcome-file-list> tags but no index.jsp. If you change it to include 
index.jsp, when you run http://localhost/test, it will run index.jsp.

In this fashion, you could create an entire web application (servlets, jsp, web pages, 
images, etc...) in the servlet spec file structure and be able to give that to others 
and know that it will run just like it runs on your machine regardless of the J2EE web 
app server they are using or platform. Pretty cool, if you think about it.  Imagine an 
entire web-based HR system that can be provided as a large .war file which JRun then 
decomposes and deploys.


One thing you might consider if you want to learn more about the details of web apps 
is to try to construct a web.xml file by hand. It forces one to know the spec pretty 
well with respect to the web.xml file which is the heart&soul of the thing. A great 
reference on the web.xml file is the servlet API 2.2 spec document itself. The JRun 
manuals are some of the best for J2EE app servers and cover the web.xml issues pretty 
well.

Good luck.
--Mike H.






*********** REPLY SEPARATOR  ***********

On 8/25/00 at 6:00 PM Amy Wan wrote:

>THanks for your reply.
>
>I haven't tried to deploy the application.
>I am just learning how to create a web application.
>
>So when  I created the application, I gave JRun my soruce path by entering
>it to "Application Root Directory" and  I also filled out "Application URL"
>with /test
>Then from my broswer, I was able to locate the files inside the "Application
>Root Directory" by access this ULR http://localhost/test
>
>I looked into my application root directory and see JRun created a WEB-INF
>directory in there.
>
>My question is what exactly I should do?
>
>1) create what directory?
>2) where I should create that directory?
>
>Remember I didn't actually try to deploy anything at this time.
>
>Thanks again.
>


------------------------------------------------------------------------------
Archives: http://www.egroups.com/group/jrun-interest/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebarRsts&bodyRsts/jrun_talk
or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the 
body.

Reply via email to