context object in bsh

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

context object in bsh

Ritesh Trivedi
Hi,

Can someone point(answer) where is the context and parameters object which is available in BSH initialized/created? Is it part of the request like delegator and/or other objects are?

e.g. /ofbiz/applications/order/webapp/ordmgr/.../category.bsh has

import org.ofbiz.base.util.*;
import org.ofbiz.entity.*;
import org.ofbiz.product.catalog.*;
import org.ofbiz.product.category.CategoryWorker;
import org.ofbiz.product.category.CategoryContentWrapper;

detailScreen = "categorydetail";
catalogName = CatalogWorker.getCatalogName(request);

productCategoryId = request.getAttribute("productCategoryId");
if (productCategoryId == null) {
    productCategoryId = parameters.get("category_id");
}
context.put("productCategoryId", productCategoryId);
Reply | Threaded
Open this post in threaded view
|

Re: context object in bsh

Pranay Pandey-2
Hi,

I would also like to add one more thing that when we write bsh which one
should be prefer and when from context and parameters means what are
scenarios when we should prefer context to put values and when we should
prefer parameters.

Thanks and Regards
--
Pranay Pandey

Ritz123 wrote:

> Hi,
>
> Can someone point(answer) where is the context and parameters object which
> is available in BSH initialized/created? Is it part of the request like
> delegator and/or other objects are?
>
> e.g. /ofbiz/applications/order/webapp/ordmgr/.../category.bsh has
>
> import org.ofbiz.base.util.*;
> import org.ofbiz.entity.*;
> import org.ofbiz.product.catalog.*;
> import org.ofbiz.product.category.CategoryWorker;
> import org.ofbiz.product.category.CategoryContentWrapper;
>
> detailScreen = "categorydetail";
> catalogName = CatalogWorker.getCatalogName(request);
>
> productCategoryId = request.getAttribute("productCategoryId");
> if (productCategoryId == null) {
>     productCategoryId = parameters.get("category_id");
> }
> context.put("productCategoryId", productCategoryId);
>  
Reply | Threaded
Open this post in threaded view
|

Re: context object in bsh

Bilgin Ibryam
In reply to this post by Ritesh Trivedi
Take a look at ScreenRenderer.populateContextForRequest method.

Bilgin