0 Replies - 328 Views - Last Post: 28 June 2020 - 06:06 AM

#1 tester1234   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 08-December 15

jsp form processing problem

Posted 28 June 2020 - 06:06 AM

i have login.jsp page with 2 input field and 2 buttons, nomal and abnormal button respectively.
when normal button click, it will submit form and redirect to home.jsp
when abnormal button is clicked, it will submit form and redirect to home.jsp too.

in main.jsp, how can i check login.jsp form_submit's parameter in main.jsp when the user click the login.jsp
to display different <h1> content in main.jsp depending on previous page.

------------------------------------------------------------login.jsp---------------------------------------------------------------


login.jsp

<html>
<body>

<form action = "main.jsp" method = "POST">
First Name: <input type = "text" name = "first_name">
<br />
Last Name: <input type = "text" name = "last_name" />
<input onclick= "form_submit(normal);"  type="submit" value = "normal_submit" />
<button onclick="form_submit(abnormal);" type="submit" value="abnormal_submit"
</form>

</body>
</html>


:code:

--------------------------------------------------------------------Main.jsp -------------------------------------------
Main.jsp
<html>
<head>
<title>Using GET and POST Method to Read Form Data</title>
</head>

<body>
<center>
<%=if abnormal submit button click%>
<h1>this is abnormal button click</h1>
</if=%> //how to check value ?
<%= if normal button click%>
<h1> this is redirect from normal button click</h1>
</if =%>

<ul>
<li><p><b>First Name:</b>
<%= request.getParameter("first_name")%>
</p></li>
<li><p><b>Last Name:</b>
<%= request.getParameter("last_name")%>
</p></li>
</ul>

</body>
</html>
:code:

This post has been edited by modi123_1: 28 June 2020 - 10:27 AM
Reason for edit:: In the future please use the [code] tag button in the editor


Is This A Good Question/Topic? 0
  • +

Page 1 of 1