0
我在Spring Webflow 2.3中使用JSF2.0。爲什麼我的重定向webflow無法找到我的bean並使用它
我一直在試圖獲取有關在我的頁面中點擊了哪些鏈接以及點擊了多少次的信息。現在,當我停留在流程中並且轉到另一個流程時,但是當我重定向然後返回時,它會重置我的bean。我覺得我錯過了一些東西,但我不知道是什麼。
我已經嘗試了一切,我的小腦袋可以考慮,我試過研究,但我的猜測是我的搜索參數不正確,導致我找不到任何幫助。
這是我支持bean:
@SessionScoped
public class CountBean implements Serializable{
private static final long serialVersionUID = 7498596369206276696L;
private static Log logger = LogFactory.getLog(CountBean.class);
private String link;
private Map<String,Integer> counter;
public CountBean(){
if(counter == null || counter.isEmpty()){
counter = new LinkedHashMap<String,Integer>();
}
link = null;
}
public void countTheCount(){
if(link != null){
int value;
if(counter.containsKey(link)){
value = counter.get(link);
value++;
counter.put(link, value);
} else {
value = 1;
counter.put(link, value);
}
logger.debug("Click: "+link+" , times: "+value);
}
}
public String getLink() {
return link;
}
public void setLink(String link) {
this.link = link;
}
}
這是我的流程:
<flow xmlns="http://www.springframework.org/schema/webflow"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/webflow
http://www.springframework.org/schema/webflow/spring-webflow-2.0.xsd">
<var name="testBean" class="be.admb.myadmbresearch.beans.TestBean" />
<var name="countBean" class="be.admb.myadmbresearch.beans.CountBean" />
<view-state id="test-view" model="testBean">
<transition on="logTest">
<evaluate expression="testBean.testWarning()" />
<evaluate expression="countBean.countTheCount()" />
</transition>
<transition on="gotoxy" to="sample-view">
<evaluate expression="countBean.countTheCount()" />
</transition>
<transition on="gotoab" to="sample-redirect-view">
<evaluate expression="countBean.countTheCount()" />
</transition>
<transition on="gotogoogle" to="gotoGoogle-view">
<evaluate expression="countBean.countTheCount()" />
</transition>
</view-state>
<view-state id="sample-redirect-view" view="externalRedirect:contextRelative:sample.html" />
<view-state id="gotoGoogle-view" view="externalRedirect:http://www.google.be" />
<view-state id="sample-view">
<transition on="keerdekewere" to="test-view">
<evaluate expression="countBean.countTheCount()"/>
</transition>
</view-state>
編輯:忘了補充重定向樣品流:
<var name="countBean" class="be.admb.myadmbresearch.beans.CountBean" />
<view-state id="sample-view" >
<transition on="keerdekewere" to="test-view">
<evaluate expression="countBean.countTheCount()"/>
</transition>
</view-state>
<view-state id="test-view" view="externalRedirect:contextRelative:test.html" />
如果有人可以他或者甚至想到我會非常感激的事情。
謝謝先進。
拉斐爾