jsp文件:<a href="ForeGoundServlet?action=logIn">登录</a>
servlet放置位置com.shop.servlet.ForeGoundServlet
web.xml配置文件内容<servlet>
<servlet-name>ForeGoundServlet</servlet-name>
<servlet-class>com.shop.servlet.ForeGoundServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ForeGoundServlet</servlet-name>
<url-pattern>/foreground/ForeGoundServlet</url-pattern>
</servlet-mapping>
访问显示结果出错,如下提示
type Status reportmessage ForeGoundServletdescription The requested resource (ForeGoundServlet) is not available.这是怎么回事呢
servlet放置位置com.shop.servlet.ForeGoundServlet
web.xml配置文件内容<servlet>
<servlet-name>ForeGoundServlet</servlet-name>
<servlet-class>com.shop.servlet.ForeGoundServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ForeGoundServlet</servlet-name>
<url-pattern>/foreground/ForeGoundServlet</url-pattern>
</servlet-mapping>
访问显示结果出错,如下提示
type Status reportmessage ForeGoundServletdescription The requested resource (ForeGoundServlet) is not available.这是怎么回事呢
你自己配制的这个url阿
type Status reportmessage /foreground/ForeGoundServletdescription The requested resource (/foreground/ForeGoundServlet) is not available.
<servlet>
<servlet-name>ForeGoundServlet</servlet-name>
<servlet-class>com.shop.servlet.ForeGoundServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ForeGoundServlet</servlet-name>
<url-pattern>/ForeGoundServlet</url-pattern>
</servlet-mapping> <a href="ForeGoundServlet?action=logIn">登录 </a> 这样就可以访问了!!!
<servlet>
<servlet-name>ForeGoundServlet</servlet-name>
<servlet-class>com.shop.servlet.ForeGoundServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ForeGoundServlet</servlet-name>
<url-pattern>/ForeGoundServlet</url-pattern>
</servlet-mapping>
应该把/foreground/ForeGoundServlet中的/foreground去掉就可以了。
<servlet>
<servlet-name>ForeGoundServlet</servlet-name>
<servlet-class>com.shop.servlet.ForeGoundServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ForeGoundServlet</servlet-name>
<url-pattern>/foreground/ForeGoundServlet</url-pattern>
</servlet-mapping>
<a href="foreground/ForeGoundServlet?action=logIn">…
如果这里写成这样<a href="ForeGoundServlet?action=logIn">…就找不到这个servlet