0
votes

I am trying to create a java web application using JSP and script;ets. I am using netbeans, i have all my jsp files under web, and my .java files under src. Is there anyway, I can access an object created in one .jsp file in another .jsp. Any changes made in a any one of the .jsp files must be reflected in the others.

1

1 Answers

1
votes

You can try session object to store created object in one jsp and access it in another jsp. This might work for you:

//Set object on one jsp:
<%
Hello hello = new Hello();
session.setAttribute("helloObject", hello);
%>

//Get object on second jsp:
<%
Hello helloObject = (Hello)session.getAttribute("helloObject");
%>