c******e 发帖数: 139 | 1 in a html,
action="http://localhost:8080/servlet/servletclient"
according to this action,is the following web.xml right? if the class is
C:\apache-tomcat-5.5.23\webapps\ROOT\WEB-INF\classes\servletclient
web.xml
.
.
.
MyServlet
servletclient
MyServlet
/servlet/servletclient
.
.
|
A**o 发帖数: 1550 | 2 servlet标准不支持匿名类。
你的没有包前缀的类是匿名类。
【在 c******e 的大作中提到】 : in a html, : action="http://localhost:8080/servlet/servletclient" : according to this action,is the following web.xml right? if the class is : C:\apache-tomcat-5.5.23\webapps\ROOT\WEB-INF\classes\servletclient : web.xml : . : . : . : : MyServlet
|
c******e 发帖数: 139 | 3 是写成这样吗?
MyServlet
ROOT.servletclient
MyServlet
/servlet/servletclient
可是不对。
谢谢指点。
【在 A**o 的大作中提到】 : servlet标准不支持匿名类。 : 你的没有包前缀的类是匿名类。
|
A**o 发帖数: 1550 | 4 你的servletclient类很特殊么?为啥不能把它放在一个包里?
比如:
package cherokee;
public class servletclient ...
这样子你的servletclient.class应该被发布到/WEB-INF/classes/cherokee目录下,修
改你的web.xml。 |
c******e 发帖数: 139 | 5 还是不对。
如果放到cherokee package 下,web.xml是不是应该是
MyServlet
ckerokee.servletclient
MyServlet
/servlet/servletclient
如果直接放在class package 里,web.xml是不是
MyServlet
servletclient
【在 A**o 的大作中提到】 : 你的servletclient类很特殊么?为啥不能把它放在一个包里? : 比如: : package cherokee; : public class servletclient ... : 这样子你的servletclient.class应该被发布到/WEB-INF/classes/cherokee目录下,修 : 改你的web.xml。
|
m******t 发帖数: 2416 | 6
I couldn't find it anywhere in the spec about this. Do you remember the
particular section?
(That was an honest question. I'm genuinely not aware of this limitation and
just curious about learning more about it.)
【在 A**o 的大作中提到】 : servlet标准不支持匿名类。 : 你的没有包前缀的类是匿名类。
|
A**o 发帖数: 1550 | 7 i can take a look. i read this kind of answers often on the forum.
i might have looked up myself long time ago...
we'll see.
and
【在 m******t 的大作中提到】 : : I couldn't find it anywhere in the spec about this. Do you remember the : particular section? : (That was an honest question. I'm genuinely not aware of this limitation and : just curious about learning more about it.)
|
h**d 发帖数: 474 | 8 分特,俺真不知道有这规定,
从来没有这么写过class,呵呵
【在 A**o 的大作中提到】 : i can take a look. i read this kind of answers often on the forum. : i might have looked up myself long time ago... : we'll see. : : and
|
|
A**o 发帖数: 1550 | 9 不好意思,我也没找到。而且我也好像说错了,这里是我在Java Spec里面找到的。
关键是倒数第二段,估计跟为什么class not found有关。
7.4.2 Unnamed Packages
A compilation unit that has no package declaration is part of an unnamed
package.
Note that an unnamed package cannot have subpackages, since the syntax of a
package declaration always includes a reference to a named top level package.
As an example, the compilation unit:
class FirstCall {
public static void main(String[] args) {
System.out.println("Mr. Watson, come here. "
【在 m******t 的大作中提到】 : : I couldn't find it anywhere in the spec about this. Do you remember the : particular section? : (That was an honest question. I'm genuinely not aware of this limitation and : just curious about learning more about it.)
|
c******e 发帖数: 139 | |
m******t 发帖数: 2416 | 11 Thanks. It's informative anyway. 8-)
I guess the problem with this is it's hard to actually verify by trying it
out - even if a particular container allows it, we still wouldn't know if it
's just a vendor specific extension.
【在 A**o 的大作中提到】 : 不好意思,我也没找到。而且我也好像说错了,这里是我在Java Spec里面找到的。 : 关键是倒数第二段,估计跟为什么class not found有关。 : 7.4.2 Unnamed Packages : A compilation unit that has no package declaration is part of an unnamed : package. : Note that an unnamed package cannot have subpackages, since the syntax of a : package declaration always includes a reference to a named top level package. : As an example, the compilation unit: : class FirstCall { : public static void main(String[] args) {
|