Trying to get a query string parameter and take an appropriate action in a JSP page.
Here is a snippet:
<%@ 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>
When the following lines are absent:
String org = request.getParameter("org");
...
<input type="hidden" name="ORGANIZATION" value="<%= org %>" />
The script works just fine, but I need to capture an ‘org’ parameter from the query string, write it into the generated form and submit it. When those lines are present, though, I get a 500 error.
Any thoughts?
Chances are you’re working with the
PortletRequestand not theHttpServletRequest.