This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds and have James Denton on-line!
See this thread for details.
Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Change URL http/unbeatableonline.com/swbeatableonline.com to http/unbeatableonline.com  RSS feed

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My servlet is running good as listed below.
URL is http/unbeatableonline.com/unbeatableonline.com

I have servlet running from:
C:\Tomcat 4.1\webapps\ROOT\WEB-INF\classes\Unbeatable\src
Images and css file are running from:
C:\Tomcat 4.1\webapps\ROOT\unbeatable\css
C:\Tomcat 4.1\webapps\ROOT\unbeatable\images

I am accessing my css in the code.
out.println("<link href='../unbeatable/css/style.css' rel='stylesheet' type='text/css' />");

web.xml
<servlet>
<servlet-name>unbeatableonline</servlet-name>
<servlet-class>Unbeatable.src.unbeatableonline</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>unbeatableonline</servlet-name>
<url-pattern>/unbeatableonline.com</url-pattern>
</servlet-mapping>

Now where I need help
I want to run servlet using URL: http/unbeatableonline.com

I changed my web.xml as follows.
<servlet>
<servlet-name>unbeatableonline</servlet-name>
<servlet-class>Unbeatable.src.unbeatableonline</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>unbeatableonline</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>

After the change servlet runs fine but I don't have access to my css and image folder

Any help would be appreciated

Thanks Chino Khan
 
Author and ninkuma
Marshal
Posts: 66797
168
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mapping / means that all resources will be mapped to the servlet. Obviously not what you want.

Rather, set up a "welcome file" setting.
 
Chino khan
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rather, set up a "welcome file" setting. ?

you mean to say I should move my css and image folder to :
C:\Tomcat 4.1\webapps\ROOT\WEB-INF\classes\Unbeatable\src
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66797
168
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, I said you should set up a welcome-file setting in your deployment descriptor. That doesn't sound anything at all like "move your files around".
 
Chino khan
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I will google and try to learn how to set up a welcome-file setting in my deployment descriptor.

Thanks for pointing me in right direction.
 
Chino khan
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can you see any error with my web-xml
<servlet>
<servlet-name>unbeatableonline</servlet-name>
<servlet-class>Unbeatable.src.unbeatableonline</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>unbeatableonline</servlet-name>
<url-pattern>/unbeatableonline.com</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>unbeatableonline.com</welcome-file>
</welcome-file-list>

http://unbeatableonline.com/unbeatableonline.com works
http://unbeatableonline.com error 404
any clue
 
Chino khan
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi can anyone point me in right direction how to write welcome file. I am stuck.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66797
168
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It took me exactly 7 seconds to find this other topic on precisely this subject via google.

Please ShowSomeEffort of your own.
 
Chino khan
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your speedy replay.
I have looked at all the links you provided. I think I do not understand the concept. I have been looking for the solution for last 2 days.
 
Chino khan
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok I found the solution:

first make a simple html file and name is as index.html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta HTTP-EQUIV="REFRESH" content="0; url=http://unbeatableonline.com/unbeatableonline.com">
<title>Unbeatable</title>
</head>

<body>
</body>
</html>

now place this file in the root dir of your server in my case it is(C:\Tomcat 4.1\webapps\ROOT)

now modify you web-xml file

<servlet>
<servlet-name>unbeatableonline</servlet-name>
<servlet-class>Unbeatable.src.unbeatableonline</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>unbeatableonline</servlet-name>
<url-pattern>/unbeatableonline.com/*</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>

Thanks a lot Chino Khan
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!