# 我的学习记录

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.

1. the view is mapped to a FTL file (via the jpublish ViewHandler)
2. 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).
3. all page actions are run.
4. the page is merged with a template and all template actions run
5. 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.
6. 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

<?xml version="1.0" encoding="UTF-8"?> main_lrMain PagePageTitleMainmain
the 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>

${uiLabelMap.ProductCategoryNotFoundforCategoryID}${requestParameters.category_id?if_exists}!
#IF>Is detailTemplate a global variable? Isnt it set via category.bsh as detailTemplate = "/catalog/categorydetail.ftl"; Which possibilities do I have to find out the value it contains during runtime? At which point is specified that the cataloglist in the middle of control/main

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?

/createPerson/\${donePage}@ofbizUrl>" method=post>mmh? What does that mean? > <@ofbizUrl> will read the controller.xml file to determine > if the next url is to be directed through SSL or not. It also checks > the browser for cookie support and if none is found re-writes the URL > to include the session ID. It is recommended to ALWAYS use this tag (or > transform in freemarker lingo) for your URLs (unless of course they > point somewhere outside of OFBiz).

Ok again consulting the controller.xml invoke mmh The key must be org/ofbiz/party/party/PartySimpleEvents.xml. A find helps and I found it in C:/ofbiz/ofbiz/components/party/src/org/ofbiz/party/party. However I dont see this file in eclipse! Question: Any hints? I tried it in the package exloperer and the It contains the following relevant part: Person successfully created.

#### 今天我要坚持每天写博客，记录我每天软件开发学习情况

2017-01-04 10:57:42

#### 第一篇文章，记录的学习编程岁月

2015-07-10 11:03:49

#### 我的学习记录12

2017-10-22 22:11:33

#### 我的学习记录150

2018-03-09 12:51:32

#### 我的学习记录160

2018-03-19 12:31:32

#### 我的学习记录24

2017-11-03 22:12:27

#### 记录自己的计算机学习历程（2）

2007-06-03 23:21:00

#### 学在传智 释然过往-传智学员的心境解读

2014-07-11 10:25:52

#### 我发现，自己总是在假期中学习

2018-02-06 16:58:16

#### 英语学习记录

2017-10-08 11:45:57