• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Dumb question - variables

 
Ranch Hand
Posts: 567
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Being a thick-skulled greenhorn, I'm trying to get my head around the java in the JSP tags and I can't figure out how to use global variables or functions.
How can I declare a function in jsp java so that I can pass the parameters as reference parameters, not just copies? If it's anything like javascript, I can't, right?
How can I declare a global variable so that I can reference the variable inside functions and just in the script blocks?
Thanks
Adam
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For "global" variables and methods in JSP for use in a single application - you might declare a bean with application scope.
See the JSP API documentation downloadable from java.sun.com
Bill

------------------
author of:
 
Adam Hardy
Ranch Hand
Posts: 567
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok, i see i am going to have commit some time to learning the servlet/bean techniques, but what really flummoxes me now is why some of my "global" variables work - e.g. i've got my database access in a function and it sets the result set object in a global variable, but it can't set the error/warning messages variable, although they're both declared in the same place.
 
Roses are red, violets are blue. Some poems rhyme and some don't. And some poems are a 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
    Bookmark Topic Watch Topic
  • New Topic