Here is some code explaining my point.

<h:inputText id="Altura" value="#{laBean.alturaStr}"
bunding="#{laBean.alturaInput}">
<h:message for="Altura" id="messageLabelA"/>
<h:message for="Altura" id="messageLabelB"/>

Then laBean does this in some point:



private transient UIInput alturaInput;
   public UIInput getAlturaInput()
   {
       return this.AlturaInput;
   }
   public void setAlturaInput(UIInput alturaInput)
   {
       this.alturaInput = alturaInput;
   }

...

FacesContext ctx = FacesContext.getCurrentInstance();
String alturaID = alturaInput.getClientId(ctx);
ctx.addMessage(alturaID,MessageFactory.getMessage(context,"notLikeIwant"));
ctx.addMessage(alturaID,MessageFactory.getMessage(context,"notLikeIwish"));

Well 


The desired output is boths messages "notLikeIwant"
and "notLikeIwish" (from the bundle) placed right near
the input. But the result is a repeated "notLikeIwant"
message near the input.


This was for explain my point 2)

My point 1) was suggesting the existence of a Messages
like tag. But with the behaviour of only show messages
which clientID parameter match it's clientID .

I mean, I would like to be abel to do something like
this : 

<h:inputText id="Altura" value="#{laBean.alturaStr}"
binding="#{laBean.alturaInput}"/>
<h:Messages for="Altura" id="messageLabelA"/>

        and in .java:

ctx.addMessage(alturaID,MessageFactory.getMessage(context,"notLikeIwant"));
ctx.addMessage(alturaID,MessageFactory.getMessage(context,"notLikeIwish"));

Or this:

<h:inputText id="Altura" value="#{laBean.alturaStr}"/>
<h:Messages id="messageLabelA"
binding="#{laBean.messages}"/>

         and in .java:

ctx.addMessage(messageID,MessageFactory.getMessage(context,"notLikeIwant"));
ctx.addMessage(messageID,MessageFactory.getMessage(context,"notLikeIwish"));

This approaches have the pluss that the nice <ul>
would be rendered . ul can not be achieved useing
mulyple message tags like in  the first example (where
i explained my point 2).

Well

I hope you undestrand my point now. Please ask if not.

Thanks for the attention.

Michael





--- Mike Kienenberger <[EMAIL PROTECTED]> wrote:

> Moving this back to user since it's not dealing with
> the MyFaces
> project development, but is instead dealing with
> using MyFaces and
> JSF...
> 
> 
> I'm not completely sure I understand your
> description of the situation
> with 1), but you can certainly display messages both
> with no
> associated component as well as with an associated
> component.
> 
> See this link for examples of both.  You can combine
> and arrange them
> on the same page however you like.
> 
>
http://wiki.apache.org/myfaces/Create_and_Display_Messages
> 
> As for 2), I've never tried assigning multiple
> message tags to the
> same component, but I would expect it works fine.  
> Assigning multiple
> dataScrollers to the same dataTable component works
> fine, and I'd be
> surprised if it didn't use the same code.
> 
> On 9/14/05, Michael Jenik <[EMAIL PROTECTED]>
> wrote:
> > hello,
> > 
> > 1)
> > I have the need to show a lists of messages (like
> > Messages tag does) but in diferent points of my
> page.
> > 
> > So I would need to put different Messages tags and
> I
> > would have to be abel to discern between them wen
> I do
> > Context.addMessage(....); in my beans.
> > 
> > There's  discapacity right now. Messages tag only
> can
> > be adjusted to show all messages (not related with
> any
> > Message's for tag attribute) or to show only
> messages
> > with it's clientID param == null .
> > 
> > It would be cool to have a for attribute in the
> > Messages tags. So that I could send multyple
> messages
> > to taht tag from my bean:
> > addMessage("MessagesForAttribute",new
> > FacesMessage(...));
> > 
> > ------------
> > 2)
> > Another problem I have is : If I use two Message
> tag
> > with the same for, then the first addMessage in my
> > bean  which point's to that for is asociated with
> > boths message tags. So the second addMessage I
> hoped
> > it would be asociated with the second message tag
> has
> > no efect.
> > 
> > Hopeing your opinions and comments
> > 
> > Thanks
> > 
> > Michael
> > 
> > 
> > 
> > 
> > 
> >
>
______________________________________________________
> > Yahoo! for Good
> > Donate to the Hurricane Katrina relief effort.
> > http://store.yahoo.com/redcross-donate3/
> > 
> >
> 



                
__________________________________ 
Yahoo! Mail - PC Magazine Editors' Choice 2005 
http://mail.yahoo.com

Reply via email to