• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to use variable of included page of jsp

 
gaurav chhabra
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sir
i have one page ,in that i have included other page,,,now how to access the variable of that included page because in the below code i m facing the error ..........

<!-- JAI SHRI RAM -->

<html>
<head><title>JAI SHRI RAM</title></head>
<body>


<jsp:include page="main_page1_database.jsp" flush='true' />
<%

out.println("jai shri ram");
out.println(name);
%>

</body>
</html>

as i m accessing the variable name it is giving the error ...cannot resolve the symbol..........

thank you
gaurav
 
Sumit Deshpande
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Use <%@include file="filename" /> tag instead of jsp:include...
The difference is page include will copy the source of included file into the main file where as jsp:include will not.
For more details, feel free to do a google search ...

-Sumit
 
gaurav chhabra
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks sir
but the thing is that i only want to access the variables of previous page.how to do that .............help me plz

thank you
gaurav
 
satishkumar janakiraman
Ranch Hand
Posts: 334
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

Use the following code in your page


in your second page use the following line



bye for now
sat
 
satishkumar janakiraman
Ranch Hand
Posts: 334
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi sorry for my previous posting. I didnt understand your question properly
forget that posting.

write this line in your 2nd page




it will be availabe in your first page

bye for now
sat
 
satishkumar janakiraman
Ranch Hand
Posts: 334
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, use this. I didnt see your question completely. Sorry some problem





code for
main_page1_database.jsp

<%! String name="test"; %>

i hope it will work fine

bye for now
sat
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!