一尘不染

将变量传递给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);

}

我将如何阅读sLang_Id我的jsp

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

阅读 250

收藏
2020-06-10

共1个答案

一尘不染

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

renderRequest.setAttribute("sLang_Id", sLang_Id);

可在http://portals.apache.org/pluto/portlet-2.0-apidocs/index.html?javax/portlet/RenderRequest.html上获得可供参考的API

2020-06-10