Hallo,
you should post a litle more of your code, the exception occures in a
verbatim tag, i can't see a verbatim tag in your posted code.
so just a guess:
could be a problem with ids: you should assign an id to every created
component.
if on one request one of your commandlinks became a automatic assigned
id '_id<xy>' and in a second request this id is assigned to an verbatim
tag then this can occur.
If this is the problem you should found a warning in your log files.
Regards
Volker
Marius Kreis wrote:
> hello!
> i'm still working on generating a _simple_ list of hyperlinks.
> but when i click on one of them a ClassCastException is thrown.
>
> at first i thought about an error with the ActionListener, but in fact
> the exception is thrown even if there was no actionlistener assigned at
> all.
>
> i just can't figure out whats going wrong......
>
> my jsp looks like this:
>
> <h:commandLink value="#{test.name}">
> <f:actionListener type="my.domain.Test" />
> </h:commandLink>
>
> <h:panelGrid id="panel" rowClasses="oddRow, evenRow">
> </h:panelGrid>
>
>
>
> whereas the Test bean looks like this:
>
> ...
> public void action(ActionEvent e) {
> System.out.println("Action triggered");
> }
>
> public void processAction(ActionEvent actionEvent)
> throws AbortProcessingException {
> UIComponent component = actionEvent.getComponent();
> FacesContext facesContext = FacesContext.getCurrentInstance();
> UIViewRoot root = facesContext.getViewRoot();
> Application application = facesContext.getApplication();
>
> HtmlPanelGrid panel = (HtmlPanelGrid) root.findComponent("panel");
>
> for(int i = 1; i <= 10; i++)
> {
> HtmlCommandLink instanceLink = new HtmlCommandLink();
> instanceLink.setValue("Link #" + i);
>
> // doesn matter if this part is included or not...
> Class[] param = new Class[] { ActionEvent.class };
> MethodBinding actionListener =
> application.createMethodBinding("#{test.action}", param);
> instanceLink.setActionListener(actionListener);
> // ....
>
> panel.getChildren().add(instanceLink);
> }
> }
>
> public String getName() { return "click it"; }
> ...
>
>
> and that's what the exception trace looks like:
>
> java.lang.ClassCastException: javax.faces.component.html.HtmlCommandLink
> at
> org.apache.myfaces.taglib.core.VerbatimTag.doAfterBody(VerbatimTag.java:76)
> at
> org.apache.jsp.test_jsp._jspx_meth_f_verbatim_1(org.apache.jsp.test_jsp:256)
>
> ...
>
> seems as if a UICommand component is casted to an UIOutput component....
> but why?!
>
--
Don't answer to From: address!
Mail to this account are droped if not recieved via mailinglist.
To contact me direct create the mail address by
concatenating my forename to my senders domain.