how to call a class in a package from a web page?
hi all
i've written my own class sessionTracking.SessionTracker.class that is in %tomcat_home%\webapps\myapp\web_inf\classes\sessionTracking
when i try to call from my html page i get the following tomcat error:
"the requested resource is not available"
my web.xml:
<servlet>
<servlet-name>SessionTracker</servlet-name>
<servlet-class>sessionTracking.SessionTracker</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>SessionTracker</servlet-name>
<url-pattern>/sessiontracker</url-pattern>
</servlet-mapping>
my html link:
<a href="/class-site/sessionTracking/SessionTracker">SessionTracker</a>
what's wrong?
thanx in advance
sandro
[835 byte] By [
san_dro] at [2007-9-27 22:20:51]

thanx for your answer!
i've tried to change the URL to
<a href="/class-site/SessionTracker">SessionTracker</a>
but it doesn't work!!!
there already is a lot of class under WEB-INF/classes dir, and all work fine, but now i want to add my new classes in packages.
i don't know exactely, but i think that is a problem about the combination of the URL above and the xml file
any advice?
sandro
> thanx for your answer!
> i've tried to change the URL to
> <a
> href="/class-site/SessionTracker">SessionTracker</a>
> but it doesn't work!!!
> there already is a lot of class under WEB-INF/classes
> dir, and all work fine, but now i want to add my new
> classes in packages.
> i don't know exactely, but i think that is a problem
> about the combination of the URL above and the xml
> file
>
> any advice?
> sandro
Again, as was mentioned above, isn't the fact that you put '/class-site/' causing you the problem. If the mapping is done correctly you only need /SessionTracker.
regards
Andrew
artco at 2007-7-7 12:42:25 >

Something else... is the following the actual line form your web.xml file?
> %tomcat_home%\webapps\myapp\web_inf\classes\sessionTracking
? If so, your servlet is at "/myapp/servlet/SessionTracker", not "/class-site/sessionTracking/SessionTracker". but, if you set up that servlet mapping as you did, the servlet should be able to be reached at "/sessiontracker". Try these in a web browser until you find it coming up... then put it int he link.