Maybe it is not the best solution, but I would use some javascript to
achieve what you need. You could invoke a javascript function in the
page body onload attribute to make the browser navigate to a section.
Something that could look like this:
[CODE]
<%
String sectionId = "currentSectionIdHere"; // you could retrieve it
from the request or use the variableResolver to retrieve the value
from your bean
%>
<html>
<head>
<SCRIPT LANGUAGE="JavaScript">
<!--
function goToSection()
{
window.location.href = '#<%=sectionId%>';
}
// -->
</SCRIPT>
</head>
<body onload="goToSection()">
[/CODE]
I've made a little test and it works for me. I would have the value
for the current section in your backing bean and load the value in the
beginning of the jsp (String sectionId). Hope this helps,
Bruno
2005/6/3, Darryl Parks <[EMAIL PROTECTED]>:
>
>
> Bruno,
>
> Thanks for the help -- this gets me part of the way and solves the fragment
> naming. (part 1)
>
> I need to be a little more explicit about what I'm trying to accomplish. It
> is pretty standard master-detail approach: I present a list, allow the user
> to select an item and take them to a detail screen. But when a save button
> is pressed on the detail screen, after saving the updates I would like to
> direct the page back to the Listing screen and have it scroll to the item
> just edited. This is a dynamic list and so I can't hard code links and if I
> directly link in html, I lose any changes made on the detail screen.
>
> Essentially is there a way to modify the faces-config.xml to allow a dynamic
> target or bypass it and send directly to the page like this:
> Listing.jsf#dynamicId?
>
> Thanks again,
> Darryl
>
>
>
> ----- Original Message -----
> From: "Bruno Aranda"
> To: "MyFaces Discussion"
> Subject: Re: Targeting fragment
> Date: Fri, 3 Jun 2005 11:09:18 +0200
>
> Maybe this helps:
>
> 1) You could use an h:outputText to output not escaped HTML, like this:
>
> <h:outputText value="<div id='#{cust.userId}'></div>"
> escape="false"></h:outputText>
>
> 2) Then, you can use an h:outputLink, as you can use a standard url to
> navigate:
>
> <h:outputLink value="#section_7">
> <h:outputText value="Go to section 7"/>
> </h:outputLink>
>
> Hope this helps,
>
> Bruno
>
> 2005/6/2, Darryl Parks <[EMAIL PROTECTED]>:
> >
> >
> > I'd like to link to a fragment on the page, actually to a row in a
> > datatable. Preferably I'd like to use commandLink. I've run into a couple
> > of problems:
> > 1) trying to name the segment using the following method:
> > id="#{cust.userId}" forceId="true", gives an error saying the ID can't
> start
> > with # -- so it's apparently not substituting the field value. 2) How do I
> > link to a fragment? The norm under HTML is something like <a
> > href="index.html#section_7" >, but under JSF navigation is through the
> > config.xml. I've searched the newsgroup, without any luck. Any direction
> > would be
> > appreciated!
> > Thanks,
> > Darryl
> >
>
>
>