You are here

Using logged-in User in a Post action

Submitted by fontnest on Tue, 06/23/2015 - 17:27

I am NOT a jsp person, but I managed some time ago to find the jsp page in Luminis 4 where the Person manager grabs the logged-in user information to pass as needed.

I've used this in a few instances, customizing it as needed, but now I need to grab the ID, append some furnished items and Post it to a url for an SSO operation to a third party online application (Maven "Alcohol Training" - I never needed that in college-).

Anyway, the url constructs just fine, but the operation being carried out is a "GET" instead of "POST". Not being a JSP guy, I don't know how to end the Get operation that grabs the logged-in user, then POST the assembled url.

Any help from your JSP pros or even amateurs would be appreciated.

Here's my jsp page, edited to remove actual urls and ID's.

<%@ page language="java" %>
<%@ page import="java.util.*" %>
<%@ page import="java.sql.*" %>
<%@ page import="" %>
<%@ page import="" %>
<%@ page import="" %>
<%@ page import="com.pipeline.web.WebUtil" %>

Some Login

String redirectUrl = "";
String username = "";

if (WebUtil.checkRequest(request, response)) {
byte[] sessionId = WebUtil.getUserSession( request, response );
PersonManager_3 cPersonManager = (PersonManager_3)BomManagerFactory.getManager( PersonManager_3.ID );
Person_3 person = cPersonManager.getCurrentPerson();
username = person.getLogin();

if (username != "")
redirectUrl = redirectUrl + "&student_id=" + username + "&curriculum_id=5" + "&first_name=" + username + "&last_name= " + "&email_address=" + username + "";
response.sendRedirect( redirectUrl );


out.println("There has been a serious error!!");


David Fontenot

Luminis Version:

There are lots of ways to accomplish this, but one way would be to create a function, then call it, like so:

<%@page import="*" %>
<%@page import="*" %>
<%@page import="java.util.*" %>
public String postData(String urlToRead, String data) {
URL url;
HttpURLConnection conn;
BufferedReader rd;
String line;
String result = "";
try {
url = new URL(urlToRead);
conn = (HttpURLConnection) url.openConnection();
conn.setRequestProperty("Content-Length", data.length() + "");
conn.setRequestProperty("Content-Type", "application/json");
OutputStream os = conn.getOutputStream();
rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
while ((line = rd.readLine()) != null) {
result += line;
} catch (IOException e) {
} catch (Exception e) {
return result;


In this case, I'm sending json data. More jsp/iPerson info here: