• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

<bean:define id="layoutName" name="layout-name"/> (?)

 
Ranch Hand
Posts: 206
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I'm trying to solve a fairly simple problem using Struts 1.3.10, and I just want to confirm that my understanding for usage of the bean:define tag is correct.

Struts JavaDoc wrote:
id = Specifies the name of the scripting variable (and associated page scope attribute) that will be made available with the value of the specified property.
name = Specifies the attribute name of the bean whose property is accessed to define a new page scope attribute (if property is also specified) or the attribute name of the bean that is duplicated with the new reference created by this tag (if property is not also specified). This attribute is required unless you specify a value attribute or nested body content.



My questions are the following? In the example on the Subject line, is an Attribute named "layoutName" created in page-scope, and is "layout-name" only another reference to "layoutName"?

Is "layout-name" strictly a duplicate reference to the created Attribute "layoutName", or does "layoutName" also assume the dereferenced value of "layout-name"?

Does the Attribute "layoutName" have the same initial value as "layout-name"?

Thanks,
Harry
 
Ranch Hand
Posts: 329
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Harry Henriques wrote:In the example on the Subject line, is an Attribute named "layoutName" created in page-scope, and is "layout-name" only another reference to "layoutName"?

"layoutName" is newly created in the page scope[not reference], "layout-name" would be what it was.

Harry Henriques wrote:Is "layout-name" strictly a duplicate reference to the created Attribute "layoutName", or does "layoutName" also assume the dereferenced value of "layout-name"?

Ideally it should be duplicate value and not referenced value.

Harry Henriques wrote:Does the Attribute "layoutName" have the same initial value as "layout-name"?

same as above, Did you try this out? May be we would get the better picture by seeing how the servlet code for the JSP is being built.
However, the DefineTag.java of struts is straight forward and create a new page attribute - sample code snippet from the DefineTag is as below
Just see what is there in the generated servlet.

 
An elephant? An actual elephant. Into the apartment. How is the floor still here. Hold this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic