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)
Need Of Controllers??
SE123
Hi,
I have never used controllers in Livesite. I have used external to populate the component but why should I use Controllers when I can write a servlet which redirects me to the next page after performing the business logic.
Please give the answers in following order...
1)What is the significance of using Controllers?
2) Is the Controllers of Livesite is same as what we usually used in Struts where we have struts-config file which contains the action mapping and
accordingly redirects to success or failure jsp as a next page(an example)?
3) If I want to use controllers what ill be the steps I need to follow as in my application we have not used controllers anywhere, So will it require any architectural change i.e. do I need to create a config file where I give the mapping of next pages based on the return type of my Action class.
4) Will my action class will extend some class like Action(in struts)?
5) Can someone provide the sample code snippet?
Please let me know if some one has already worked on it.
Thanks in advance.
Find more posts tagged with
Comments
AlexC
1)What is the significance of using Controllers?
There are 3 types of controllers, site, page and component, each can execute before and after such entity which allows you to control flow at any of those levels and execute code after the page is rendered.
2) Is the Controllers of Livesite is same as what we usually used in Struts where we have struts-config file which contains the action mapping and
accordingly redirects to success or failure jsp as a next page(an example)?
It is not just a mapping but executing code with full context available.
3) If I want to use controllers what ill be the steps I need to follow as in my application we have not used controllers anywhere, So will it require any architectural change i.e. do I need to create a config file where I give the mapping of next pages based on the return type of my Action class.
It is built in, see impl.zip for samples and docs for how to attach them.
4) Will my action class will extend some class like Action(in struts)?
No, they are standalone POJO methods.
5) Can someone provide the sample code snippet?
See impl.zip provided with livesite and read the tech reference.
SE123
Thanks, for your response Alex I got many of my answers but could you please elaborate more on site, page and component Controllers or it would be great if you can refer me any document where it is explained in detail because I am referring the ls_310p1_spdev_v01_en.pdf but it doesn't say much on controllers.
Please provide some link where I can get any document and also provide me the link where I will get the impl.zip
Thanks a ton.
AlexC
impl.zip is installed with Livesite, check with support if you do not have one, it is part of the distribution (try grepping for it).
There are 3 types of controllers in TeamSite 672 (I believe Livesite 3.1 only had a component controller).
This is the order of execution:
Site pre-controller
Page pre-controller
For each component that needs to be rendered or is a target of a submit
{
Component controller
Component rendering
}
{Output written to user}
Page post-controller
Site post-controller
Post-controllers cannot write anything to the user nor can they change flow, they are mostly for statistics and cleanup tasks.
Which version of Livesite are you using?
SE123
Thanks for your response..... I am using Livesite 3.0.
AlexC
With LiveSite 3.0 you only have component controllers available.
PreetiB
Hi,
I am trying to use pre-controller but it is not working and I am unable to find out the problem.
I have implemented all the steps as mentioned in the "ls_310_spdev_v02_en.pdf" on my TeamSite server. but when I am hitting the URL
"
http://servername/mysites/sitename/PreControllerPOC.page?&submit=true&ComponentID=1264614790248&iwPreActions=one
;"
It is neither giving any error nor calling any method. Please help me in this.
Thanks in advance
vpatel
Post some details...
Where is your class / package located? How did you compile it? How are you referencing it? What is in the servletd log?
AlexC
Please don't use 2 threads to answer one question, see the other thread where I answered the question. Thanks.