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!

One way to do that is set a session attribute

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 ");
%>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.