我的学习记录

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

 
  
 
  
  
  
   
   main_lr
  
   
  
  
   
   Main Page
  
   
  
  
   
   PageTitleMain
  
   
  
  
   
   main
  
   
  
   
   
    
   
   
  
  
 
  
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}!
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} " 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.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值