如何在 JBoss Portal 2.5.4 中将信息从 servlet 获取到 portlet
我有一个基于 JBoss Portal 2.5.4 构建的门户,需要一些 I18N。 在login.jsp 页面(位于portal-server.war 中)上,我们添加了语言切换。 该页面上的链接之一是“忘记密码”功能。
出于与外观相关的原因,ForgetPassword 页面在我们的 JBoss Portal 中实现为最大化的 portlet。 但是,显然,还没有用户对象,因为还没有登录。
那么如何将用户在 login.jsp 上选择的区域设置信息传递到忘记密码 jsp 中呢?
我尝试过:
- 会话变量(不行,它们不会跨越战争)
- cookies(JBoss Portal 吞掉它们)
- URL 参数(JBoss Portal 也吞掉它们)
- System.setProperty() - 当它们到达 ForgetPassword 时jsp,它们被重置。
这一切都在 Windows Vista 或 2003 上运行。
我是否缺少一些明显的技术? 我是否只需要硬着头皮将 ForgetPassword 页面重新组织为 servlet,以便获取 URL 参数?
I have a portal built on JBoss Portal 2.5.4 that needs to have some I18N. On the login.jsp page (which is in portal-server.war), we added a language switch. One of the links on the page is to the Forget Password facility.
For reasons related to look-and-feel, the ForgetPassword page is implemented as a maximized portlet inside our JBoss Portal. But, obviously, there's no user object yet, since there hasn't been a login.
So how do I pass the locale information that the user selects on the login.jsp down into the Forget Password jsp?
I've tried:
- session variables (no go, they don't cross over the wars)
- cookies (JBoss Portal swallows them)
- URL parameters (JBoss Portal swallows them too)
- System.setProperty() - by the time they get to the ForgetPassword jsp, they're reset.
This is all running on Windows Vista or 2003.
Is there some obvious technique I'm missing? Do I just need to bite the bullet and reorganize my ForgetPassword page as a servlet so I can get URL parameters?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,我找到了一种机制来做到这一点 - 在portal-object.xml中创建一个新的portlet窗口(ForgotPasswordWindow_de):
它指向portlet-instances.xml中的一个新的portlet实例(UserMgmtPortletInstance_de),它指向同一个Portlet,定义的语言首选项。
然后,在 Portlet doView() 代码中,我找到此首选项,并设置一个属性。
然后,在 jsp 中,我查看属性并设置区域设置。
首先,登录页面有一个开关,如果语言是德语,它会调用 ForgotPasswordWindow_de 而不是 ForgotPasswordWindow_en
Ok, I found one mechanism to do this - create a new portlet window (ForgotPasswordWindow_de) in portal-object.xml:
which points to a new portlet instance (UserMgmtPortletInstance_de) in portlet-instances.xml, which pointed to the same Portlet, with a lang preference defined.
Then, in the Portlet doView() code, I find this preference, and set an attribute.
Then, in the jsp, I look at the attribute, and set the locale.
And to kick it all off, the login page has a switch, and if the language is german, it calls ForgotPasswordWindow_de instead of ForgotPasswordWindow_en