Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 170
  • Last Modified:

Tomcat+apache

Hello everyone. Please help me out here. When I access a servlet "HelloWorld.class" from httpd its by default run on /servlet/HelloWorld. Please I want to make it /servlets/HelloWorld. I want to change from /servlet to /servlets and make it my configuration. is there any change in web.xml right me complete configuration
0
tomcat_linux
Asked:
tomcat_linux
1 Solution
 
tomcat_linuxAuthor Commented:
It is possible but not sure that weather change in web.xml  or redirect it from apache.
0
 
girionisCommented:
 Yuo have to use the <url-pattern> tag to define the URL pattern for your Servlet.
0
 
tomcat_linuxAuthor Commented:
Is there any example that how to add this URl-Pattern to make /servelt to /servlets and which file i will make chages please. right me complete.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
girionisCommented:
 You should add it inside your <servlet-mapping> tag. Lets say that you have defined a servlet with the name "hello" like the following:

<servlet>
  <servlet-name>Hello</servlet-name>
  <servlet-class>mypackage.hellopackage.Hello</servlet-class>
  <display-name></display-name>
  <description></description>
 </servlet>

  then you can map the "Hello" Servlet to the /servlets URL pattern by doing:

<servlet-mapping>
  <servlet-name>Hello</servlet-name>
  <url-pattern>/servlets/Hello</url-pattern>
 </servlet-mapping>

  Now all the requests to http://www.mysomething.com/servlets/Hello will go to the "Hello" Servlets. Note that I am nto entirely sure if this:   <url-pattern>/servlets/Hello</url-pattern> is th eexact syntax. If that does not work experiment a bit around, try to add a * after the pattern, play around with the forward slashes etc.
0
 
tomcat_linuxAuthor Commented:
Thanks that working fine one thing please tell me that how can i connect my database as well because in my servlets i define dirsconf.conf file that contain all information of database that i put in /etc/ because that was working fine with apachejserv but how can i connect with that and my document Root is /apache/htdocs. I will thankful for you this kind of help
0
 
girionisCommented:
 How do you read this dirsconf.conf file? The only thing you have to do is to change the path to the file and the system should pick it up automatically.
0
 
tomcat_linuxAuthor Commented:
I have made DocumentRoot /usr/local/apache/htdocs and in server.xml i have amde changes so my servlets are running fine but i am confued what should i do for running jsp pages please.
0
 
girionisCommented:
 If you want to run JSP pages just put the, under your web applicaiton folder. If your web application is called for example "tomcat_linux" the nput your JSp pages under the "WEB-INF/tomcat_linux" folder and then run them.
0
 
tomcat_linuxAuthor Commented:
Now my jsp has start working but for running that i should frist run it on port 8080 then it will start run on port 80 otherwise if i try to start this on direct port 80 before running on port 8080 it gives the Internal Server Error.


0
 
girionisCommented:
 What do you mean by that? Do you mean that you have to put the port at the end of the URL, something like: http://www.myserver.com:8080/myjsp.jsp or that there are conflicts on the port 80?
0
 
CleanupPingCommented:
tomcat_linux:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
 
jimmackCommented:
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Accept girionis' comment as answer.

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

jimmack
EE Cleanup Volunteer
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now