使用URI [/WEB-INF/pages/apiForm来查找HTTP请求的映射。jsp)(复制)

时间:2022-10-02 23:55:17

This question already has an answer here:

这个问题已经有了答案:

My handler forwards to internalresourceview 'apiForm' but then i get error 404 RequestURI=/WEB-INF/pages/apiForm.jsp. I'm sure apiForm.jsp located in /WEB-INF/pages/

我的处理程序转发给internalresourceview 'apiForm',但之后会出现错误404 RequestURI=/ web inf /pages/apiForm.jsp。我相信apiForm。jsp位于/ web - inf /页面/

13:45:02,034 DEBUG [org.springframework.web.servlet.view.JstlView] - Forwarding to resource [/WEB-INF/pages/apiForm.jsp] in InternalResourceView 'apiForm'
13:45:02,035 DEBUG [org.springframework.web.servlet.DispatcherServlet] - DispatcherServlet with name 'testapp2' determining Last-Modified value for [/WEB-INF/pages/apiForm.jsp]
13:45:02,038 DEBUG [org.springframework.web.servlet.DispatcherServlet] - No handler found in getLastModified
13:45:02,038 DEBUG [org.springframework.web.servlet.DispatcherServlet] - DispatcherServlet with name 'testapp2' processing request for [/WEB-INF/pages/apiForm.jsp]
13:45:02,038 WARN [org.springframework.web.servlet.PageNotFound] - No mapping found for HTTP request with URI [/WEB-INF/pages/apiForm.jsp] in DispatcherServlet with name 'testapp2'
13:45:02,045 DEBUG [org.springframework.web.servlet.DispatcherServlet] - Successfully completed request
13:45:02,048 DEBUG [org.springframework.web.servlet.DispatcherServlet] - Successfully completed request

