将变量传递给jsp

将变量传递给jsp

问题描述:

我有一个Java类

public void doView(
        RenderRequest renderRequest, RenderResponse renderResponse)
        throws IOException, PortletException {

//I need to pass the string variable over to my jsp
ThemeDisplay themeDisplay = (ThemeDisplay) renderRequest.getAttribute(WebKeys.THEME_DISPLAY);
String sLang_Id = themeDisplay.getLanguageId();

include("/html/mypackage/view.jsp", renderRequest, renderResponse);

}

我如何在我的jsp中阅读sLang_Id

How would I read sLang_Id in my jsp

 <c:out value="${sLang_Id}" /> ???

在调用include方法之前添加以下内容:

Add the following before your call to the include method:

renderRequest.setAttribute("sLang_Id", sLang_Id);

可以在 http上参考的

API. ://portals.apache.org/pluto/portlet-2.0-apidocs/index.html?javax/portlet/RenderRequest.html

.