问题
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