• Post Reply Bookmark Topic Watch Topic
  • New Topic

Passing a variable to an included JSP

 
Natesan Prabhakaran
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can any one please help, I want to access a variable to an Included JSP

Example:

Main.jsp
<%String s="Prabhakaran.N";%>
<%=s%>
<%@include file="abc.jsp"%>

How to access that String variable inside of abc.jsp. Thanks.

Regards,
Prabhakaran.N
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65524
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
s
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65524
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And, I'd be remiss not to point out that putting Java code into modern JSPs is considered a very poor practice.
 
Natesan Prabhakaran
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I try to access directly, Its showing Error like Undicleared Variable.
"s can not be resolved"
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!