[
https://issues.apache.org/jira/browse/JSPWIKI-114?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Florian Holeczek closed JSPWIKI-114.
------------------------------------
> VariableManger does not check "RealPage" for variables during variable lookup
> -----------------------------------------------------------------------------
>
> Key: JSPWIKI-114
> URL: https://issues.apache.org/jira/browse/JSPWIKI-114
> Project: JSPWiki
> Issue Type: Bug
> Components: Core & storage
> Affects Versions: 2.4.104, 2.6.0
> Reporter: Stephen Solka
> Priority: Minor
> Fix For: 2.6.1
>
> Attachments: RealPageVariables.patch
>
>
> When one sets a page variable jspwiki attaches that variable to the realpage
> variable which exists in the engine's context. But when looking up a variable
> reference only page is checked for that variable. The result is when realpage
> and page differ all previously defined variables vanish from scope. This can
> be seen when defining a variable then using the insertpage plugin. the
> inserted page can not see any variables defined in the inserter page and thus
> returns a variable not found error.
> Initial Conversation on HowToUseAVariable which lead to bug:
> ========
> Lets pretend the code on one page called TestPage is
> Hello [{$tname}]
> Then the code for another page called Tester is
> [{SET tname='Stephen'}]
> [{InsertPage page='TestPage'}]
> It doesnt seem to be working as I would expect. I would expect the output to
> be
> Hello Stephen
> but instead I get
> Hello No such variable: No variable tname defined.
> What am I doing wrong? Why is InsertPage parsing the content of the inserted
> page prior to insertion? --Stephen
> The tname variable is referring to the page variable called "tname" on page
> "Tester". Variables are always interpreted in the context of the including
> page, not the included page. This allows you to e.g. create templates which
> you can insert and control with page variables.
> -- JanneJalkanen
> If variables are interpreted in the context of the including page why does
> Tester claim not to know what tname is when inserting a page that references
> that variable? Controlling a inserted page through page variables is EXACTLY
> what I am trying to do. But if all page variables defined in the including
> page lose scope prior to insertion then I fail to see how this is possible?
> Is it possible to directly manipulate the variables for a page prior to
> insertion?
> -- Stephen
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira