Hello.
I would like to execute a
JSP page from a
java client without a browser.
Sample.jsp
[begin code]-----------------------------------------------------------------------------
<%
. . .
// login
PassportLogon pl = new PassportLogon();
if (pl.isValidUser(userId, password, host, port, opsys) != true) { }
else
{
session.setAttribute("ConnectionEstablished", sConnectionInd);
%>
<html>
<body>
<form name="XXXXX" action="servlet/PollerMaintenance" method="POST">
Region: <%= request.getParameter("ppregion") %>
Touchpoint: <%= request.getParameter("TouchpointId") %>
Action: <%= request.getParameter("Action") %>
<input type="hidden" name="TouchpointId" value=<%= request.getParameter("TouchpointId") %> >
<input type="hidden" name="Action" value=<%= request.getParameter("Action") %> >
</form>
<script language="JavaScript" type="text/javascript">
document.XXXXX.submit();
</script>
</body>
</html>
<% } %>
<% } %>
[end code]-----------------------------------------------------------------------------
java client
[begin code]-----------------------------------------------------------------------------
. . .
String strURL = "http://" + Server_in + ":" + Port_in + "Sample.jsp" + params ;
URL myURL = new URL(strURL);
HttpURLConnection huc = (HttpURLConnection) myURL.openConnection();
huc.setRequestMethod("POST");
huc.connect();
OutputStream rawOutStream = huc.getOutputStream(); // I get the HTML page. BUT... FORM is NOT submitted automatically with the "document.WOTASK.submit();"
[end code]-----------------------------------------------------------------------------
Comments
What I can do:
I can connect ang get HTML page. BUT... FORM is NOT submitted automatically with the "document.WOTASK.submit();"
I can call Sample.jsp from my firefox web browser and the JSP page connects and submits page.
I can create a vbscript which instantiates a web browser class and the JSP page connects and submits page.
What I can not do:
Create a Java program which runs on a UNIX server that can connect to web server and call a JSP page which performs java scripting code.
No Browser application.
Is there a Java class which can be used to call&execute a JSP page within JAVA?