(org.springframework.web.servlet.view 13:45:02,034调试。-转发到资源[/WEB-INF/pages/apiForm。在InternalResourceView 'apiForm' 13:45:02,035 DEBUG [org.springframework.web.servlet。DispatcherServlet] -具有名称“testapp2”的DispatcherServlet决定最后修改的值(/ web inf /pages/apiForm)。jsp][org.springframework.web.servlet 13:45:02,038调试。DispatcherServlet] -没有在getLastModified 13:45:02,038 DEBUG [org.springframework.web.servlet]中找到的处理程序。DispatcherServlet] -具有名称“testapp2”处理请求的DispatcherServlet [/WEB-INF/pages/apiForm。jsp][org.springframework.web.servlet 13:45:02,038警告。-没有使用URI [/WEB-INF/pages/apiForm来查找HTTP请求的映射。在DispatcherServlet中,命名为“testapp2”13:45:02,045 DEBUG [org.springframework.web.servlet。-成功完成请求13:45:02048 DEBUG [org.springframework.web.servlet。DispatcherServlet] -成功完成请求。

this is how my dispatcher.xml look like..

这就是我的调度员。xml的样子. .

<bean id="viewResolver"
    class="org.springframework.web.servlet.view.UrlBasedViewResolver">
    <property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/>
    <property name="prefix" value="/WEB-INF/pages/"/>
    <property name="suffix" value=".jsp"/>
</bean>

16 个解决方案

#1


152  

Looks like DispatcherServlet is trying to process the request for apiForm.jsp, which suggests to me that your web.xml servlet-mapping is directing requests for that space to DispatcherServlet.

看起来DispatcherServlet正在尝试处理apiForm的请求。jsp,它告诉我你的网络。xml servlet映射将这个空间的请求指向DispatcherServlet。

You might have something like this?

你可能有这样的东西?

<servlet-mapping>
  <servlet>dispatcher</servlet>
  <url-pattern>/*</url-pattern>
</servlet-mapping>

Try calling your controllers with a different extension (.do for example) and update the servlet-mapping to suit

试着用不同的扩展名来调用你的控制器。例如,更新servlet映射到suit ?

 <servlet-mapping>
  <servlet>dispatcher</servlet>
  <url-pattern>*.do</url-pattern>
</servlet-mapping>

#2


90  

Yes, I know I'm late to this party but it might help others.

是的,我知道我迟到了,但它可能会帮助别人。

The servlet container chooses the mapping based on the longest path that matches. So you can put this mapping in for your JSPs and it will be chosen over the /* mapping.

servlet容器根据匹配的最长路径选择映射。所以你可以把这个映射放到你的jsp中,它会被选中/*映射。

<servlet-mapping>
  <servlet-name>jsp</servlet-name>
  <url-pattern>/WEB-INF/pages/*</url-pattern>
 </servlet-mapping>

Actually for Tomcat that's all you'll need since jsp is a servlet that exists out of the box. For other containers you either need to find out the name of the JSP servlet or add a servlet definition like:

实际上,对于Tomcat,这是您需要的,因为jsp是一个存在于这个框中的servlet。对于其他容器,您要么需要找到JSP servlet的名称,要么添加一个servlet定义:

<servlet>
  <servlet-name>jsp</servlet-name>
  <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
</servlet>

#3


14  

Just add <mvc:default-servlet-handler /> to your DispatcherServlet configuration and you are done!

只需将 添加到您的DispatcherServlet配置中,您就完成了!

#4


11  

you will get a No mapping found for HTTP request with URI error

您将得到一个没有URI错误的HTTP请求的映射。

if you scanned the wrong package

如果你扫描错误的包裹。

e.g your controller is in my.package.abc but you mistakenly put

e。你的控制器在我的包里。但你错了。

<context:component-scan base-package="my.package.efg*" />

<上下文:component-scan基础包= " my.package。efg *>

or

@ComponentScan("my.package.efg*")

@ComponentScan(“my.package.efg *”)

which in the sense, your controller doesn't get scanned into the web application context, when request comes in not just url, but the entire class is not found!

在这个意义上,您的控制器不会被扫描到web应用程序上下文,当请求不仅仅是url,而是整个类都找不到!

#5


8  

Solution that helped me is: do not map DispatcherServlet to /*, map it to /. Final config is then:

帮助我的解决方案是:不要将DispatcherServlet映射到/*,映射到/。最后的配置是:

<servlet>
    <servlet-name>dispatcher</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <init-param>
        ...
    </init-param>
    <load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
    <servlet-name>dispatcher</servlet-name>
    <url-pattern>/</url-pattern>
</servlet-mapping>

#6


8  

Simple check can be made. I am currently using Spring MVC architecture along with hibernate. I had missed writing @Controller annotations just above class name. This was causing the problem for me.

可以做简单的检查。我现在正在使用Spring MVC架构和hibernate。我没有在类名上面写@Controller注释。这给我造成了麻烦。

@Controller
public class MyClass{
    ...
}

Hope this simple check solves your problem.

希望这个简单的检查能解决你的问题。

#7


8  

With Spring 3.1 and Tomcat 7 I got next error:

在Spring 3.1和Tomcat 7中,我犯了下一个错误:

org.springframework.web.servlet.DispatcherServlet noHandlerFound No mapping found for HTTP request with URI [/baremvc/] in DispatcherServlet with name 'appServlet'

org.springframework.web.servlet。DispatcherServlet noHandlerFound没有在DispatcherServlet中使用名为“appServlet”的URI [/baremvc/]找到HTTP请求的映射

And I needed to add to web.xml next configuration:

我还需要添加到网络中。xml配置:

<welcome-file-list>
    <welcome-file/>
</welcome-file-list>

And the application worked!

和应用程序成功了!

#8


8  

I think I read the entire internet to figure out how to get sitemesh to handle my html paths without extension + API paths without extension. I was wrapped up in a straight jacket figuring this out, every turn seemed to break something else. Then I finally came upon this post.

我想我阅读了整个互联网,想知道如何让sitemesh处理我的html路径,而不需要扩展+ API路径。我裹在一件直夹克衫里,弄明白了这件事,每一个转折似乎都打破了其他的东西。然后我终于找到了这个职位。

<servlet>
    <servlet-name>dispatcher</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>
<servlet>
    <servlet-name>jsp</servlet-name>
    <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
</servlet>

<servlet-mapping>
    <servlet-name>dispatcher</servlet-name>
    <url-pattern>/*</url-pattern>
</servlet-mapping>

<servlet-mapping>
    <servlet-name>jsp</servlet-name>
    <url-pattern>/WEB-INF/views/*</url-pattern>
 </servlet-mapping>

<servlet-mapping>
    <servlet-name>jsp</servlet-name>
    <url-pattern>/WEB-INF/decorators/*</url-pattern>
</servlet-mapping>

Enter this in your dispatcher-servlet.xml

在dispatcher-servlet.xml中输入这个。

<mvc:default-servlet-handler/>

#9


2  

I had the same problem, Of course there was a little difference. The story was that when I was removing the below line:

我有同样的问题,当然有一点不同。故事是这样的,当我移除下面一行的时候:

<mvc:resources mapping="/resources/**" location="classpath:/resources/" />

Everything was OK but in presence of that line the same error raise.

一切都没问题,但在这条线出现之前,同样的错误增加了。

After some trial and error I found I have to add the below line to my spring application context file:

经过一些尝试和错误之后,我发现我必须将下面一行添加到spring应用程序上下文文件中:

<mvc:annotation-driven />

Hope it helps!

希望它可以帮助!

#10


1  

This could also happen when you're app doesn't actually compile, yet it's still launched in Tomcat. When I saw this happen, it wasn't compiling because the project had a "project specific" JDK specified, and the code was checked out on a machine that didn't have that specific JDK. Eclipse defaulted to a JRE instead, not a JDK, and then the app wasn't compiled.

这也可能发生在应用程序实际上没有编译时,但它仍然在Tomcat中启动。当我看到这种情况发生时,它并没有编译,因为这个项目有一个“特定于项目的”JDK,并且代码在没有特定JDK的机器上进行了检查。Eclipse默认的是JRE,而不是JDK,然后应用程序没有被编译。

To fix it in our specific case, we just turned off "Project Specific Settings" here:

为了解决这个问题,我们在这里关闭了“项目特定设置”:

"Project | Properties | Java Compiler"

" |项目| Java编译器"

Here's more detailed info on how to do this: https://*.com/a/2540730/26510

下面是关于如何做到这一点的更详细的信息:https://*.com/a/2540730/26510。

#11


1  

Same answer as Brad Parks... more text though

和布拉德·帕克斯一样的答案……更多的文本虽然

I had the exact same problem and tried the above solutions along with many others, all with negative results. I even started out with a new, fresh Dev env and simply installed a spring-mvc-template and tried to run it directly after install (should work, but failed for me)

我也遇到了同样的问题,并尝试了以上的解决方案和许多其他的解决方案,结果都是负面的。我甚至开始使用一个新的、新的Dev env,并简单地安装了一个spring-mvc模板,并试图在安装后直接运行它(应该工作,但对我来说失败了)

For me the problem was that I was using jdk1.6 in my project, but my selected execution environment in eclipse was jdk1.7. The solution was to change the project specific execution environment settings so that this project is set to jdk1.6. Right click project --> Properties --> Java Compiler --> Check "Enable project specific settings" if it's not already checked --> select the appropriate jdk (or add if it's not installed).

对我来说,问题是我在我的项目中使用jdk1.6,但是我在eclipse中选择的执行环境是jdk1.7。解决方案是更改项目特定的执行环境设置,以便将这个项目设置为jdk1.6。右击项目——>属性——> Java编译器——>检查“启用项目特定设置”,如果它还没有检查——>选择合适的jdk(或者如果没有安装的话添加)。

I hope this can help someone and save that persons time, because I have spent the last few days looking for the answer on every corner of the Internet. I accidently stumbled upon it myself when I started to get desperate and look for the solution in areas where it (according to my brain) was less likely to be found. =)

我希望这能帮到一个人,也能挽救那个人的时间,因为在过去的几天里,我一直在互联网的每个角落寻找答案。当我开始绝望的时候,我无意中发现了它,并在它(根据我的大脑)发现的地方寻找解决方案。=)

My 2 cents. Thanks!

我的2美分。谢谢!

Edit1: Use project specific settings

使用项目特定的设置。

Edit2: Just realized Brad Parks already answered this in this very thread. Well, at least I got the "Editor"-badge out of this one =D

Edit2:刚刚意识到Brad Parks已经在这个帖子里回答了这个问题。好吧,至少我得到了"编辑"的徽章。

#12


1  

Unfortunately, this is a rather broad class error message. Yet another thing which could be going wrong is if you are missing some classes/jars. For example, if you are missing the spring-expression jar file, the dispatch-servlet is not going to be able to locate your controller no matter how hard you try and how correct everything else is configured.

不幸的是,这是一个相当广泛的类错误消息。另一件可能出错的事情是,如果你错过了一些类/jar。例如,如果您缺少spring表达式jar文件,那么dispatchservlet将无法定位您的控制器,无论您多么努力地尝试,以及如何正确配置其他所有内容。

#13


1  

I have encountered this problem in Eclipse Luna EE. My solution was simply restart eclipse and it magically started loading servlet properly.

我在Eclipse Luna EE中遇到了这个问题。我的解决方案是简单地重启eclipse,它神奇地开始正确地加载servlet。

#14


0  

What you need is to have a controller that responds to the url first which then renders your jsp. See this link for a solution.

您需要的是拥有一个对url作出响应的控制器,然后它将呈现您的jsp。请参见此链接以获得解决方案。

#15


0  

"/openStudentPage" is the page that i want to open first, i did :

"/openStudentPage"是我想先打开的页面,我做了:

 @RequestMapping(value = "/", method = RequestMethod.GET)
    public String index(Model model) {
     return "redirect:/openStudentPage";
    }

@RequestMapping(value = "/openStudentPage", method = RequestMethod.GET)
public String listStudents(Model model) {
    model.addAttribute("student", new Student());
    model.addAttribute("listStudents", this.StudentService.listStudents());
    return "index";
}

#16


-3  

change the your servlet name dispatcher to any other name .because dispatcher is predefined name for spring3,spring4 versions.

将您的servlet名称调度器更改为任何其他名称。因为dispatcher是spring3、spring4版本的预定义名称。

<servlet>
    <servlet-name>ahok</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
    <servlet-name>ashok</servlet-name>
    <url-pattern>/</url-pattern>
</servlet-mapping>

#1


152  

Looks like DispatcherServlet is trying to process the request for apiForm.jsp, which suggests to me that your web.xml servlet-mapping is directing requests for that space to DispatcherServlet.

看起来DispatcherServlet正在尝试处理apiForm的请求。jsp,它告诉我你的网络。xml servlet映射将这个空间的请求指向DispatcherServlet。

You might have something like this?

你可能有这样的东西?

<servlet-mapping>
  <servlet>dispatcher</servlet>
  <url-pattern>/*</url-pattern>
</servlet-mapping>

Try calling your controllers with a different extension (.do for example) and update the servlet-mapping to suit

试着用不同的扩展名来调用你的控制器。例如,更新servlet映射到suit ?

 <servlet-mapping>
  <servlet>dispatcher</servlet>
  <url-pattern>*.do</url-pattern>
</servlet-mapping>

#2


90  

Yes, I know I'm late to this party but it might help others.

是的,我知道我迟到了,但它可能会帮助别人。

The servlet container chooses the mapping based on the longest path that matches. So you can put this mapping in for your JSPs and it will be chosen over the /* mapping.

servlet容器根据匹配的最长路径选择映射。所以你可以把这个映射放到你的jsp中,它会被选中/*映射。

<servlet-mapping>
  <servlet-name>jsp</servlet-name>
  <url-pattern>/WEB-INF/pages/*</url-pattern>
 </servlet-mapping>

Actually for Tomcat that's all you'll need since jsp is a servlet that exists out of the box. For other containers you either need to find out the name of the JSP servlet or add a servlet definition like:

实际上,对于Tomcat,这是您需要的,因为jsp是一个存在于这个框中的servlet。对于其他容器,您要么需要找到JSP servlet的名称,要么添加一个servlet定义:

<servlet>
  <servlet-name>jsp</servlet-name>
  <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
</servlet>

#3


14  

Just add <mvc:default-servlet-handler /> to your DispatcherServlet configuration and you are done!

只需将 添加到您的DispatcherServlet配置中,您就完成了!

#4


11  

you will get a No mapping found for HTTP request with URI error

您将得到一个没有URI错误的HTTP请求的映射。

if you scanned the wrong package

如果你扫描错误的包裹。

e.g your controller is in my.package.abc but you mistakenly put

e。你的控制器在我的包里。但你错了。

<context:component-scan base-package="my.package.efg*" />

<上下文:component-scan基础包= " my.package。efg *>

or

@ComponentScan("my.package.efg*")

@ComponentScan(“my.package.efg *”)

which in the sense, your controller doesn't get scanned into the web application context, when request comes in not just url, but the entire class is not found!

在这个意义上,您的控制器不会被扫描到web应用程序上下文,当请求不仅仅是url,而是整个类都找不到!

#5


8  

Solution that helped me is: do not map DispatcherServlet to /*, map it to /. Final config is then:

帮助我的解决方案是:不要将DispatcherServlet映射到/*,映射到/。最后的配置是:

<servlet>
    <servlet-name>dispatcher</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <init-param>
        ...
    </init-param>
    <load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
    <servlet-name>dispatcher</servlet-name>
    <url-pattern>/</url-pattern>
</servlet-mapping>

#6


8  

Simple check can be made. I am currently using Spring MVC architecture along with hibernate. I had missed writing @Controller annotations just above class name. This was causing the problem for me.

可以做简单的检查。我现在正在使用Spring MVC架构和hibernate。我没有在类名上面写@Controller注释。这给我造成了麻烦。

@Controller
public class MyClass{
    ...
}

Hope this simple check solves your problem.

希望这个简单的检查能解决你的问题。

#7


8  

With Spring 3.1 and Tomcat 7 I got next error:

在Spring 3.1和Tomcat 7中,我犯了下一个错误:

org.springframework.web.servlet.DispatcherServlet noHandlerFound No mapping found for HTTP request with URI [/baremvc/] in DispatcherServlet with name 'appServlet'

org.springframework.web.servlet。DispatcherServlet noHandlerFound没有在DispatcherServlet中使用名为“appServlet”的URI [/baremvc/]找到HTTP请求的映射

And I needed to add to web.xml next configuration:

我还需要添加到网络中。xml配置:

<welcome-file-list>
    <welcome-file/>
</welcome-file-list>

And the application worked!

和应用程序成功了!

#8


8  

I think I read the entire internet to figure out how to get sitemesh to handle my html paths without extension + API paths without extension. I was wrapped up in a straight jacket figuring this out, every turn seemed to break something else. Then I finally came upon this post.

我想我阅读了整个互联网,想知道如何让sitemesh处理我的html路径,而不需要扩展+ API路径。我裹在一件直夹克衫里,弄明白了这件事,每一个转折似乎都打破了其他的东西。然后我终于找到了这个职位。

<servlet>
    <servlet-name>dispatcher</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>
<servlet>
    <servlet-name>jsp</servlet-name>
    <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
</servlet>

<servlet-mapping>
    <servlet-name>dispatcher</servlet-name>
    <url-pattern>/*</url-pattern>
</servlet-mapping>

<servlet-mapping>
    <servlet-name>jsp</servlet-name>
    <url-pattern>/WEB-INF/views/*</url-pattern>
 </servlet-mapping>

<servlet-mapping>
    <servlet-name>jsp</servlet-name>
    <url-pattern>/WEB-INF/decorators/*</url-pattern>
</servlet-mapping>

Enter this in your dispatcher-servlet.xml

在dispatcher-servlet.xml中输入这个。

<mvc:default-servlet-handler/>

#9


2  

I had the same problem, Of course there was a little difference. The story was that when I was removing the below line:

我有同样的问题,当然有一点不同。故事是这样的,当我移除下面一行的时候:

<mvc:resources mapping="/resources/**" location="classpath:/resources/" />

Everything was OK but in presence of that line the same error raise.

一切都没问题,但在这条线出现之前,同样的错误增加了。

After some trial and error I found I have to add the below line to my spring application context file:

经过一些尝试和错误之后,我发现我必须将下面一行添加到spring应用程序上下文文件中:

<mvc:annotation-driven />

Hope it helps!

希望它可以帮助!

#10


1  

This could also happen when you're app doesn't actually compile, yet it's still launched in Tomcat. When I saw this happen, it wasn't compiling because the project had a "project specific" JDK specified, and the code was checked out on a machine that didn't have that specific JDK. Eclipse defaulted to a JRE instead, not a JDK, and then the app wasn't compiled.

这也可能发生在应用程序实际上没有编译时,但它仍然在Tomcat中启动。当我看到这种情况发生时,它并没有编译,因为这个项目有一个“特定于项目的”JDK,并且代码在没有特定JDK的机器上进行了检查。Eclipse默认的是JRE,而不是JDK,然后应用程序没有被编译。

To fix it in our specific case, we just turned off "Project Specific Settings" here:

为了解决这个问题,我们在这里关闭了“项目特定设置”:

"Project | Properties | Java Compiler"

" |项目| Java编译器"

Here's more detailed info on how to do this: https://*.com/a/2540730/26510

下面是关于如何做到这一点的更详细的信息:https://*.com/a/2540730/26510。

#11


1  

Same answer as Brad Parks... more text though

和布拉德·帕克斯一样的答案……更多的文本虽然

I had the exact same problem and tried the above solutions along with many others, all with negative results. I even started out with a new, fresh Dev env and simply installed a spring-mvc-template and tried to run it directly after install (should work, but failed for me)

我也遇到了同样的问题,并尝试了以上的解决方案和许多其他的解决方案,结果都是负面的。我甚至开始使用一个新的、新的Dev env,并简单地安装了一个spring-mvc模板,并试图在安装后直接运行它(应该工作,但对我来说失败了)

For me the problem was that I was using jdk1.6 in my project, but my selected execution environment in eclipse was jdk1.7. The solution was to change the project specific execution environment settings so that this project is set to jdk1.6. Right click project --> Properties --> Java Compiler --> Check "Enable project specific settings" if it's not already checked --> select the appropriate jdk (or add if it's not installed).

对我来说,问题是我在我的项目中使用jdk1.6,但是我在eclipse中选择的执行环境是jdk1.7。解决方案是更改项目特定的执行环境设置,以便将这个项目设置为jdk1.6。右击项目——>属性——> Java编译器——>检查“启用项目特定设置”,如果它还没有检查——>选择合适的jdk(或者如果没有安装的话添加)。

I hope this can help someone and save that persons time, because I have spent the last few days looking for the answer on every corner of the Internet. I accidently stumbled upon it myself when I started to get desperate and look for the solution in areas where it (according to my brain) was less likely to be found. =)

我希望这能帮到一个人,也能挽救那个人的时间,因为在过去的几天里,我一直在互联网的每个角落寻找答案。当我开始绝望的时候,我无意中发现了它,并在它(根据我的大脑)发现的地方寻找解决方案。=)

My 2 cents. Thanks!

我的2美分。谢谢!

Edit1: Use project specific settings

使用项目特定的设置。

Edit2: Just realized Brad Parks already answered this in this very thread. Well, at least I got the "Editor"-badge out of this one =D

Edit2:刚刚意识到Brad Parks已经在这个帖子里回答了这个问题。好吧,至少我得到了"编辑"的徽章。

#12


1  

Unfortunately, this is a rather broad class error message. Yet another thing which could be going wrong is if you are missing some classes/jars. For example, if you are missing the spring-expression jar file, the dispatch-servlet is not going to be able to locate your controller no matter how hard you try and how correct everything else is configured.

不幸的是,这是一个相当广泛的类错误消息。另一件可能出错的事情是,如果你错过了一些类/jar。例如,如果您缺少spring表达式jar文件,那么dispatchservlet将无法定位您的控制器,无论您多么努力地尝试,以及如何正确配置其他所有内容。

#13


1  

I have encountered this problem in Eclipse Luna EE. My solution was simply restart eclipse and it magically started loading servlet properly.

我在Eclipse Luna EE中遇到了这个问题。我的解决方案是简单地重启eclipse,它神奇地开始正确地加载servlet。

#14


0  

What you need is to have a controller that responds to the url first which then renders your jsp. See this link for a solution.

您需要的是拥有一个对url作出响应的控制器,然后它将呈现您的jsp。请参见此链接以获得解决方案。

#15


0  

"/openStudentPage" is the page that i want to open first, i did :

"/openStudentPage"是我想先打开的页面,我做了:

 @RequestMapping(value = "/", method = RequestMethod.GET)
    public String index(Model model) {
     return "redirect:/openStudentPage";
    }

@RequestMapping(value = "/openStudentPage", method = RequestMethod.GET)
public String listStudents(Model model) {
    model.addAttribute("student", new Student());
    model.addAttribute("listStudents", this.StudentService.listStudents());
    return "index";
}

#16


-3  

change the your servlet name dispatcher to any other name .because dispatcher is predefined name for spring3,spring4 versions.

将您的servlet名称调度器更改为任何其他名称。因为dispatcher是spring3、spring4版本的预定义名称。

<servlet>
    <servlet-name>ahok</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
    <servlet-name>ashok</servlet-name>
    <url-pattern>/</url-pattern>
</servlet-mapping>