• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

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

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Sheriff
Posts: 67590
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 .
 
Ranch Hand
Posts: 294
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nope. That does not work either.

Thanks,
Jaggi
 
Bear Bibeault
Sheriff
Posts: 67590
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Sheriff
Posts: 67590
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I'm using RSA 7.0.0.5

I have no idea what RSA is.
 
Jaggi Shankarappa
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
RSA is the latest version of J2EE IDE from IBM. You can also call it as WSAD 7
 
Bear Bibeault
Sheriff
Posts: 67590
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Since the problem seems to be confined to a particular IDE, I've moved this to a more appropriate location.
 
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.....
 
author & internet detective
Posts: 40746
827
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic