Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_jsp thread: how to POST to a slected page that is retireved from the database and let user select which server to go


Message #1 by ngngachuen@i... on Tue, 6 Feb 2001 14:57:28 -0000
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.

  Return to Index