J
JGH
I'm trying to convert a VB/asp application to java/jsp. I'm kind of new
to java/jsp.
The app allows a user to enter an id which is looked up in a database.
This is not for authentication. It's just to fill in some default
values. My problem is what to do if the lookup fails. Is there a right
way to handle this in java/jsp? Via Exceptions and an error page,
perhaps?
In the VB app, when the user clicks the submit button, the script calls
itself, tries to look up the id and if it fails, it does a
Response.Redirect back to itself again this time with an error code.
Maybe I should just do the same thing in jsp.
The VB code is something like this:
<%
myScript = request.servervariables("script_name")
userid = Request.QueryString("userid")
If (Not lookup (userid)) Then
Response.Redirect (myScript & "?ERROR=1")
End If
myError = Request.QueryString("ERROR")
If (myError = "1") Then
Response.Write ("Invalid ID, please try again")
End If
%>
<FORM action="<% =myScript %>" method="POST">
<INPUT name="userid" type=text">
</FORM>
to java/jsp.
The app allows a user to enter an id which is looked up in a database.
This is not for authentication. It's just to fill in some default
values. My problem is what to do if the lookup fails. Is there a right
way to handle this in java/jsp? Via Exceptions and an error page,
perhaps?
In the VB app, when the user clicks the submit button, the script calls
itself, tries to look up the id and if it fails, it does a
Response.Redirect back to itself again this time with an error code.
Maybe I should just do the same thing in jsp.
The VB code is something like this:
<%
myScript = request.servervariables("script_name")
userid = Request.QueryString("userid")
If (Not lookup (userid)) Then
Response.Redirect (myScript & "?ERROR=1")
End If
myError = Request.QueryString("ERROR")
If (myError = "1") Then
Response.Write ("Invalid ID, please try again")
End If
%>
<FORM action="<% =myScript %>" method="POST">
<INPUT name="userid" type=text">
</FORM>