Getting return value using a POST request (document.forms[0].submit)
Hi,
I am submitting a form using document.forms[0].submit. The form has 5 paramteres and the servlet inserts a record into the table using the form values. After successful insertion the servlet will return a boolean value based on the success or failure.
How to get the boolean value in the jsp and show the user whether the data is successfully inserted or not?
# 2
hi,
Better you to forward Your boolean value to new jsp page
ex:
***
in your servlet file use last statement
response.sendRedirect( "./display.jsp?option=" + booleanvalue );
in display.jsp
<%
if (request.getParameter("option").equals("true") )
{
out.println ("success");
}
else
{
out.println("failure");
}
%>
Note: here passing boolean value is string, no need to convert to bool
# 3
> hi,
>
> Better you to forward Your boolean value to new jsp
> page
>
> ex:
> ***
> in your servlet file use last statement
>
> response.sendRedirect( "./display.jsp?option="
> + booleanvalue );
>
>
> in display.jsp
>
> <%
> if (request.getParameter("option").equals("true") )
> {
> out.println ("success");
> }
> else
> {
> out.println("failure");
> }
>
> %>
>
>
>
> Note: here passing boolean value is string, no need
> to convert to bool
Is it request.getParameter or request.getQueryString()?