Topic
4 replies Latest Post - ‏2013-09-17T14:26:20Z by FrankKrout
FrankKrout
FrankKrout
8 Posts
ACCEPTED ANSWER

Pinned topic how to get the menu query string in the menu result output

‏2013-09-04T19:45:44Z |

When re-rendering a page with a category drop down...

I am having an issue pre-filling the category drop down box with the category selected to drive the query.

The content menu result is correctly filtered by the query string category value...

but I can't see a way to get the value of the query string as part of my output.

[Plugin:RequestAttribute key="cat"] always returns a blank/nothing.

Any thoughts would be appreciated...

  • SendhilRamasamy
    SendhilRamasamy
    3 Posts
    ACCEPTED ANSWER

    Re: how to get the menu query string in the menu result output

    ‏2013-09-17T10:59:51Z  in response to FrankKrout

    Hi Frank,

    Any reason why you are using a QueryString? What exactly are the requirements around this component - meaning what do you want to display?

    I may ask a few more questions before we can find a solution.

    Regards,

    Sendhil

    • FrankKrout
      FrankKrout
      8 Posts
      ACCEPTED ANSWER

      Re: how to get the menu query string in the menu result output

      ‏2013-09-17T13:37:05Z  in response to SendhilRamasamy

      Thanks for replying...

      My portal page contains 3 taxonomy drop downs containing categories at the top, under that is a content menu section displaying names and descriptions of content with the selected category.

      So when one selects a category the page re-populates, (the page URL is requested again)  rendering a fresh content menu. A Query string "cat" is added to the URL when the page renders each time to be passed to the menu component to retrieve the content when selected.

      My issue is that I need to prefill the dropdowns showing what was selected when the page refreshes with the new content. I thought the RequestAttribute Plugin would give me this, but it does not seem to work or it is meant for something else.

      So I solved this by writing my own RenderingPlugin. I pass it a parameter which is the query parameter name I want to return in the result and I get what I need to then use javascript to find and prefill the selected dropdown option.

      Is there another way this could have been handled?

      Thanks!

      Attachments

      • SendhilRamasamy
        SendhilRamasamy
        3 Posts
        ACCEPTED ANSWER

        Re: how to get the menu query string in the menu result output

        ‏2013-09-17T14:00:12Z  in response to FrankKrout

        You are most welcome. :-)

        There are several ways to skin this cat I think and again I am not in a position now to judge what might be the best. However for what its worth, I think of an easier way.

        The Rendering Plugin will give you the most flexibility definitely, but will take the longest time to develop, test, cache, performance tune.

        The easier approach is to simply use a custom JSP Component that dynamically filters/selects the drop down for Category selection. The same JSP will also handle the URL Query parameter. The advantage being that Page caching, Testing and Tuning becomes easier. Also another advantage is that this JSP can be hosted from a separate Web Module that can be independently maintained. I do agree that a Rendering Plugin can also be deployed using a Web Module. However if the name of the plugin changes or if a different version of the plugin needs to be selected, we will have to re-configure the Content Viewer portlet and the Portal page if necessary. Whereas with the JSP option, we do not have to change the page or the Portlet. Changing the JSP will be sufficient.

        I would like to know your thoughts.

        Regards,

        Sendhil

         

      • FrankKrout
        FrankKrout
        8 Posts
        ACCEPTED ANSWER

        Re: how to get the menu query string in the menu result output

        ‏2013-09-17T14:26:20Z  in response to FrankKrout

        Ah, so the dropdown selection would essentially fire a jsp request? ie. .../customJSP.jsp?cat=banking  ???

        And then render the whole page (calling the menu component from within) ?

        How is the parameter added to the JSP component within the presentation template?

        For instance, another JSP component I use on another page is pulled in via:

        
        [Component name="radesign/overview detail"]
        

        How am I to pass a parameter to this?

        Also, the rendering plugin is not a ContextProcessor that is configured to the portlet, here is how I use it in the presentation template: (maybe I called it rendering plugin incorrectly - turns out this plugin was quite simple to write). The javascript searches for the ID and it then renders the dropdowns and marks the appropriate one selected. We are relying heavily on javascript in this approach, it was our first cut at this.

         

        <ul id="select-querystring">
        <li>Category: 
        [Plugin:RARequestParameterPlugin param="cat"]</li>
        </ul>