java 使用 JMeter 测试 JSF 应用程序 - ViewState 问题
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12734017/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Testing JSF application with JMeter - ViewState issue
提问by LancerX
All day I try to run JMeter tests of my JSF application.
I am aware of ViewState
, but it seemed to be quite simple issue. I prepared Regular Expression Extractor:
我整天都在尝试对我的 JSF 应用程序运行 JMeter 测试。我知道ViewState
,但这似乎是一个很简单的问题。我准备了正则表达式提取器:
Reference Name: jsfViewState
Regular expression: id=\"javax.faces.ViewState\" value=\"(.+?)\"
Template $
Match No. 1
The following samplers are created with proxy and recording.
以下采样器是使用代理和录音创建的。
First request /TourJSF/pages/protected/admin/addTourPage.xhtml
. This is GET
request from which ViewState will be extracted.
第一个请求/TourJSF/pages/protected/admin/addTourPage.xhtml
。这是GET
从中提取 ViewState 的请求。
The POST
request /TourJSF/pages/protected/admin/addTourPage.xhtml
where .${jsfViewStete}
is passed into javax.faces.ViewState
该POST
请求/TourJSF/pages/protected/admin/addTourPage.xhtml
在哪里。${jsfViewStete}
被传入javax.faces.ViewState
The second GET
request, now very important in this case.
第二个GET
请求,现在在这种情况下非常重要。
The results:
结果:
First GET
. On the right we can see value of ViewState.
首先GET
。在右侧我们可以看到 ViewState 的值。
Debug Sampler
which shows that jsfViewState value is correct. We can compare it with the previous screen.
Debug Sampler
这表明 jsfViewState 值是正确的。我们可以将其与之前的屏幕进行比较。
javax.faces.application.ViewExpiredException: viewId:/pages/protected/admin/addTourPage.xhtml - View /pages/protected/admin/addTourPage.xhtml could not be restored.
I found some blogs and topics about this issue but many of them were unsolved. If it is needed I can put links to these topics. I am really confused...
我找到了一些关于这个问题的博客和主题,但其中许多都没有解决。如果需要,我可以放置这些主题的链接。我真的很困惑...
Where is the issue? Maybe something with
问题出在哪里?也许有些东西
jsessionid
?HTTP Header Manager
in everyHTTP Request
? I deletedHTTP Header Manager
but nothing changed.- something with JSF apllication? When I added context-param
com.sun.faces.enableRestoreView11Compatibility
intoweb.xml
, there was noViewExpiredException
but the content of returned page was not correct.
jsessionid
?HTTP Header Manager
在每个HTTP Request
? 我删除了HTTP Header Manager
但没有任何改变。- JSF 应用程序的东西?当我将 context-param 添加
com.sun.faces.enableRestoreView11Compatibility
到 中时web.xml
,没有ViewExpiredException
但返回页面的内容不正确。
采纳答案by UBIK LOAD PACK
Aren't you missing a Cookie Manager ?
您不是缺少 Cookie 管理器吗?
See:
看:
Also read this:
另请阅读: