0

Hi,

Let's say i have Main.jsp and return.jsp. i call the return.jsp from main.jsp and want the return page to return a string which I need to store in a variable in Main.jsp.

How can I achieve this?

Cheers!

3
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by javaAddict
0

You can have a form at Main.jsp that submits to the return.jsp.
Create an input field or a hidden field at the main, and take its value at the return.jsp from the request:

Main

<form action="return.jsp">
  <input type="text" name="textName" />

  <!-- OR -->

  <input type="hidden" name="hiddenName value="some Value" />
</form>

return

<%
String textName = (String)request.getParameter("textName");
String hiddenName = (String)request.getParameter("hiddenName ");
%>
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.