Link to home
Create AccountLog in
Avatar of _Esam
_Esam

asked on

How to use variables from a main JSP page to an included JSP page?

Hi,

I have a main JSP page where header, and two more JSP pages are included dynamically like:

In main.jsp page

<%@ include file="mainheader.jsp" %>


Now in the main.jsp page, there are some variables declared

like:
<%

String screen=null;
String sort=null;
String where=null;

%>

which are later used in the included JSP like mainheader.jsp as

if (userType == "E" && !screen.equals("asnhome")) {
String checkHacker = HttpHeaderParser.encodeString(where);

}


Now RAD 7 shows these (screen, where)  as errors in the mainheader.jsp page?

This app was initially built with WAS 5.1.2

I am trying to convert it to WAS 6.1


What is the problem here?


Thanks.
_Esam
Avatar of krishna kishore mellacheruvu venkata
krishna kishore mellacheruvu venkata
Flag of India image

RAD 7 will treat mainheader.jsp as another j sp.

In order to avoid compilation error

you can try like this

<%@ include file="mainheader.jsp" %>

as
<%@ include file="mainheader.jspf" %>

Let me know if any concerns

ASKER CERTIFIED SOLUTION
Avatar of Mayank S
Mayank S
Flag of India image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
will a request.setAttribute and a request.getAttribute work?
I believe my comment was correct because eventually when the application is run on the server, it won't give the same error as what the development IDE RAD is giving.