aspose file tools*
The moose likes Struts and the fly likes <bean:define id= (?)" title="" /> Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "<bean:define id="layoutName" name="layout-name"/> (?)" Watch "<bean:define id="layoutName" name="layout-name"/> (?)" New topic
Author

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

Harry Henriques
Ranch Hand

Joined: Jun 17, 2009
Posts: 206
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
Shankar Tanikella
Ranch Hand

Joined: Jan 30, 2011
Posts: 329

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.


Have Fun with Java
little,little.. little by little makes a lot..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: <bean:define id="layoutName" name="layout-name"/> (?)