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
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

declarations fault  RSS feed

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hi ppl,

we know that scriptlets and expressions go inside a _jspservice(), and declarations go outside of _jspservice() when a jsp is converted a servlet.

But in one sample programs which i typed and executed, it is showing all the three scriptlets, expressions and declarations all going inside _jspservice().

so can anybody explain which is true either declaration goes inside or not.

i am totally confused.

THanks,
good guy
 
Ranch Hand
Posts: 172
  • Mark post as helpful
  • send pies
  • Report post to moderator
Is this a beginner question

Anyway, the way it is generated depends on the container implementation.
 
Ranch Hand
Posts: 1159
9
  • Mark post as helpful
  • send pies
  • Report post to moderator
IF I UNDERSTAND CORRECTLY...

It's not what's inside your delimiters that determines where the included code goes; it's what type of delimiter you use:
  • Anything in <% %> delimiters is put inline.
  • Anything in <%= %> is put inline but without closing the current out.print().
  • Anything in <%! %> is put outside of the _jspservice() method.


  • If you want declarations to end up out outside the _jspservice() method, just wrap them in <%! and %>.

    Ryan
    [ May 06, 2005: Message edited by: Ryan McGuire ]
     
    Ryan McGuire
    Ranch Hand
    Posts: 1159
    9
    • Mark post as helpful
    • send pies
    • Report post to moderator

    Originally posted by Annie Smith:
    Is this a beginner question



    Let's say it's an upper beginner level JSP question.
     
    Bartender
    Posts: 1840
    Eclipse IDE Java Ruby
    • Mark post as helpful
    • send pies
    • Report post to moderator
    ...But it's JSP, so I'm moving this thread over to that forum.
     
    Marshal
    Posts: 67162
    169
    IntelliJ IDE Java jQuery Mac Mac OS X
    • Mark post as helpful
    • send pies
    • Report post to moderator
    "tue march", please do not cross-post the same question in multiple forums. It wastes people's time when multiple redundant conversations take place.
     
    It is sorta covered in the JavaRanch Style Guide.
      Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!