1

i have a two jsps

  1. init.jsp
  2. second.jsp

init.jsp

PreferenceServices preferenceServices = PreferenceServices.getUserSpecificPreferences(renderRequest);

here PreferenceServices is a class and getUserSpecificPreferences(renderRequest) is a static method of PreferenceServices class

second.jsp

<%@ include file="/init.jsp"%>
long documentId = Long.parseLong(preferenceServices.getValue(Constant.DOCUMENT_PREFERENCE, "0"));

here preferenceServices is defined in init.jsp getValue(string,string) is a method of PreferenceServices class

Now the problem is, i am not able to get value in second.jsp using above lines of code of second.jsp

Can any one tell me how to resolve this?

Thanks,

Ravi Darji

Xstian
  • 8,184
  • 10
  • 42
  • 72
Ravi Darji
  • 11
  • 5

1 Answers1

0

You could store your value in the request:

<%
request.setAttribute("documentId",documentId);
%>

Then you would retrieve like below in your second.jsp:

 <% documentId = request.getAttribute("documentId");%>

Use include action:

<jsp:include page="init.jsp" />

When to use include action ?

Include tag doesn't include the source code of the included page into the current page instead the output generated at run time by the included page is included into the current page response. What's the difference between including files with JSP include directive, JSP include action

Community
  • 1
  • 1
Perdomoff
  • 938
  • 2
  • 7
  • 26