Hello all!
I want to ask you , how to pass variable, there's the example:

I have variable String X in pageone.jsp then i open a new tab page to pagetwo.jsp (using JavaScript window.open) , Is it possible to use the variable X (from pageone.jsp) in pagetwo.jsp ? Please Explain, thank you verymuch! :)

i've got the answer, i hope it would be useful :)


Set the varaible into the session in Page1.jsp and access the same in Page2.jsp.
In Page1.jsp
session.setAttribute("X", "value");

In Page2.jsp
String x = session.getAttribute("X");

i've got the answer, i hope it would be useful :)


Set the varaible into the session in Page1.jsp and access the same in Page2.jsp.
In Page1.jsp
session.setAttribute("X", "value");

In Page2.jsp
String x = session.getAttribute("X");

Unfortunately that is the wrong way to pass the value. You should never use session to pass values from one jsp to the other.
If you are using window.open, can you post that part of your code so I can suggest a better way.

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.