Now, I'm not interested in things like, formInterface.jsp and
formProcess.jsp approach
I'd like to construct the program flow like this:
/*
if the form is submitted
process the request ...
else
provide an interface (web form) to interact with a user
No javabean and all that at this point.
*/
And as you can see the following code is fine, Tomcat (J2EE compliant
web server, v5.5.17) can compile it, however, I definitely don't want
to add out.println to each element in a form for the interface, see the
bottom part of the following code snip. What better way out there?
The second question is, googling for jsp tutorial essentially produce
garbage (too basic to be of any use), any pointer in this regard would
be appreciated as well.
Thanks.
<html>
<head>
<title>JSP - JDBC -- MS SQL Server 2000 Connection Test</title>
</head>
<body>
<!-- Iterate through the data in the result set and display it. -->
<table>
<%@ page language="java" import="java.sql.*" %>
<%! boolean submitted = false; %>
<%! String CompanyName = ""; %>
<%
if (submitted == true)
{
out.println(" <tr><td>form submitted</td></tr>");
}
else
{
out.println(" <tr><td>form not submitted</td></tr>");
}
%>
<%--
<tr><td colspan="2">form submitted </td> </tr>
<tr>
<th>Supplier ID</th>
<th>Company Name</th>
</tr>
form interface
<tr>
<form name="sqlTest" action="testForm.jsp" method="post">
<th>Company Name:</th>
<th><input value="" name="CompanyName" size="10" value=""></th>
<th><input type="hidden" name="submitted" value="true">
<th><input type="submit" value="Find More about the Company"></th>
</form>
</tr>
--%>
</table>
</body>
</html>