DispatcherPortletTests.java 文件源码

java
阅读 18 收藏 0 点赞 0 评论 0

项目:class-guard 作者:
public void testSimpleFormViewWithSessionAndBindOnNewForm() throws Exception {
    MockRenderRequest renderRequest = new MockRenderRequest();
    MockRenderResponse renderResponse = new MockRenderResponse();
    renderRequest.setParameter("action", "form-session-bind");
    renderRequest.setParameter("age", "30");
    TestBean testBean = new TestBean();
    testBean.setAge(40);
    SimplePortletApplicationContext ac =
            (SimplePortletApplicationContext)simpleDispatcherPortlet.getPortletApplicationContext();
    String formAttribute = ac.getFormSessionAttributeName();
    PortletSession session = new MockPortletSession();
    session.setAttribute(formAttribute, testBean);
    renderRequest.setSession(session);
    simpleDispatcherPortlet.doDispatch(renderRequest, renderResponse);
    assertEquals("35", renderResponse.getContentAsString());
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号