On 9/2/05, Andreas Schildbach <[EMAIL PROTECTED]> wrote:
>
> Brian Cook wrote:
> >
> > I just realized if as you said you are using the for fragments to fill
> > in redundant parts of forms [...]
>
> I did not say that.
>
> I'm feeling we are talking at cross-purposes. Let's look at a more
> concrete example:
>
> I want to have an omni-present navigation bar on the left hand side of
> the page. To implement this, I am including a fragment "navigation.do"
> for the navigation bar on every page of my web application. Note that
> this fragment actually consists of its own controller, model and view.
>
> Now, I want that each page can indicate to the navigation bar an entry
> that is highlighted, so that the currently opened part of the web page
> is represented with a highlighted entry in the navigation (also, if the
> highlighted entry is contained in a foldable sub-menu it could be
> expanded). I implement this by feeding in a parameter named "page" from
> every invocation of the fragment.
>
> Thus, the include looks like the following (using JSTL):
>
> <c:import url="navigation.do?page=forum"/>
>
> or, alternatively
>
> <c:import url="navigation.do"><c:param name="page"
> value="forum"/></c:import>
If you just change this to:
<c:set var="page" value="forum" />
<c:import url="navigation.do" />
and then in the controller use:
request.getAttribute("page");
your troubles will be over. :-)
--
Martin Cooper
Obviously, these tags would also be present in pages that have got forms
> (to serve completely different purposes), but this does not matter in my
> case.
>
> What matters more, is that the fragment would also need to be included
> in the _target_ page of any form. Like I said, I need to transmit the
> full UTF range, this is why I am using POST and why I am using
> enctype="multipart/form-data".
>
> The controller of the navigation would read the parameter with the
> statement:
>
> request.getParameter("page")
>
> Could you tell me exactly how to change the <c:import/> example above in
> order for the parameter to actually arrive in the navigation fragment? I
> still don't understand how you want me to transform the parameter into a
> "hidden form parameter".
>
> > Any time you start to make fragments dynamic you will start to run
> > into situations where they will work for some pages but not others.
>
> I am starting to believe this, although it would make JSP technology
> nearly unusable for modularization. How many parts of todays web
> applications are really static? It is ridiculous to expect that
> potentially very complex fragments like (foldable) navigation bars have
> to be duplicated to each model, view and controller of the whole
> application.
>
> > So do not use <a> tags. Just use forms.
>
> Please don't get me wrong, but is this a joke? Are you really telling me
> to replace each
>
> <a href="action.do?param=value">link</a>
>
> by something like
>
> <form method="post" action="action.do">
> <input type="hidden" name="param" value="value"/>
> <input type="submit" value="link"/>
> </form>
>
> ?
>
> Regards,
>
> Andreas
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>