|
-
JSP Input/output to html form
I am using JSP with beans and have code that will take an input from the a html form text field, call a bean, and update an oracle database. I understand how to use the request.getParameter but what I want to do is populate the form fields, here is what I am trying to do:
1. Enter a PO number and pull up the description.
2. Edit the description on the form.
3. Post the form and apply the update to the database.
4. Repopulate the form field with the new description which can be edited again.
An easy task in VB and elsewhere but I don't know how to make it work in JSP html. I have steps 1, 2 and 3 working fine, I just want to redisplay the new value so it can be updated again.
This is a simple example, when finished it will show all the lines that go with a PO.
<form method="post" action="PO.jsp" name="POUpdate"
onSubmit="return chkFields(PO);"
<table width="40%" bgcolor="green" valign="top" border="0" cellspacing="0" cellpadding="5">
</table>
<table width="40%" height="5%" bgcolor="#3388ee" valign="top" border="0" cellspacing="0" cellpadding="10" style="border-collapse: collapse" bordercolor="#111111">
<tr><td align="center"><font color="white" size="4">PO/Desc:</font></td>
<td><input type="text" name="PO" maxlength="7" size="12"></td><td><input type="text" name="Description" maxlength="40" size="12"></td></tr>
<tr><td colspan="2"><input type="submit" name="getDetails" value="Get details"></td>
<td colspan="2"><input type="submit" name="updDesc" value="Update Description"></td></tr>
<br>
</table>
</form>
<% POIn = request.getParameter("PO"); %>
<% Desc = request.getParameter("Description"); %>
<% // POWCon is my class that gets values and does the update
if (POIn != null && POIn.length() !=0) {
out.println("<br> inside if - PO value - " + POIn.length());
out.println("desc value - " + POIn);
POWCon.executeGetPO();
} %>
<% int i =0; // POWCon is my class that gets values and does the update
i = Integer.parseInt(POWCon.getForecastDetailID());
if (Desc != null && Desc.length() !=0) {
POWCon.updatePO(Desc, i);
} %>
Thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks