Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
chenpeng_fei
spring-framework
提交
d3c539a9
S
spring-framework
项目概览
chenpeng_fei
/
spring-framework
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
spring-framework
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
d3c539a9
编写于
9月 28, 2015
作者:
J
Juergen Hoeller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Portlet MVC documentation consistently refers to Portlet 2.0 spec (JSR-286)
Issue: SPR-13513
上级
a9fbbc55
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
66 addition
and
13 deletion
+66
-13
src/asciidoc/web-portlet.adoc
src/asciidoc/web-portlet.adoc
+66
-13
未找到文件。
src/asciidoc/web-portlet.adoc
浏览文件 @
d3c539a9
...
...
@@ -5,17 +5,14 @@
[[
portlet
-
introduction
]]
==
Introduction
.
JSR
-
168
The
Java
Portlet
Specification
.
JSR
-
286
The
Java
Portlet
Specification
****
For
more
general
information
about
portlet
development
,
please
review
a
whitepaper
from
Oracle
entitled
http
://
www
.
oracle
.
com
/
technetwork
/
java
/
index
-
raji
-
test
-
141933.
html
[
"Introduction
to JSR 168"
],
and
of
course
the
http
://
jcp
.
org
/
aboutJava
/
communityprocess
/
final
/
jsr168
/[
JSR
-
168
Specification
]
itself
.
For
more
general
information
about
portlet
development
,
please
review
the
https
://
jcp
.
org
/
en
/
jsr
/
detail
?
id
=
286
[
JSR
-
286
Specification
]
itself
.
****
In
addition
to
supporting
conventional
(
servlet
-
based
)
Web
development
,
Spring
also
supports
JSR
-
168
Portlet
development
.
As
much
as
possible
,
the
Portlet
MVC
framework
is
supports
JSR
-
286
Portlet
development
.
As
much
as
possible
,
the
Portlet
MVC
framework
is
a
mirror
image
of
the
Web
MVC
framework
,
and
also
uses
the
same
underlying
view
abstractions
and
integration
technology
.
So
,
be
sure
to
review
the
chapters
entitled
<<
mvc
>>
and
<<
view
>>
before
continuing
with
this
chapter
.
...
...
@@ -23,7 +20,7 @@ abstractions and integration technology. So, be sure to review the chapters enti
[
NOTE
]
====
Bear
in
mind
that
while
the
concepts
of
Spring
MVC
are
the
same
in
Spring
Portlet
MVC
,
there
are
some
notable
differences
created
by
the
unique
workflow
of
JSR
-
168
portlets
.
there
are
some
notable
differences
created
by
the
unique
workflow
of
JSR
-
286
portlets
.
====
The
main
way
in
which
portlet
workflow
differs
from
servlet
workflow
is
that
the
request
...
...
@@ -53,7 +50,7 @@ guide the user through controlled navigations that drive business processes.
For
more
information
about
SWF
,
consult
the
Spring
Web
Flow
website
.
****
The
dual
phases
of
portlet
requests
are
one
of
the
real
strengths
of
the
JSR
-
168
The
dual
phases
of
portlet
requests
are
one
of
the
real
strengths
of
the
JSR
-
286
specification
.
For
example
,
dynamic
search
results
can
be
updated
routinely
on
the
display
without
the
user
explicitly
rerunning
the
search
.
Most
other
portlet
MVC
frameworks
attempt
to
completely
hide
the
two
phases
from
the
developer
and
make
it
look
...
...
@@ -499,7 +496,7 @@ can instantiate an existing `Portlet` as a `Controller` as follows:
----
This
can
be
very
valuable
since
you
can
then
use
interceptors
to
pre
-
process
and
post
-
process
requests
going
to
these
portlets
.
Since
JSR
-
168
does
not
support
any
kind
post
-
process
requests
going
to
these
portlets
.
Since
JSR
-
286
does
not
support
any
kind
of
filter
mechanism
,
this
is
quite
handy
.
For
example
,
this
can
be
used
to
wrap
the
Hibernate
`
OpenSessionInViewInterceptor
`
around
a
MyFaces
JSF
Portlet
.
...
...
@@ -791,7 +788,7 @@ The following example shows how to use the `CommonsPortletMultipartResolver`:
Of course you also need to put the appropriate jars in your classpath for the multipart
resolver to work. In the case of the `CommonsMultipartResolver`, you need to use
`commons-fileupload.jar`. Be sure to use at least version 1.1 of Commons FileUpload as
previous versions do not support JSR-
168
Portlet applications.
previous versions do not support JSR-
286
Portlet applications.
Now that you have seen how to set Portlet MVC up to handle multipart requests, let'
s
talk
about
how
to
actually
use
it
.
When
`
DispatcherPortlet
`
detects
a
multipart
request
,
...
...
@@ -1191,6 +1188,62 @@ using this annotation:
}
----
As
of
Spring
3.0
,
there
are
dedicated
`@
ActionMapping
`
and
`@
RenderMapping
`
(
as
well
as
`@
ResourceMapping
`
and
`@
EventMapping
`)
annotations
which
can
be
used
instead
:
[
source
,
java
,
indent
=
0
]
[
subs
=
"verbatim,quotes"
]
----
@
Controller
@
RequestMapping
(
"EDIT"
)
@
SessionAttributes
(
"site"
)
public
class
PetSitesEditController
{
private
Properties
petSites
;
public
void
setPetSites
(
Properties
petSites
)
{
this
.
petSites
=
petSites
;
}
@
ModelAttribute
(
"petSites"
)
public
Properties
getPetSites
()
{
return
this
.
petSites
;
}
@
RenderMapping
//
default
(
action
=
list
)
public
String
showPetSites
()
{
return
"petSitesEdit"
;
}
@
RenderMapping
(
params
=
"action=add"
)
public
String
showSiteForm
(
Model
model
)
{
//
Used
for
the
initial
form
as
well
as
for
redisplaying
with
errors
.
if
(
!model.containsAttribute("site")) {
model
.
addAttribute
(
"site"
,
new
PetSite
());
}
return
"petSitesAdd"
;
}
@
ActionMapping
(
params
=
"action=add"
)
public
void
populateSite
(@
ModelAttribute
(
"site"
)
PetSite
petSite
,
BindingResult
result
,
SessionStatus
status
,
ActionResponse
response
)
{
new
PetSiteValidator
().
validate
(
petSite
,
result
);
if
(
!result.hasErrors()) {
this
.
petSites
.
put
(
petSite
.
getName
(),
petSite
.
getUrl
());
status
.
setComplete
();
response
.
setRenderParameter
(
"action"
,
"list"
);
}
}
@
ActionMapping
(
params
=
"action=delete"
)
public
void
removeSite
(@
RequestParam
(
"site"
)
String
site
,
ActionResponse
response
)
{
this
.
petSites
.
remove
(
site
);
response
.
setRenderParameter
(
"action"
,
"list"
);
}
}
----
[[
portlet
-
ann
-
requestmapping
-
arguments
]]
...
...
@@ -1435,7 +1488,7 @@ configuration.
[[portlet-deployment]]
== Portlet application deployment
The process of deploying a Spring Portlet MVC application is no different than deploying
any JSR-
168
Portlet application. However, this area is confusing enough in general that
any JSR-
286
Portlet application. However, this area is confusing enough in general that
it is worth talking about here briefly.
Generally, the portal/portlet container runs in one webapp in your servlet container and
...
...
@@ -1444,7 +1497,7 @@ container webapp to make calls into your portlet webapp it must make cross-conte
to a well-known servlet that provides access to the portlet services defined in your
`portlet.xml` file.
The JSR-
168
specification does not specify exactly how this should happen, so each
The JSR-
286
specification does not specify exactly how this should happen, so each
portlet container has its own mechanism for this, which usually involves some kind of
"deployment process" that makes changes to the portlet webapp itself and then registers
the portlets within the portlet container.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录