pro_jsp thread: how to POST to a slected page that is retireved from the database and let user select which server to go
Ok, here is the code, I tested and it works:
---------------------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Untitled</title>
</head>
<body>
<SCRIPT LANGUAGE="javascript">
function redirectToServer(form)
{
var target = "Sorry.jsp"; // if user didn't enter anything, just for
testing
if (form.ServerName.value != '')
target = form.ServerName.value;
form.action = target;
return true;
}
</SCRIPT>
<form name="redirect" method="post" onsubmit="return redirectToServer(this)">
<label>Server Name:</label><input type="text" size="30" name="ServerName" value="">
<input type="submit" value="GO">
</form>
</body>
</html>
------------------------------------------------------------------
You just need to include your form input element name in java script.
but as I suggest you first time, I would still prefer to redirect user on
the same server where login came from, on that way you are positive that
action will be set properly even the client doesn't support scripting.