Meaningless Drivel is fun!*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes declaration Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "declaration" Watch "declaration" New topic
Author

declaration

Anoopriya Muthuswaami
Greenhorn

Joined: Nov 20, 2008
Posts: 25
Consider the following example
<%! String str="Hello"; %> //this becomes instance variable in generated servlet

<% String str="GoodDay"; %>//this becomes local variable in service method
<%= str %>

The result of this is GoodDay.

My question is how do I print the value 'Hello'?
Matteo Palmieri
Greenhorn

Joined: Sep 09, 2008
Posts: 28
This should do the case:


SCJP1.4: 96% SCWCD5: 91%
Anoopriya Muthuswaami
Greenhorn

Joined: Nov 20, 2008
Posts: 25
Thanks.. It worked.
Tuna Töre
Ranch Hand

Joined: Aug 17, 2008
Posts: 219

good question... Anoo Raj


blog: http://tunatore.wordpress.com
SCJP 6.0 + SCWCD 1.5
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: declaration