you're right. That sounds like a great idea.
It's a nice one line fix.

I did a cheap "grep check" through the source code for the use of
UNIQUE_ID_PREFIX
(the constant which defines String "_id") and it's always used
checking for component ID's starting with "_id".

So unless anyone else knows any other reasons the name spacing order
shouldn't be switched...?

thanks,
-Henrik

On 12/28/05, Martin Marinschek <[EMAIL PROTECTED]> wrote:
> Wouldn't it be easier to just change the way the encodeNamespace()
> method works and first use the _id something, and then the portlet
> name?
>
> Would that break anything somewhere else?
>
> regards,
>
> Martin
>
> On 12/29/05, Henrik Bentel <[EMAIL PROTECTED]> wrote:
> > thanks,
> > that makes perfect sense.
> >
> > The natural followup question is:
> > Would it makes sense to change HtmlTextRendererBase to check for index of
> > "_id" instead? I dug around in the myfaces code and it seems
> > PortletExternalContextImpl.encodeNamespace(...) is where the portlet
> > name is appended to the generated id. Though indexOf could be an
> > expensive operation to do very often.
> >
> > -Henrik
> >
> > On 12/28/05, Martin Marinschek <[EMAIL PROTECTED]> wrote:
> > > The reasoning is that every id which doesn't start with _id is meant
> > > to be a user-set id. If the user sets an id, the assumption is that he
> > > wants to do something with it - so this is the reason for rendering
> > > out a span, cause if you don't, the id won't be accessible from CSS or
> > > javascript.
> > >
> > > regards,
> > >
> > > Martin
> > >
> > > On 12/28/05, Henrik Bentel <[EMAIL PROTECTED]> wrote:
> > > > Hi
> > > >
> > > > This question is related to issue MYFACES-702
> > > > (http://issues.apache.org/jira/browse/MYFACES-702)
> > > >
> > > >
> > > > I've got a couple of JSF Portlet  which are running on Liferay 3.6.1.
> > > > And I'm also experiencing the issue mentioned in MYFACES-702 except that
> > > > pretty much all my page components gets wrapped in a span element.
> > > >
> > > > I've looked in both Liferay and Myfaces sources and so far I've found 
> > > > that
> > > > Myfaces HtmlTextRendererBase.java is the culprit which appends
> > > > the span element.
> > > >
> > > > The logic in the code is that:
> > > > (if the component has an ID) AND (the ID does NOT start with "_id")
> > > > then surround the element with a SPAN.
> > > >
> > > > The problem is that when running in the portal every components id is
> > > > "automagically" prefixed with the name of the portlet. So my
> > > > compoenent ID's are like this: "_reporting__id0", "_reporting__id1",
> > > > and so on where the portlet name is "reporting". The portlet name
> > > > matches the <portlet-name> element in portlet.xml.
> > > >
> > > > The workaround mentioned in the issue tracker works for the most part.
> > > > However even verbatim components are surrounded with span tags du to
> > > > their ID's automatically being
> > > > prefixed with portlet name. And the <f:verbatim> tag doesn't have an
> > > > ID attribute so there is no way to avoid the SPAN(spam) elements here.
> > > >
> > > > I haven't yet tracked down where  these ID's are being assigned but I
> > > > was curious if anyone knows the reasoning(or requirement) behind
> > > > injecting the SPAN element?
> > > >
> > > >
> > > > Thanks,
> > > > Henrik Bentel
> > > >
> > >
> > >
> > > --
> > >
> > > http://www.irian.at
> > >
> > > Your JSF powerhouse -
> > > JSF Consulting, Development and
> > > Courses in English and German
> > >
> > > Professional Support for Apache MyFaces
> > >
> >
> >
>
>
> --
>
> http://www.irian.at
>
> Your JSF powerhouse -
> JSF Consulting, Development and
> Courses in English and German
>
> Professional Support for Apache MyFaces
>

Reply via email to