开发者

Spring Web Flow - store request param across views(jsf pages)

开发者 https://www.devze.com 2023-02-16 22:30 出处:网络
Have transition configuration for Spring Web Flow: <transition on=\"getFiles\"> <evaluate expression=\"searchService.getFiles(开发者_C百科flowScope.searchCriteria, requestParameters.fileId)\

Have transition configuration for Spring Web Flow:

<transition on="getFiles">
    <evaluate expression="searchService.getFiles(开发者_C百科flowScope.searchCriteria, requestParameters.fileId)"
     result="viewScope.file" result-type="dataModel"/>
</transition>

It's needed to invoke searchService.getFiles(flowScope.searchCriteria, requestParameters.fileId) method in two cases:

1. retrieve files (occurred on 1.xhtml)

2. sort files (occurred on 2.xhtml)

Problem is that, when sorting(step 2) files, requestParameters.fileId is lost.

Is it way to store fileId param cross 1.xhtml and 2.xhtml views?


Dont request the fileId attribute by the requestParameters. The requestParameters object is basically the request attributes. You can observe that you set the file as viewScope.file. That means that anywhere within the view you can access the file accordingly. Does viewScope.file.fileId exist?

The request is lost after the first transition, an alternative is you can try setting it into the flashScope.

Update based on your comment. Try setting it into the flash/viewScope first.

You can do it like this

<transition on="getFiles">
    <set var="flashScope.fileId" value="requestParameters.fileId"/>
    <evaluate expression="searchService.getFiles(flowScope.searchCriteria, requestParameters.fileId)"
     result="viewScope.file" result-type="dataModel"/>
</transition>
0

精彩评论

暂无评论...
验证码 换一张
取 消