GeeCON Prague 2014*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Need help in deploying Counter example in chapter 7 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Need help in deploying Counter example in chapter 7" Watch "Need help in deploying Counter example in chapter 7" New topic
Author

Need help in deploying Counter example in chapter 7

Ken Teoh
Greenhorn

Joined: Jul 20, 2006
Posts: 18
Hi Guys,

I have some trouble deploying the Counter example in chapter 7.
I'm not too sure how the web.xml file is like.
I'm getting an error

The requested resource (/testJSP1/BasicCounter.jsp) is not available.


Here are the details of my web.xml file

<web-app xmnls="http://java.sun.com/xml/ns/j2ee" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">
<servlet>
<servlet-name>BasicCounter</servlet-name>
<jsp-file>/BasicCounter.jsp</jsp-file>
<servlet-class>Counter</servlet-class>
</servlet>
</web-app>



Thanks for helping
Dilshan Edirisuriya
Ranch Hand

Joined: Apr 22, 2006
Posts: 299
Did you declare the <servlet-mapping> in DD?


Dilshan Edirisuriya SCJP1.4, SCWCD1.4, SCBCD 5
Senthil Kumar
Ranch Hand

Joined: Mar 13, 2006
Posts: 264
Both <jsp-file> and <servlet-class> tags should not appear together.Remove the <servlet-class> tag and specify the mapping for the jsp's servlet and then access it via url pattern.


when you really want something, all the universe always conspires in your favour.<br /> <br />SCJP1.5-77%<br />SCWCD-89%
Ken Teoh
Greenhorn

Joined: Jul 20, 2006
Posts: 18
Hi Senthil

Was your DD like this?
<web-app xmnls="http://java.sun.com/xml/ns/j2ee" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">

<servlet>
<servlet-name>Counter</servlet-name>
<jsp-file>/BasicCounter.jsp</jsp-file>
</servlet>

<servlet-mapping>
<servlet-name>Counter</servlet-name>
<url-pattern>/BasicCounter.jsp</url-pattern>
</servlet-mapping>

</web-app>

I did what you suggested but I get a

org.apache.jasper.JasperException: Unable to compile class for JSP

Thanks
Dilshan Edirisuriya
Ranch Hand

Joined: Apr 22, 2006
Posts: 299
Hey Ken your DD is incorrect.
Put <?xml version="1.0" encoding="ISO-8859-1"?> above the <web-app>
Ken Teoh
Greenhorn

Joined: Jul 20, 2006
Posts: 18
Hey Dilshan,

Thanks alot its working right now. Do you know why its required? I tried it without the line in the example in chapter 3 and it works
Dilshan Edirisuriya
Ranch Hand

Joined: Apr 22, 2006
Posts: 299
I have no idea. It can be seen in tomcat examples. So just copied it and used it.
 
GeeCON Prague 2014
 
subject: Need help in deploying Counter example in chapter 7