my dog learned polymorphism
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes c:import var 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 "c:import var" Watch "c:import var" New topic

c:import var

Sharmila Punde
Ranch Hand

Joined: Dec 26, 2007
Posts: 133
Dear All,
Please look at following code -
Can someone please explain why i get output as horse and after that
What is meaning of the following about inputUrl-
'inputUrl' is name of the exported scoped variable for the processed url.
The type of the scoped variable is String.

How and why to use 'inputUrl'. Did not understood the meaning of above quote.


Regards, Sharmila.
We will have a future if we save Nature!
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63865

After the import, the var will contain the content fetched from the URL. ("inputUrl" isn't the best name for the var.)

Did you do a View Source on the page in the browser to see what was happening?

Did you look at what's at "" to see what will be fetched?

[Asking smart questions] [About Bear] [Books by Bear]
Sharmila Punde
Ranch Hand

Joined: Dec 26, 2007
Posts: 133
Thanks Bear Bibeault,
Sorry i could not come online for few days, was not well.
I get horse picture from that resource. Now i have changed the code as bellow-
Translated page doe not contain any variable of the name someVar1.
So i do not exactly know what is use of someVar1

Chinmaya Chowdary
Ranch Hand

Joined: Apr 21, 2008
Posts: 432
Hi, Sharmila.

Here 'import' tag internally sends the request to "" and gets the contents of horse.html. Here it is and stores it in page scope(since we didn't mention any scope attribute, the default value is page scope) like

And if we say container searches for the attribute name(someVar1) in all scopes ranging from page to application. First it sees the is the attribute available in page scope? here it is available and write it's value to the response object and sends it to the client as HTTP response. Now the browser sees the and it makes another request to the container and the horse.gif image is displayed at the browser side.
Sharmila Punde
Ranch Hand

Joined: Dec 26, 2007
Posts: 133
Thanks Chinmay,
Will look at that and will do one more practicle of this. Let me check it as you say.
I agree. Here's the link:
subject: c:import var
It's not a secret anymore!