This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes what is target in c:target?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "what is target in c:target??" Watch "what is target in c:target??" New topic
Author

what is target in c:target??

trivikram Kumar
Ranch Hand

Joined: Feb 21, 2005
Posts: 172
Hi Pals,

Could someone explain me whats the difference between a target and an id in tag files.If someone worked on any example ,could you please forward that to me??I am getting confused ...here.

I just know that target can take only an object...so does it take an attribute???

Also..i bought the enthuware software but its getting stuck at the license page...i need help regarding how it can be installed..

Thanks in bunch..
Javainn


Javainn<br /> <br />SCJP,SCWCD,SCBCD,<br />ICED (IBM-287,IBM-484,IBM-486)
IBM certified in DB2 V 8.1 Family Fundamentals (IBM 700)
trivikram Kumar
Ranch Hand

Joined: Feb 21, 2005
Posts: 172
Could someone please look into this???
Paul Bourdeaux
Ranch Hand

Joined: May 24, 2004
Posts: 783
Are you referring to the target attribute in the <c:set> tag? If so, then this might help...

When using <c:set>, the "target" must evaluate to an actual object. The HF book warns people that they should not just use the String literal that represents the name of a scoped attribute.... but IMHO they could be a little clearer. Take the following as an example of both the right and wrong way to use the target attribute (assume foo.Person is a bean that has a name property):
The difference between the correct and wrong examples is that in the correct examples, "person" is evaluated to the actual foo.Person object. This means you must use EL, scripting, or <jsp:attribute> in the "target". Hope that helps!
[ May 04, 2005: Message edited by: Paul Bourdeaux ]

“Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.” - Rich Cook
trivikram Kumar
Ranch Hand

Joined: Feb 21, 2005
Posts: 172
Thanks Paul:

That was really helpful..
Is that the only difference between <c:set var=="".../> and <c:set target=:""..../>
If yes thats fine..else could you please elaborate on this...

Thanks,
Javainn
Paul Bourdeaux
Ranch Hand

Joined: May 24, 2004
Posts: 783
That is the only syntax difference between <c:set var=...> and <c:set target=...>. They are used similarily, but you have to keep the different uses in mind.

You can only use <c:set var=...> with attributes. If an attribute named by "var" does not exist in any scope, one will be created in page scope.

You can only use <c:set target=...> with a bean or a Map. If you try to use target with something other than a bean or a Map, you will get an exception.
trivikram Kumar
Ranch Hand

Joined: Feb 21, 2005
Posts: 172
Thanks Paul...

You cleared my doubt and made my mind free...
Thanks a lot..

Javainn
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: what is target in c:target??