Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
Syntax for Site Controller in default.site?
Anil Kumar
Suppose If I have a controller class, com.controllers.SiteController.java with a method doProcess(RequestContext).
What should be the syntax, i need to update in default.site file.
I can see
<Controllers>
<Pre/> <-- syntax here to call the doProcess() of SiteController.java -->
<Post/>
</Controllers>
Find more posts tagged with
Comments
Anil Kumar
I got the syntax, if I just edit the default.site with form view proper syntax is taken care.
Can a Site pre-controller returns Document object, sothat I can use values in page layout XSL?
Or Site pre-controller always returns ForwardAction?
Rick Poulin
It always returns a ForwardAction. What you can do is construct a Document (or any object) and then store it as a request attribute, thereby making it available to all components on that page (which can then print out whatever you need). Precontrollers can also set Page Scope and Context variables, which can be used as variable placeholders in your page-level XSL, but you can't do iterative or conditional logic based on those placeholders.
Anil Kumar
Thanks for confirmation on return type. ForwardAction
Today, I tried context.getPageScopeData().put("head_injection", htmlSegmentString); in my site controller, and tried accessing the value in fixed-layout.page.xsl as
$PAGE_SCOPE[head_injection] , but failed to retrieve the value from the map.
Any Pointers on how to debug?
I used RuntimePage.Page_head_injection property only. I don't remember exact key.
Sorry for typos if any ~ mobile
Anil Kumar
I'm able to see it. Mistake i'm doing all the time is viewing the source in preview mode. When i see it with Firebug, I'm able to find the injection snippet.
Closing the thread.
Syntax to update manually in default.site is
<Controllers>
<Pre>
<Controller>
<Object>com.livesite.controllers.SiteController
<Method>injectMarketType
</Controller>
</Pre>
<Post/>
</Controllers>