我用钩子连接登录portlet来定制它的布局/设计,它运行得很好.

但是当用户输入错误/不正确(身份验证失败)时,我的登录钩子的布局/设计就会变成这样.

即使身份验证失败,我也希望具有相同的布局。我怎样才能做到这一点?
提前谢谢你。
以下是我在登录struts动作钩子中的代码
public void processAction(
org.apache.struts.action.ActionMapping actionMapping,
org.apache.struts.action.ActionForm actionForm,
PortletConfig portletConfig, ActionRequest actionRequest,
ActionResponse actionResponse) throws Exception {
}
protected boolean isCheckMethodOnProcessAction() {
return _CHECK_METHOD_ON_PROCESS_ACTION;
}
protected void login(ThemeDisplay themeDisplay,
ActionRequest actionRequest, ActionResponse actionResponse)
throws Exception {
}
protected void postProcessAuthFailure(ActionRequest actionRequest,
ActionResponse actionResponse, StrutsPortletAction originalStrutsPortletAction, PortletConfig portletConfig) throws Exception {
ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest
.getAttribute(WebKeys.THEME_DISPLAY);
PortletURL portleturl = PortletURLFactoryUtil.create(actionRequest,
"secondlogin_WAR_triumainportlet", themeDisplay.getPlid(),
PortletRequest.RENDER_PHASE);
portleturl.setParameter("saveLastPath", Boolean.FALSE.toString());
String redirect = ParamUtil.getString(actionRequest, "redirect");
if (Validator.isNotNull(redirect)) {
portleturl.setParameter("redirect", redirect);
}
else{
portleturl.setParameter("loginError", redirect);
}
portleturl.setWindowState(WindowState.MAXIMIZED);
actionResponse.sendRedirect(portleturl.toString());
originalStrutsPortletAction.processAction(originalStrutsPortletAction,
portletConfig, actionRequest, actionResponse);
}
private static final boolean _CHECK_METHOD_ON_PROCESS_ACTION = false;
private static final Log _log = LogFactoryUtil.getLog(Sample.class);发布于 2015-06-17 12:04:36
您需要调整错误消息的样式。如果发生错误,此片段和另一个html片段将显示在响应页上。他们都有相同的标记。
<div class="alert alert-error"> Authentification failed. Please try again</div>因此,您需要对这些,甚至周围的包装div进行样式设计。由于我没有被告知你如何改变css,我不能给你任何进一步或更详细的建议。
重新阅读你的问题后编辑:也许我确实理解错了你的问题。您所指的是页面本身的布局是否可能?这将与使用maximized=true进行响应呈现相关。我认为您可以通过覆盖StrutsAction来修改这种行为。
EDIT2根据您在问题中的编辑;)
请试试这个:
portleturl.setWindowState(WindowState.NORMAL);https://stackoverflow.com/questions/30889586
复制相似问题