Win a copy of Microservices Testing (Live Project) this week in the Spring 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

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

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 67650
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Sheriff
Posts: 67650
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi can anyone point me in right direction how to write welcome file. I am stuck.
 
Bear Bibeault
Sheriff
Posts: 67650
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic