由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Java版 - spring mvc 里面 view 必须是 jsp吗?
相关主题
still web.xml question大家都是怎么自学J2EE的
servlet-mapping causing http 404 errorSpring + Jersey 的 REST API, servlet context 能看到 Spring (转载)
Spring MVC question.Java EE 习题 2
spring question如何在自定义的错误页面中捕获错误信息
Run Servlet with TomcatURL 的问题怎么解决?
[转载] Urgent Help needed about Java Servlet?Eclipse不能保存UTF-8文件?
JSP tag file and EL warnings大牛能不能通俗易懂的说说spring
求助!Tomcat下设置servlets的问题How do I send cookies from a servlet?
相关话题的讨论汇总
话题: jsp话题: html话题: name话题: property话题: value
进入Java版参与讨论
1 (共1页)
s****s
发帖数: 628
1
为什么html page 做view page 就不行? 报错:
no mapping found for http request with uri in Dispatherservlet...
jsp page 就没问题.
现在用的是internalresourceviewresolver.
我的mapping没有问题.





改成 ".html"/> 就不行了. 不知道为什么? 难道不能用"internalresourceviewresolver"?
f**********3
发帖数: 295
2
那你看Dispatherservlet.xml的mapping啊

【在 s****s 的大作中提到】
: 为什么html page 做view page 就不行? 报错:
: no mapping found for http request with uri in Dispatherservlet...
: jsp page 就没问题.
: 现在用的是internalresourceviewresolver.
: 我的mapping没有问题.
:
:
:

x****d
发帖数: 1766
3
可以是excel,pdf,sitemesh,tiles,thymeleaf,xml,json,可以设的,怎么设查
文档吧。
x****d
发帖数: 1766
4
通常是在这个文件里设view resolver, 和suffix。

【在 f**********3 的大作中提到】
: 那你看Dispatherservlet.xml的mapping啊
x****d
发帖数: 1766
5
设成html不是不行,但怎么把那个m传个v呢? 用html就不是mvc了吧?
s****s
发帖数: 628
6
什么意思, 详细解释下?

【在 x****d 的大作中提到】
: 设成html不是不行,但怎么把那个m传个v呢? 用html就不是mvc了吧?
x****d
发帖数: 1766
7
mvc is model view contriller, right.
using html, you got v, your controller can dispatch the request to view/html
. but how can the view get model/data? supposed it should be controlled by
the controller, too, right?
if you don't need model that is controlled by the controller, why you need
controller in the first place, you can serve html directly. vc = v(only).
if you use javascript to get data into html, that is not mvc no more, either.

【在 s****s 的大作中提到】
: 什么意思, 详细解释下?
s****s
发帖数: 628
8
你的解释不能完全同意.
1. html page 可以接收data, 比如用thymeleaf.
2. 我现在的问题是, 我的html page不需要从model那里拿到data. 这样也不能用在
spring mvc上吗?
但是相反,如果一个jsp page不需要从model那里拿到data, 它也能作为spring mvc的
view.
那问题就是: html page 能不能做为spring mvc的view吗?
我觉得应该跟viewresolver的设置有关,但读了半天,还没找到.

html
either.

【在 x****d 的大作中提到】
: mvc is model view contriller, right.
: using html, you got v, your controller can dispatch the request to view/html
: . but how can the view get model/data? supposed it should be controlled by
: the controller, too, right?
: if you don't need model that is controlled by the controller, why you need
: controller in the first place, you can serve html directly. vc = v(only).
: if you use javascript to get data into html, that is not mvc no more, either.

d****i
发帖数: 4809
9
为什么不直接用rest呢? 这样不简单些吗?

view

【在 s****s 的大作中提到】
: 为什么html page 做view page 就不行? 报错:
: no mapping found for http request with uri in Dispatherservlet...
: jsp page 就没问题.
: 现在用的是internalresourceviewresolver.
: 我的mapping没有问题.
:
:
:

x****d
发帖数: 1766
10
i see. if that is the case, easy. use this code.
class="org.thymeleaf.templateresolver.ServletContextTemplateResolver">



相关主题
[转载] Urgent Help needed about Java Servlet?大家都是怎么自学J2EE的
JSP tag file and EL warningsSpring + Jersey 的 REST API, servlet context 能看到 Spring (转载)
求助!Tomcat下设置servlets的问题Java EE 习题 2
进入Java版参与讨论
x****d
发帖数: 1766
11
or you can tell the container use jsp engine to serve html.

jsp
*.html


ServletContextTemplateResolver">

【在 x****d 的大作中提到】
: i see. if that is the case, easy. use this code.
: : class="org.thymeleaf.templateresolver.ServletContextTemplateResolver">
:
:
:
:

s****s
发帖数: 628
12
这个work.
我觉得问题应该是:
default servlet 是jsp servlet. 所以, in order to handle .html, we need
regist .html
to jsp servlet engine.

【在 x****d 的大作中提到】
: or you can tell the container use jsp engine to serve html.
:
: jsp
: *.html
:

:
: ServletContextTemplateResolver">

f**********3
发帖数: 295
13
不就是这一行

该了就行了

view

【在 s****s 的大作中提到】
: 为什么html page 做view page 就不行? 报错:
: no mapping found for http request with uri in Dispatherservlet...
: jsp page 就没问题.
: 现在用的是internalresourceviewresolver.
: 我的mapping没有问题.
:
:
:

x****d
发帖数: 1766
14
关键是没有这个use case,你说说为啥您非要用html?

【在 s****s 的大作中提到】
: 这个work.
: 我觉得问题应该是:
: default servlet 是jsp servlet. 所以, in order to handle .html, we need
: regist .html
: to jsp servlet engine.

d****i
发帖数: 4809
15
现在是不是都用HTML5了?JSP好像有点过时了吧。

【在 x****d 的大作中提到】
: 关键是没有这个use case,你说说为啥您非要用html?
x****d
发帖数: 1766
16
jsp不是html5么?有啥关系?

【在 d****i 的大作中提到】
: 现在是不是都用HTML5了?JSP好像有点过时了吧。
s****s
发帖数: 628
17
我刚调通了,both .jsp and .html can be as view page now. 原因应该就是那个.
case应该有吧, 我目前还在学习阶段, 没有太多的认识.

【在 x****d 的大作中提到】
: 关键是没有这个use case,你说说为啥您非要用html?
d****i
发帖数: 4809
18
server-side technology vs. client-side technology,现在不管什么做backend,趋
势是Python, PHP,Java, Ruby, Node, Perl, .NET的都基本上把server-side
rendering给换成纯客户端的HTML5了。

【在 x****d 的大作中提到】
: jsp不是html5么?有啥关系?
x****d
发帖数: 1766
19
学习阶段你折腾这个干啥?use case实际工作中怎么会有?

【在 s****s 的大作中提到】
: 我刚调通了,both .jsp and .html can be as view page now. 原因应该就是那个.
: case应该有吧, 我目前还在学习阶段, 没有太多的认识.

1 (共1页)
进入Java版参与讨论
相关主题
How do I send cookies from a servlet?Run Servlet with Tomcat
理解Java Servlets [fwd][转载] Urgent Help needed about Java Servlet?
Another Servlet Problem:Browser CachingJSP tag file and EL warnings
need your comments求助!Tomcat下设置servlets的问题
still web.xml question大家都是怎么自学J2EE的
servlet-mapping causing http 404 errorSpring + Jersey 的 REST API, servlet context 能看到 Spring (转载)
Spring MVC question.Java EE 习题 2
spring question如何在自定义的错误页面中捕获错误信息
相关话题的讨论汇总
话题: jsp话题: html话题: name话题: property话题: value