Reputation: 63
I installed Apache Tomcat on my Windows machine, and it seems like its installed successfuly. I can see the property window, and I can start the server but I don't know what to do next.
Where do I save jsp files at.. do I create a directory or does apache tomcat create its own directories?
that's my only problem.. how do i make and edit files now that its installed
Upvotes: 6
Views: 44146
Reputation: 71
Create the JSP code that you'd like to write in your favorite text editor.
Select "File" and "Save As" from the text editor toolbar. A dialog box appears.
Navigate to the "File name" text field and type the desired file name within quotes. Add a JSP extension to the file name -- for example, "filename.jsp" -- and click "Save."
Put it at location C:\apache-tomcat-7.0.28\webapps\ROOT.
Go to tour browser and enter url "http:// localhost:8080//filename.jsp"
Upvotes: 6
Reputation: 1475
This post will give you description about how you can run your project using Apache Tomcat Server.
I would like to define these terms before proceeding:
Apache Tomcat Server(Jakarta Tomcat): It is an open source web server and servlet container developed by the Apache Software Foundation (ASF). It implements the Java Servlet and the JavaServer Pages (JSP) specifications and provides a pure Java HTTP web server environment for java code to run.
JavaServerPages(JSP): It is a technology that helps in creating dynamically generated web pages.
Step1
Install Java.
Step2
Install Apache Tomcat
At the time of installation, it will by-default recognize JRE path.
(under installed java location directory)
Step3
Now Go-To:
Start
Programs
APACHE TOMCAT
MONITOR TOMCAT
Step4
An icon will appear on the taskbar, this icon will automatically appear after following
above step:
Step5
Click on that icon and START TOMCAT, you can see the following dialog box:
Step6
Now open Mozilla Firefox(or any other browser)
Step7
Type
[http://localhost:8080/][1]
on address bar and press enter.
The same can be seen here:
Step8
It will show tomcat, as shown in above window.
(if not, then try again, may be a problem in installation or you’re not following above
steps correctly
Step9
Now, go to:
C:drive
Programs Files
Apache Software Foundation
tomcat
web-apps
(or navigate where you have installed APACHE TOMCAT)
Step10
Open web-apps and “copy your project” or “make new folder”, which you want to run in JSP.
Example: amit2012PROJECT
Now, go back :
Tomcat
Root
Copy Web-inf from root
Paste this “web-inf” in your project folder i.e. amit2012PROJECT
Step11
Create a text file and name it as first.jsp, use the code shown below:
<html>
<head>
<title>blog post:ApacheTomcatServer</title>
</head>
<body>
<%-- START --%>
<%
out.println("UserName = amit2012, ");
out.println("Running first program in JSP.");
%>
<%-- END --%>
</body>
</html>
It includes HTML tags and encloses a JSP scriptlet which is a fragment of Java code that is run when the user requests the page. Step12
Now for running your folder [ Eg. amit2012PROJECT as shown above]
[http://localhost:8080/][2]foldername.extension in any WebBrowser i.e:
[http://localhost:8080/amit2012PROJECT/first.jsp][3]
The Project will run successfully
Now, you can successfully try running JSP with ApacheTomcatServer.
Upvotes: 2
Reputation: 1
First you need to start your server by going to bin folder present in tomcat then double click the start.bat now the server is up and running now open a browser ,open tomcat
u will see the homepage of server i think u might have already created a folder in webapps folder of tomcat directory structure would look like this tomcatfolder --> webapps --> your file name let it be some " test " --> then the jsp file you have created to run a jsp file located as shown in the above directory structure u need to type the url localhost:8080/test/file name of jsp if it runs ok or otherwise if server throws an error then it needs tools.jar file go to the directory where u have ur jdk kit open jdk file, then open lib file copy tools.jar present in it now again go to tomcat folder , open it and then go to lib folder paste it down there over,go to browser type the url $locallhost:8080/test/file name of jsp( dont type the $ symbol) it should run now now..........
Upvotes: 0
Reputation: 8561
You need to read this first. The file and directory structure of a web app.
Upvotes: 0