Passing variable to jsp

早过忘川 提交于 2020-01-04 02:59:07

问题


I have a java class

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);

}

How would I read sLang_Id in my jsp

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

回答1:


Add the following before your call to the include method:

renderRequest.setAttribute("sLang_Id", sLang_Id);

API available for reference at http://portals.apache.org/pluto/portlet-2.0-apidocs/index.html?javax/portlet/RenderRequest.html .



来源:https://stackoverflow.com/questions/8410283/passing-variable-to-jsp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!