• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

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

 
Ranch Hand
Posts: 206
  • Mark post as helpful
  • send pies
  • 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
  • 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.

 
It's feeding time! Give me the food you were going to give to this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic