This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Websphere and the fly likes  include file Directive not working properly. Variable not resolved in jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Products » Websphere
Reply Bookmark " include file Directive not working properly. Variable not resolved in jsp " Watch " include file Directive not working properly. Variable not resolved in jsp " New topic
Author

include file Directive not working properly. Variable not resolved in jsp

Jaggi Shankarappa
Greenhorn

Joined: Mar 17, 2008
Posts: 3
Hello,

I have a jsp(lets call it A.jsp) that has a second jsp(lets call it as B.jsp) included using the include directive. I have declared a variable testStr with some default value in it. But when I try to use it in B.jsp, I get the error msg that says, testStr not resolved. I'm using RSA 7.0.0.5. I've included the corresponding jsps' code below.

When I use the same jsp in any other IDE, it works without any problem. Any help is highly appreciated.

Thanks and Regards,
Jaggi


[ March 17, 2008: Message edited by: Jaggi Shankarappa ]

[ March 17, 2008: Message edited by: Jaggi Shankarappa ]
[ March 17, 2008: Message edited by: Jaggi Shankarappa ]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56201
    
  13

Please be sure to use UBB code tags when posting code to the forums. Unformatted code is extermely hard to read and many people that might be able to help you will just move along. Please read this for more information.

You can go back and change your post to add code tags by clicking the .


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Davie Lin
Ranch Hand

Joined: Aug 05, 2007
Posts: 294
Hi, I am not an expert in JSP but my hunch is that you have testStr in the first JSP and you declare it as a local variable. My guess is testStr's scope is only within the first JSP you wrote.
maybe this might work, but I am not sure

hope this helps
Jaggi Shankarappa
Greenhorn

Joined: Mar 17, 2008
Posts: 3
Nope. That does not work either.

Thanks,
Jaggi
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56201
    
  13

Originally posted by Davie Lin:
Hi, I am not an expert in JSP but my hunch is that you have testStr in the first JSP and you declare it as a local variable. My guess is testStr's scope is only within the first JSP you wrote.
maybe this might work, but I am not sure

hope this helps

Bad idea. Hugely, hugely bad idea.

Never ever ever declare variables in a JSP declaration block. Ever.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56201
    
  13

I'm using RSA 7.0.0.5
I have no idea what RSA is.
Jaggi Shankarappa
Greenhorn

Joined: Mar 17, 2008
Posts: 3
RSA is the latest version of J2EE IDE from IBM. You can also call it as WSAD 7
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56201
    
  13

Since the problem seems to be confined to a particular IDE, I've moved this to a more appropriate location.
Naresh Talluri
Ranch Hand

Joined: Oct 12, 2007
Posts: 115
Originally posted by Bear Bibeault:
Since the problem seems to be confined to a particular IDE, I've moved this to a more appropriate location.


Can you please let me know why don't we use decalrations in JSP.....
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 26192
    
  66

Originally posted by Naresh. Talluri's:
Can you please let me know why don't we use decalrations in JSP.....

It is considered bad practice to have any Java code in a JSP. Needing to declare variables puts even more logic into the JSP.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: include file Directive not working properly. Variable not resolved in jsp
 
Similar Threads
include directive doesn't work
Can I get actionscript values into a servlet?
RequestDispatcher for including static contents
retrive serialize files data ERROR
Request Attribute confusion