When you are tracing pages, make sure you follow the page description XML file and see what actions are called. 99.9% of the time variables in a page were placed there by an action. Either the page action or some other action which previously ran.
One thing to know which is good for everyone is how a page is rendered.
- the view is mapped to a FTL file (via the jpublish ViewHandler)
- JP will take the name of the page, drop the extension append .xml to the name and lookup the definition for the page in the defined page definition directory (/WEB-INF/pagedefs).
- all page actions are run.
- the page is merged with a template and all template actions run
- the template will include content, and as it does each action for the content is run. When content is included the definition is looked up just like a page (and they are found in the same place) so it acts just like a page would, except they are not merged with a template.
- finally freemarker is called and the page is rendered
This should help some with tracing down and finding things.
-Andy
We try to explain this in detail for the ecommerce open questions are marked with
The entry point is http://localhost:8080/ecommerce/ it will call index.jsp as specified in the web.xml file at )
First I thought the section > >> > >> redirectPath > >> /control/main > >> is relevant but Andy said > This is a filter setting. The filter is for several purposes. > - Sets up ofbiz objects for events and page processing. (delegator, > dispatcher, security objects) > - Protects the raw templates; restricts access so the raw templates > cannot be downloaded from the server, this "redirectPath" is the > setting to tell the filter where to re-direct these requests to. So, if > you request something invalid rather then getting a 404 you get the > main page.
Ofbiz/components/ecommerce/webapp/ecommerce/index.jsp. This JSP page will redirect to /control/main. statement is <%response.sendRedirect("control/main");%>it will redirect to below URL http://localhost:8080/ecommerce/control/main
When above URL is requested it will look in WEB-INF/controller.xml
;:in above lines you see the response type as view, than it will look for view-map tag in Controller.xml
this view-map type is jpublish so it will be rendered with jpublish. WEB-INF/jpublish.xml. This means main.ftl is rendered, but first the page in the repository (WEB-INF/pagedefs/main.xml)is rendered
Same chain follows for every request Controller.xml --> --> --> Jpublish.xml --> /pagedef/ --> -->/actions/BSH Scripts. --> than displays appropriate *.ftl file for Presentation to user.
main.xml has this code
main_lr Main Page PageTitleMain mainthe descriptions of above attributes is.
main_lr this will call webapps/ecommerce/templates/main_lr in this main_lr the layout is defined, This is mainly
- ${pages.get("/includes/header.ftl")}
- ${pages.get("/templates/leftbar.ftl")}
- ;:${pages.get("/includes/errormsg.ftl")}
- ;:${pages.get(page.path)}
- ${pages.get("/templates/rightbar.ftl")}
- ${pages.get("/includes/footer.ftl")}
this first action goes to Bean shell script of main.bsh (WEB-INF/actions/main.bsh) this will setAttribute("productCategoryId"). which we are see ing (FEATUTRE CATEGORY from DEMOSHOP) than second action
this action goes to category.bsh (web-inf/actions/category/category.bsh). here see the code at last context.put("detailTemplate", detailTemplate); here context is having global access variable. What does this mean?
Then again the main.ftl will be displayed after all this is processed
C:/ofbiz/ofbiz/components/ecommerce/webapp/ecommerce/main.ftl Ups there is not much inside: ${pages.get("/catalog/category.ftl")} Is this true? it renders /catalog/category.ftl This file contains a little bit more <#assign uiLabelMap = requestAttributes.uiLabelMap> <#if productCategory?has_content> ${pages.get(detailTemplate)} <#else>
Another example http://localhost:8080/ecommerce/control/viewprofile.
In the controller.xml this is mapped and
Lets get into detail of /customer/viewprofile.ftl This must be the lowest level!? Ok the content looks like the form for editing the customers profile. No, its not the form! Just the view! No input-fields!. I found the inputfields in /editperson! So what happens when I invoke the post action?