one what is to make a map of urls and put them in the context to be
passed back thru the controller to a view you create.
the view then displays the map.
that way you can use the success in the request map

Grant Edwards sent the following on 7/25/2008 11:52 AM:
> Adrian,
> 
> The functionality I require is exactly the same as text based searching
> of a catalogue. In the case of the standard OFBiz "Search Catalog"
> provided by the ecommerce componnent  ..... you enter a search string in
> one form, some string matching takes place and the results are finally
> displayed to a different form.
> 
> In my case this is no different, enter some dates in one form, hand of
> the matching to a an external 3rd party and display the results  to a
> different form.
> 
> Yip, I saw that line of code (Map requestParams =
> UtilHttp.getParameterMap(request); ), used it, but still no joy.
> 
> 
> Brad's suggestion of using the Session context has worked a treat.
> 
> Cheers
> 
> Grant
> 
> Adrian Crum wrote:
>> Grant,
>>
>> It would help if you could describe exactly what you are trying to
>> accomplish. I might be wrong, but it seems to me you are taking a very
>> complicated approach to a very simple requirement.
>>
>> At any rate, in the ProductSearchSession class, did you notice the line:
>>
>> Map requestParams = UtilHttp.getParameterMap(request);
>>
>> Maybe you should check the requestParams Map for your parameter.
>>
>> -Adrian
>>
>> Grant Edwards wrote:
>>> Although what I am working on is custom code, I used the following as
>>> a template:
>>>
>>> <request-map uri="keywordsearch">
>>>        <security https="false" auth="false"/>
>>>        <event type="java"
>>> path="org.ofbiz.product.product.ProductSearchSession"
>>> invoke="checkDoKeywordOverride"/>
>>>        <response name="success" type="view" value="keywordsearch"/>
>>>        <response name="none" type="none" value=""/>
>>>    </request-map>
>>>
>>> Take a look at org.ofbiz.product.product.ProductSearchSession, method
>>> = checkDoKeywordOverride(HttpServletRequest request,
>>> HttpServletResponse response)
>>>
>>>
>>> You will find the following ----->
>>>
>>> try {
>>>                                response.sendRedirect(target);
>>>                                return "none";
>>>                            } catch (IOException e) {
>>>                                Debug.logError(e, "Could not send
>>> redirect to: " + target, module);
>>>                                continue;
>>>                            }
>>>
>>>
>>>
>>> Thank you both for your input.
>>>
>>> Cheers
>>>
>>> Grant
>>>
>>> BJ Freeman wrote:
>>>> This is custom code, not sure it is best practices.
>>>> so not a concern for ofbiz.
>>>>
>>>> bplies sent the following on 7/25/2008 10:55 AM:
>>>>  
>>>>> That is all well in good, but one of the lines of code provided:
>>>>>
>>>>> "response.sendRedirect(target);"
>>>>>
>>>>> Is clearly an HTTP Redirect signaled to the client browser which
>>>>> should have
>>>>> the behavior I describe and explain the loss of request
>>>>> attributes.  It does
>>>>> not appear that the request control-flow is using the OFBIZ request
>>>>> control
>>>>> that you describe.  Just look at how ProductSearchSession.search is
>>>>> defined. It is very much like a Struts ActionServlet.
>>>>>
>>>>> Brad
>>>>>
>>>>>
>>>>> BJ Freeman wrote:
>>>>>  
>>>>>> each module ie Accounting is a container
>>>>>> also the Control interface is part of ofbiz not TomCat.
>>>>>> so you use a return string of "success" and it is processed by the
>>>>>> control.mxl for the request map that issued the process.
>>>>>>         <response name="success" type="view" value="category"/>
>>>>>>
>>>>>> bplies sent the following on 7/25/2008 10:30 AM:
>>>>>>    
>>>>>>> IIRC regarding servlet containers such as Tomcat (which is
>>>>>>> embedded into
>>>>>>> OFBIZ).  Is that if you send a redirect, then the client browser
>>>>>>> makes a
>>>>>>> *new* HttpRequest for the redirect URL.  So any attributes you
>>>>>>> store in
>>>>>>> the
>>>>>>> previous HttpRequest context are lost because they are not
>>>>>>> included in
>>>>>>> the
>>>>>>> new context.
>>>>>>>
>>>>>>> Either:
>>>>>>> 1.  Do not use redirect but simply serve the correct content.
>>>>>>> 2.  Use the Session context instead (and be sure to cleanup after
>>>>>>> yourself)
>>>>>>>
>>>>>>> Brad
>>>>>>>
>>>>>>>
>>>>>>> Grant Edwards-2 wrote:
>>>>>>>      
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> According to the request-map below the redirect will be to the
>>>>>>>> category view. This view is defined as part of the OFBiz
>>>>>>>> ecommerce project. One of the many scripts run by this view is
>>>>>>>> categorydetail.bsh. I have added the following lines to this
>>>>>>>> script, but by all accounts something is lacking, most probably
>>>>>>>> knowledge.
>>>>>>>>
>>>>>>>> Can someone please explain to me why my request attribute
>>>>>>>> (otaHotelAvailRSDocument) is getting lost.
>>>>>>>>
>>>>>>>> <request-map uri="otasearch">
>>>>>>>>         <security https="false" auth="false"/>
>>>>>>>>         <event type="java"
>>>>>>>> path="com.gat.search.service.product.ota.ProductSearchSession"
>>>>>>>> invoke="search"/>
>>>>>>>>         <response name="success" type="view" value="category"/>
>>>>>>>>         <response name="none" type="none" value=""/>
>>>>>>>>     </request-map>
>>>>>>>>
>>>>>>>>
>>>>>>>> ProductSearchSession.search(HttpServletRequest request,
>>>>>>>> HttpServletResponse response) {
>>>>>>>>       .......
>>>>>>>>       request.setAttribute("otaHotelAvailRSDocument",
>>>>>>>> otaHotelAvailRSDocument);
>>>>>>>>       .........
>>>>>>>>       String requestName = "/category/~category_id=" + categoryId;
>>>>>>>>       String target = rh.makeLink(request, response,
>>>>>>>> requestName, false, false, false);
>>>>>>>>       ........
>>>>>>>>       try {
>>>>>>>>           response.sendRedirect(target);
>>>>>>>>           return "none";
>>>>>>>>       } catch (IOException e) {
>>>>>>>>           Debug.logError(e, "Could not send redirect to: " +
>>>>>>>> target, module);
>>>>>>>>       }
>>>>>>>>
>>>>>>>> }
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> categorydetail.bsh --->
>>>>>>>>
>>>>>>>>
>>>>>>>> otaHotelAvailRSDocument =
>>>>>>>> request.getAttribute("otaHotelAvailRSDocument");
>>>>>>>>
>>>>>>>> if (otaHotelAvailRSDocument == null) {
>>>>>>>>     System.out.println("---request----> otaHotelAvailRSDocument
>>>>>>>> is NULL");   } else {
>>>>>>>>     System.out.println("---request----> otaHotelAvailRSDocument
>>>>>>>> is NOT NULL");
>>>>>>>> }
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> ---request----> otaHotelAvailRSDocument is NULL
>>>>>>>>
>>>>>>>>
>>>>>>>> Kind regards
>>>>>>>>
>>>>>>>> Grant Edwards
>>>>>>>>
>>>>>>>>
>>>>>>>>           
>>>>>>       
>>>>
>>>>
>>>>   
>>>
>>
> 
> 
> 

Reply via email to