Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/url/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
web.xml中网站基页的url模式_Url_Design Patterns_Servlets_Web.xml - Fatal编程技术网

web.xml中网站基页的url模式

web.xml中网站基页的url模式,url,design-patterns,servlets,web.xml,Url,Design Patterns,Servlets,Web.xml,我在url上有应用程序“http://game.appspot.com/". 我需要从这个基本根调用servlet,这意味着调用servlet的相对路径应该是“/”,但当我这样做时,它不起作用: <url-pattern>/</url-pattern> / 在我的web.xml文件中,我不能将其保留为空,如: <url-pattern></url-pattern> 因为我尝试将它部署到google app engine时出错 我该怎么办

我在url上有应用程序“http://game.appspot.com/". 我需要从这个基本根调用servlet,这意味着调用servlet的相对路径应该是“/”,但当我这样做时,它不起作用:

<url-pattern>/</url-pattern>
/
在我的web.xml文件中,我不能将其保留为空,如:

<url-pattern></url-pattern>

因为我尝试将它部署到google app engine时出错

我该怎么办


谢谢大家!

似乎有一种更老的方法可以通过欢迎文件servlet黑客实现这一点:

发件人:


测试
测试
试验
测试
*.html
index.html
如果使用
index.html
,则需要将
index.html
放在磁盘上,即使是作为0字节的文件,servlet才能执行。我建议将url模式设置为其他文件扩展名,可能是*.xyz,然后在与servlet关联的磁盘上设置一个0字节的index.xyz(我还没有测试过,但应该可以)

<servlet>
  <description></description>
  <display-name>test</display-name>
  <servlet-name>test</servlet-name>
  <servlet-class>Test</servlet-class>
</servlet>

<servlet-mapping>
  <servlet-name>test</servlet-name>
  <url-pattern>*.html</url-pattern>
</servlet-mapping>

<welcome-file-list>
  <welcome-file>index.html</welcome-file>
</welcome-file-list>