Thanks for the tip. In any case, I solved the issue.

The problem was that I was missing the following line from my JSP:

<jsp:directive.page contentType="text/html;charset=utf-8" />

Once I added that line PPR started working.

David

On Nov 19, 2007 8:49 AM, Luka Surija < [EMAIL PROTECTED]> wrote:

> immediate="true" causes lot of troubles.
>
>
> David Heffelfinger wrote:
> > Hello,
> >
> > Before describing my problem, I need to disclose that I am new to
> > Trinidad, therefore it is entirely possible I am missing something
> > obvious.
> >
> > Not sure if it matters, I am using Trinidad 1.2.3, deploying on
> > GlassFish 2.
> >
> > I am trying to update the options in one <tr:selectOneOption> when the
> > value of another <tr:selectOneOption> changes. Based on what I read at
> > http://myfaces.apache.org/trinidad/devguide/ppr.html#autoSubmit, this
> > should be fairly simple:
> > set autoSubmit="true" on the first <tr:selectOneOption>, bind its
> > valueChangeListener property to a method to be executed when the value
> > of the component changes, and set the partialTriggers property of the
> > second <tr:selectOneOption> to the id of the first one.
> >
> > I attempted this procedure to no avail, I don't think the first
> > <tr:selectOneOption> is triggering a partial submit at all. I Googled
> > around and found some example code in the archives for this list:
> > http://www.mail-archive.com/users@myfaces.apache.org/msg43646.html
> >
> > The code shown in this message was very similar to what I had, but
> > since mine wasn't working and this one allegedly was, I pretty much
> > copied and pasted both the JSP and the backing bean code, but
> > unfortunately it still didn't work.
> >
> > My JSP looks like this:
> >
> > <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"; version="2.1"
> > xmlns:f=" http://java.sun.com/jsf/core";
> > xmlns:h="http://java.sun.com/jsf/html"; xmlns:tr="
> > http://myfaces.apache.org/trinidad
> > <http://myfaces.apache.org/trinidad>"
> > xmlns:trh=" http://myfaces.apache.org/trinidad/html";>
> >   <f:view>
> >     <tr:document id="document1">
> >       <tr:form id="form1">
> >         <tr:panelFormLayout id="panelFormLayout1">
> >           <tr:selectOneChoice label="Select one:"
> >                               required="true"
> >                               requiredMessageDetail="You must select
> one"
> >                               unselectedLabel="Select one..."
> >                               value="#{testBean.firstSelection}"
> >                               readOnly="false"
> >                               valueChangeListener="#{
> > testBean.selectionChange}"
> >                               autoSubmit="true"
> >                               id="firstSelection"
> >                               immediate="true">
> >             <f:selectItems value="#{testBean.firstList}"
> > id="selectItems1" />
> >           </tr:selectOneChoice>
> >
> >           <tr:selectOneChoice  id="selectOneChoice2"
> >                                label="Select:"
> >                                unselectedLabel="Select another one..."
> >                                value="#{testBean.secondSelection}"
> >                                rendered="true"
> >                                partialTriggers="firstSelection">
> >             <f:selectItems value="#{testBean.secondList}"
> > id="selectItems2" />
> >           </tr:selectOneChoice>
> >         </tr:panelFormLayout>
> >       </tr:form>
> >     </tr:document>
> >   </f:view>
> >   </jsp:root>
> >
> > and the backing bean looks like this (package, imports, getters and
> > setter ommited):
> >
> > public class Foo
> > {
> >   private String firstSelection;
> >   private String secondSelection;
> >   private List<SelectItem> secondList;
> >
> >   public void selectionChange(ValueChangeEvent event)
> >   {
> >     String value = (String) event.getNewValue();
> >     if (value.equals("a"))
> >     {
> >       secondList = Arrays.asList(new SelectItem("apple"));
> >     }
> >     else if ( value.equals("b"))
> >     {
> >       secondList = Arrays.asList(new SelectItem("blue"));
> >     }
> >   }
> >
> > After packaging and deploying, I change the value of the first
> > <tr:selectOneChoice>, but the options of the second one don't change.
> > Can someone please point out what am I doing wrong?
> >
> > I have attached a zip file containing the whole project, buildable
> > with Maven, in case someone wants to try it out.
> >
> > Thanks in advance for any help.
> >
> > David
> > --
> > http://ensode.net - A Guide to Java, Linux and Other Technology Topics
> > http://java-ee-5-glassfish.packtpub.com/ - Java EE 5 Development Using
> > GlassFish Application Server
> > http://jasperreportsbook.packtpub.com - JasperReports For Java
> Developers
>
>


-- 
http://ensode.net - A Guide to Java, Linux and Other Technology Topics
http://java-ee-5-glassfish.packtpub.com/ - Java EE 5 Development Using
GlassFish Application Server
http://jasperreportsbook.packtpub.com - JasperReports For Java Developers

Reply via email to