尝试获取查询字符串参数并在JSP页面中采取适当的措施。
这是一个片段:
<%@ page import="com.companyx.portal.model.LDAPAttributes" %> <%@ page import="com.companyx.portal.service.LDAPAttributesLocalServiceUtil" %> <%@ page import="com.liferay.portal.model.User" %> <%@ page import="com.liferay.portal.util.PortalUtil" %> <%@ page import="javax.servlet.http.HttpServletRequest" %> <% User user = PortalUtil.getUser(request); String screenName = user.getScreenName(); LDAPAttributes attr = LDAPAttributesLocalServiceUtil.getLDAPAttributes(screenName); String store = attr.getLegacyStoreNo(); String org = request.getParameter("org"); %> ...more code here... <html> ...html code here... <form name="LoginForm" action="check_login.php"> <input type="hidden" name="LOGIN_NAME" size="20" value="<%= store %>" /> <input type="hidden" name="LOGIN_PASSWORD" size="20" value="<%= store %>" /> <input type="hidden" name="ORGANIZATION" value="<%= org %>" /> </form>
当以下行不存在时:
String org = request.getParameter("org"); ... <input type="hidden" name="ORGANIZATION" value="<%= org %>" />
该脚本可以正常工作,但是我需要从查询字符串中捕获一个’org’参数,将其写入生成的表单中并提交。但是,当这些行存在时,我会收到500错误。
有什么想法吗?
您可能正在使用PortletRequest而不是HttpServletRequest。
PortletRequest
HttpServletRequest
HttpServletRequest realRequest = PortalUtil.getHttpServletRequest(request); String organization = realRequest.getParameter("org");