You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Rob Decker <ro...@objectsource.org> on 2005/04/22 23:00:15 UTC

myfaces has no respect for my forms boundaries

I read in Kito Mann's book that you can have multiple forms per jsf page. So I have a 
bunch of forms to implement my paginator. One for each page (plus a couple others). I 
also have them twice (since it shows up top and bottom) by including a page fragment 
with tiles. 

The thing is when a form is submitted (I click a commandLink in the form) it seems 
like the inputs from all forms are collected up and set in the backing bean, not just 
the form the commandLink/button is located in.

I was going to use the dataScroller but it seems like it expects all the data to 
loaded in order for it to work. I'm not using hibernate (although oracle has row limit 
too). But I don't want to change my back end code. 

Is there a way to get myfaces to respect my form boundaries?

--
Rob

@objectsource.org


Re: myfaces has no respect for my forms boundaries

Posted by Rob Decker <ro...@objectsource.org>.
I figured out the multiple field calls. I need to build back up to include the 
scroller again and see what's happening there now. I'm having a problem because 
rendered includes the component in the heirachy even though it's invalid. Let me see 
if I can fix it up with some <c:if>'s.

--
Rob

@objectsource.org


---------- Original Message -----------
From: Bill Dudney <bd...@mac.com>
To: MyFaces Discussion <us...@myfaces.apache.org>
Cc: MyFaces Discussion <us...@myfaces.apache.org>
Sent: Mon, 25 Apr 2005 13:05:07 -0400
Subject: Re: myfaces has no respect for my forms boundaries

> Hi Rob,
> 
> I'm not sure what's happening so I'm guessing.
> 
> Its interesting that the set method is being called 3 times. I don't recall 
> why but I was getting a set method called twice before (but with the correct 
> value both times). Is it possible that more than one component is bound to the 
> searchBean.searchValue property?
> 
> I don't follow what a 'scrollerLink' is.
> 
> HTH,
> 
> -bd-
> 
> On Monday, April 25, 2005, at 12:45PM, Rob Decker <ro...@objectsource.org> wrote:
> 
> >I got rid of the tiles/subviews and decided to try this in one page. I removed the 
> >bottom scroller for now because the id's become duplicated if I put it in the page 
> >twice. So now I have one page/view and the problem still persists in the same way.
> >
> >--
> >Rob
> >
> >@objectsource.org
> >
> >
> >---------- Original Message -----------
> >From: "Rob Decker" <ro...@objectsource.org>
> >To: "MyFaces Discussion" <us...@myfaces.apache.org>
> >Sent: Mon, 25 Apr 2005 12:21:10 -0400
> >Subject: Re: myfaces has no respect for my forms boundaries
> >
> >> Actually it always calls the .setStart(null) method repeatedly no matter the 
> >> scope (I haven't actually application scope and see no point in doing so). I 
> >> just had it commented out the last run.
> >> 
> >> --
> >> Rob
> >> 
> >> @objectsource.org
> >> 
> >> ---------- Original Message -----------
> >> From: "Rob Decker" <ro...@objectsource.org>
> >> To: "MyFaces Discussion" <us...@myfaces.apache.org>
> >> Sent: Mon, 25 Apr 2005 12:14:33 -0400
> >> Subject: Re: myfaces has no respect for my forms boundaries
> >> 
> >> > If my bean scope is request (which is what I prefer since I have no need to 
> >> > store the search in session) the same thing happens as far as the first search 
> >> > working fine and the second getting overwritten somehow. In addition, my 
> >> > scroller links don't work because the action doesn't get called on the 
> >> > commandLink's, so it won't search at all. If I make it session then the 
> >> > scroller links work and what I see in the logs is
> >> > 
> >> > searchBean.setStart(null)
> >> > 
> >> > repeatedly when I click on a scroller link (doesn't happen when bean is 
> >> > request scope).
> >> > 
> >> > I guess it's doing that once for each form input value for start. It just 
> >> > reloads the page if I have the bean in request scope.
> >> > 
> >> > --
> >> > Rob
> >> > 
> >> > @objectsource.org
> >> > 
> >> > ---------- Original Message -----------
> >> > From: Bill Dudney <bd...@mac.com>
> >> > To: MyFaces Discussion <us...@myfaces.apache.org>
> >> > Cc: MyFaces Discussion <us...@myfaces.apache.org>
> >> > Sent: Mon, 25 Apr 2005 12:05:13 -0400
> >> > Subject: Re: myfaces has no respect for my forms boundaries
> >> > 
> >> > > Hi Rob,
> >> > > 
> >> > > What scope is the backing bean (searchBean)? If its application or session it 
> >> > > could be that it works the first time because nothing is set, on the second 
> >> > > search the 'simple' search stuff is set as well as other stuff. A potential 
> >> > > solution is to make the bean request scope.
> >> > > 
> >> > > HTH,
> >> > > 
> >> > > -bd-
> >> > > 
> >> > > On Monday, April 25, 2005, at 12:00PM, Rob Decker <ro...@objectsource.org> 
wrote:
> >> > > 
> >> > > >There is some weird stuff that goes on when I do a search. I have two ways 
to 
> >do 
> >> > it, a 
> >> > > >quick search, which is just a link:
> >> > > >
> >> > > ><f:verbatim>&nbsp;New in last </f:verbatim>
> >> > > >   <h:form style="display:inline">
> >> > > >      <h:commandLink action="#{searchBean.search}">
> >> > > >         <h:outputText value="Day"/>
> >> > > >         <v:inputParam value="#{searchBean.searchType}" paramValue="QUICK"/>
> >> > > >         <v:inputParam value="#{searchBean.searchField}" paramValue="NAME"/>
> >> > > >         <v:inputParam value="#{searchBean.searchValue}" paramValue="*"/>
> >> > > >         <v:inputParam value="#{searchBean.created}" paramValue="BETWEEN"/>
> >> > > >         <v:inputParam value="#{searchBean.createdStartDate}" paramValue="#
> >> > > >{searchBean.yesterday}">
> >> > > >           <f:convertDateTime type="date" dateStyle="short"/>
> >> > > >         </v:inputParam>
> >> > > >         <v:inputParam value="#{searchBean.createdEndDate}" paramValue="#
> >> > > >{searchBean.currentDate}">
> >> > > >           <f:convertDateTime type="date" 
> >> > dateStyle="short"/>                        
> >> > > >         </v:inputParam>
> >> > > >      </h:commandLink>
> >> > > >   </h:form>
> >> > > >
> >> > > >Which works fine if the first search I do. Then I have an advanced search 
with 
> >> the 
> >> > > >fields broken out (not shown). It's on the same page and hidden/shown using 
> >> > > >javascript. It has separate <h:form> tags around it. It works on a first 
search 
> >> > too. 
> >> > > >Since the other code isn't shown until after the first search it may be part 
of 
> >> the 
> >> > > >problem.
> >> > > >
> >> > > >If I search a second time, and change the search parameters, say first I 
search 
> >> > > >for '*', which shows the results fine, then I change it to search 
for 'Test*' 
> >> > (which 
> >> > > >has 3 results). This what my logs show happen in the searchBeach:
> >> > > >
> >> > > >First search (with // comments):
> >> > > >
> >> > > >searchBean.setSearchValue(*) // sets the search value to * correctly
> >> > > >(NAME LIKE %) start=0 // these are a dump of the params
> >> > > >searchBean.search() // this is the search action
> >> > > >
> >> > > >Second search:
> >> > > >
> >> > > >searchBean.setSearchValue(Test*) // sets search value to Test* correctly
> >> > > >searchBean.setSearchValue(null) // sets search value to null for some reason
> >> > > >searchBean.setSearchValue(*) // sets search value to * for some reason
> >> > > >(NAME LIKE %) start=0 // dump of params
> >> > > >searchBean.search() // calls the search action
> >> > > >
> >> > > >It seems like after loading the bean correctly for a new search it decides 
to 
> >> reset 
> >> > > >the bean and load the previous search from some cache somewhere (?). 
> >> > > >
> >> > > >--
> >> > > >Rob
> >> > > >
> >> > > >@objectsource.org
> >> > > >
> >> > > >
> >> > > >---------- Original Message -----------
> >> > > >From: "Rob Decker" <ro...@objectsource.org>
> >> > > >To: "MyFaces Discussion" <us...@myfaces.apache.org>
> >> > > >Sent: Mon, 25 Apr 2005 11:39:24 -0400
> >> > > >Subject: Re: myfaces has no respect for my forms boundaries
> >> > > >
> >> > > >> Here's my jsp code. The code is included as a tiles definition in a 
subview 
> >> > > >> before and after the dataTable that displays the search results like this:
> >> > > >> 
> >> > > >> <f:subview id="topScroller">
> >> > > >>     <tiles:insert name="scroller" flush="false"/>
> >> > > >> </f:subview>
> >> > > >> 
> >> > > >> The searchParams in the <h:outputText> are an <x:buffer> with 
<h:inputHidden> 
> >> > > >> for the search params.
> >> > > >> 
> >> > > >> scroller tile:
> >> > > >> 
> >> > > >> <h:panelGrid columns="3" columnClasses="resultsSummary, resultsScroll, 
> >> > > >> resultsSummary" width="100%" styleClass="resultsCount" rendered="#{!empty 
> >> > > >> searchBean.searchResults && searchBean.searchResults.total gt 0 && 
> >> > > >> (searchBean.searchType eq 'QUICK' || searchBean.searchType 
> >eq 'ADVANCED')}">   
> >> > > >>  <h:outputText value="Results #{searchBean.searchResults.start} to # 
> >> > > >> {searchBean.searchResults.end} of #{searchBean.searchResults.total}"/>   
> >> > > >>  <x:div style="display:inline">        <h:form 
style="display:inline">       
> >> > > >>  <h:commandLink action="#{searchBean.search}" id="fplink" rendered="# 
> >> > > >> {searchBean.searchResults.start gt 
searchBean.searchResults.resultsPerPage}" 
> >> > > >> style="text-decoration:none" onmouseover="this.style.fontWeight='bold'" 
> >> > > >onmouseout="this.style.fontWeight='normal'">
> >> > > >>             <h:outputText value=" << "/>
> >> > > >>             <v:inputParam value="#{searchBean.start}" paramValue="#
> >> > > >> {results.firstPage}"/>
> >> > > >>             <h:outputText value="#{searchParams}" escape="false"/>
> >> > > >>         </h:commandLink>
> >> > > >>         </h:form>
> >> > > >>         <h:outputText id="fp" value=" << " rendered="#{!
> >> > > >> (searchBean.searchResults.start gt 
> >searchBean.searchResults.resultsPerPage)}"/>
> >> > > >> 
> >> > > >>         <h:form style="display:inline">    
> >> > > >>         <h:commandLink action="#{searchBean.search}" id="pplink" 
rendered="#
> >> > > >> {searchBean.searchResults.start gt 1}" style="text-decoration:none" 
> >> > > >> onmouseover="this.style.fontWeight='bold'" 
> >> > > >onmouseout="this.style.fontWeight='normal'">
> >> > > >>             <h:outputText value=" < "/>
> >> > > >>             <v:inputParam value="#{searchBean.start}" paramValue="#
> >> > > >> {searchBean.searchResults.previousPage}"/>
> >> > > >>             <h:outputText value="#{searchParams}" escape="false"/>
> >> > > >>         </h:commandLink>
> >> > > >>         </h:form>
> >> > > >>         <h:outputText id="pp" value=" < " 
> >> > > >> rendered="#{!(searchBean.searchResults.start gt 1)}"/>
> >> > > >> 
> >> > > >>         <x:dataList id="bps" rendered="#{searchBean.beginning}" value="#
> >> > > >> {searchBean.beginningPages}" var="pstart" rowIndexVar="rowIndex">
> >> > > >>             <h:form style="display:inline">
> >> > > >>             <h:commandLink action="#{searchBean.search}" rendered="#
{pstart 
> >lt 
> >> > > >> searchBean.searchResults.start or pstart gt searchBean.searchResults.end}" 
> >> > > >> style="text- decoration:none" onmouseover="this.style.fontWeight='bold'" 
> >> > > >onmouseout="this.style.fontWeight='normal'">
> >> > > >>                 <h:outputText value=" #{rowIndex+1} "/>
> >> > > >>                 <v:inputParam value="#{searchBean.start}" paramValue="#
> >> {pstart}"/>
> >> > > >>                 <h:outputText value="#{searchParams}" escape="false"/>
> >> > > >>             </h:commandLink>
> >> > > >>             </h:form>
> >> > > >>             <h:outputText value=" #{rowIndex+1} " rendered="#{!(pstart lt 
> >> > > >> searchBean.searchResults.start) and !(pstart gt 
> >> searchBean.searchResults.end)}"/>
> >> > > >>         </x:dataList>
> >> > > >>         <h:outputText id="bpse" value=" ... " rendered="#
> >> {searchBean.beginning}"/>
> >> > > >>         <x:dataList id="mps" value="#{searchBean.middlePages}" 
var="pstart" 
> >> > > >> rowIndexVar="rowIndex">
> >> > > >>             <h:form style="display:inline">
> >> > > >>             <h:commandLink action="#{searchBean.search}" rendered="#
{pstart 
> >lt 
> >> > > >> searchBean.searchResults.start or pstart gt searchBean.searchResults.end}" 
> >> > > >> style="text- decoration:none" onmouseover="this.style.fontWeight='bold'" 
> >> > > >onmouseout="this.style.fontWeight='normal'">
> >> > > >>                 <h:outputText value=" #{searchBean.begin+rowIndex+1} "/>
> >> > > >>                 <v:inputParam value="#{searchBean.start}" paramValue="#
> >> {pstart}"/>
> >> > > >>                 <h:outputText value="#{searchParams}" escape="false"/>
> >> > > >>             </h:commandLink>
> >> > > >>             </h:form>
> >> > > >>             <h:outputText value=" #{searchBean.begin+rowIndex+1} " 
rendered="#
> >{!
> >> > > >> (pstart lt searchBean.searchResults.start) and !(pstart gt 
> >> > > >> searchBean.searchResults.end)}"/>        </x:dataList>        
<h:outputText 
> >> > > >> id="epse" value=" ... " rendered="#{searchBean.ending}"/>        
<x:dataList 
> >> > > >> id="eps" rendered="#{searchBean.ending}" value="# 
{searchBean.endingPages}" 
> >> > > >> var="pstart" rowIndexVar="rowIndex" rowCountVar="rowCount">            
> ><h:form 
> >> > > >> style="display:inline">            <h:commandLink 
> >> > > >> action="#{searchBean.search}" rendered="#{pstart lt 
> >> > > >> searchBean.searchResults.start or pstart gt searchBean.searchResults.end}" 
> >> > > >> style="text- decoration:none" onmouseover="this.style.fontWeight='bold'" 
> >> > > >onmouseout="this.style.fontWeight='normal'">
> >> > > >>                 <h:outputText value=" #{searchBean.searchResults.numPages-
> >> > > >> (rowCount- rowIndex)+1} "/>                <v:inputParam 
> >> > > >> value="#{searchBean.start}" paramValue="#{pstart}"/>               
> >> > > >>  <h:outputText value="#{searchParams}" escape="false"/>            
> >> > </h:commandLink>
> >> > > >>             </h:form>
> >> > > >>             <h:outputText value=" #{searchBean.searchResults.numPages-
> >> > > >> (rowCount- rowIndex)+1} " rendered="#{!(pstart lt 
> >> > > >> searchBean.searchResults.start) and !(pstart gt 
> >> searchBean.searchResults.end)}"/>
> >> > > >>         </x:dataList>
> >> > > >> 
> >> > > >>         <h:form style="display:inline">
> >> > > >>         <h:commandLink action="#{searchBean.search}" id="nplink" 
rendered="#
> >> > > >> {searchBean.searchResults.end lt searchBean.searchResults.total}" 
style="text-
> >> > > >> decoration:none" onmouseover="this.style.fontWeight='bold'" 
> >> > > >> onmouseout="this.style.fontWeight='normal'">
> >> > > >>             <h:outputText value=" > "/>
> >> > > >>             <v:inputParam value="#{searchBean.start}" paramValue="#
> >> > > >> {searchBean.searchResults.nextPage}"/>
> >> > > >>             <h:outputText value="#{searchParams}" escape="false"/>
> >> > > >>         </h:commandLink>
> >> > > >>         </h:form>
> >> > > >>         <h:outputText id="np" value=" > " 
> >> > > >> rendered="#{!(searchBean.searchResults.end lt 
> >> searchBean.searchResults.total)}"/>
> >> > > >> 
> >> > > >>         <h:form style="display:inline">
> >> > > >>         <h:commandLink action="#{searchBean.search}" id="lplink" 
rendered="#
> >> > > >> {searchBean.searchResults.end lt searchBean.searchResults.total-
> >> > > >> searchBean.searchResults.resultsPerPage}" style="text-decoration:none" 
> >> > > >> onmouseover="this.style.fontWeight='bold'" 
> >> > > >onmouseout="this.style.fontWeight='normal'">
> >> > > >>             <h:outputText value=" >> "/>
> >> > > >>             <v:inputParam value="#{searchBean.start}" paramValue="#
> >> > > >> {searchBean.searchResults.lastPage}"/>
> >> > > >>             <h:outputText value="#{searchParams}" escape="false"/>
> >> > > >>         </h:commandLink>
> >> > > >>         </h:form>
> >> > > >>         <h:outputText id="lp" value=" >> " 
> >> > > >> rendered="#{!(searchBean.searchResults.end lt 
searchBean.searchResults.total-
> >> > > >> searchBean.searchResults.resultsPerPage)}"/>    </x:div>    <h:outputText 
> >> > value=""/>
> >> > > >> </h:panelGrid>
> >> > > >> 
> >> > > >> --
> >> > > >> Rob
> >> > > >> 
> >> > > >> @objectsource.org
> >> > > >> 
> >> > > >> ---------- Original Message -----------
> >> > > >> From: "Rob Decker" <ro...@objectsource.org>
> >> > > >> To: "MyFaces Discussion" <us...@myfaces.apache.org>
> >> > > >> Sent: Mon, 25 Apr 2005 10:04:57 -0400
> >> > > >> Subject: Re: myfaces has no respect for my forms boundaries
> >> > > >> 
> >> > > >> > Ok, give me an hour so to get to it. Thanks.
> >> > > >> >   ----- Original Message ----- 
> >> > > >> >   From: Bill Dudney 
> >> > > >> >   To: MyFaces Discussion 
> >> > > >> >   Cc: MyFaces Discussion 
> >> > > >> >   Sent: Monday, April 25, 2005 9:53 AM
> >> > > >> >   Subject: Re: myfaces has no respect for my forms boundaries
> >> > > >> > 
> >> > > >> >   Hi Rob,
> >> > > >> > 
> >> > > >> >   I too am using multiple forms on a single page without problems.
> >> > > >> > 
> >> > > >> >   Perhaps there is something wierd with your JSP code as Heath 
suggested? 
> >If 
> >> > > >> > you post some of it I'd be glad to take a look and see if anything 
obvious 
> >> > > >> > pops out.
> >> > > >> > 
> >> > > >> >   TTFN,
> >> > > >> > 
> >> > > >> >   -bd-
> >> > > >> > 
> >> > > >> >   On Monday, April 25, 2005, at 08:58AM, Heath Borders 
> >> > > >> > <he...@gmail.com> wrote:
> >> > > >> > 
> >> > > >> >   >
> >> > > >> >   ><<Original Attached>>
> >> > > >> > 
> >> > > >> > -------------------------------------------------------------------------
---
> >--
> >> > > >> > 
> >> > > >> >   You must have some weird JSP code, because we're using multiple forms 
all 
> >> > > >> > over the place without any problems.  MyFaces should only process the 
JSF 
> >> tree 
> >> > > >> > beneath a submitted form.  All others will not be processed.
> >> > > >> > 
> >> > > >> >   On 4/22/05, Rob Decker <ro...@objectsource.org> wrote: 
> >> > > >> >     I read in Kito Mann's book that you can have multiple forms per jsf 
> >page. 
> >> > > >> > So I have a    bunch of forms to implement my paginator. One for each 
page 
> >> > > >> > (plus a couple others). I     also have them twice (since it shows up 
top 
> >and 
> >> > > >> > bottom) by including a page fragment    with tiles.
> >> > > >> > 
> >> > > >> >     The thing is when a form is submitted (I click a commandLink in the 
> >form)
> >> > > >> >  it seems    like the inputs from all forms are collected up and set in 
the 
> >> > > >> > backing bean, not just     the form the commandLink/button is located in.
> >> > > >> > 
> >> > > >> >     I was going to use the dataScroller but it seems like it expects all 
> >the 
> >> > > >> > data to    loaded in order for it to work. I'm not using hibernate 
> >(although 
> >> > > >> > oracle has row limit     too). But I don't want to change my back end 
code.
> >> > > >> > 
> >> > > >> >     Is there a way to get myfaces to respect my form boundaries?
> >> > > >> > 
> >> > > >> >     --
> >> > > >> >     Rob
> >> > > >> > 
> >> > > >> >     @objectsource.org
> >> > > >> > 
> >> > > >> >   -- 
> >> > > >> >   -Heath Borders-Wing
> >> > > >> >   hborders@mail.win.org
> >> > > >> ------- End of Original Message -------
> >> > > >------- End of Original Message -------
> >> > > >
> >> > > >
> >> > > >
> >> > ------- End of Original Message -------
> >> ------- End of Original Message -------
> >------- End of Original Message -------
> >
> >
> >
------- End of Original Message -------


Re: myfaces has no respect for my forms boundaries

Posted by Bill Dudney <bd...@mac.com>.
Hi Rob,

I'm not sure what's happening so I'm guessing.

Its interesting that the set method is being called 3 times. I don't recall why but I was getting a set method called twice before (but with the correct value both times). Is it possible that more than one component is bound to the searchBean.searchValue property?

I don't follow what a 'scrollerLink' is.

HTH,

-bd-

On Monday, April 25, 2005, at 12:45PM, Rob Decker <ro...@objectsource.org> wrote:

>I got rid of the tiles/subviews and decided to try this in one page. I removed the 
>bottom scroller for now because the id's become duplicated if I put it in the page 
>twice. So now I have one page/view and the problem still persists in the same way.
>
>--
>Rob
>
>@objectsource.org
>
>
>---------- Original Message -----------
>From: "Rob Decker" <ro...@objectsource.org>
>To: "MyFaces Discussion" <us...@myfaces.apache.org>
>Sent: Mon, 25 Apr 2005 12:21:10 -0400
>Subject: Re: myfaces has no respect for my forms boundaries
>
>> Actually it always calls the .setStart(null) method repeatedly no matter the 
>> scope (I haven't actually application scope and see no point in doing so). I 
>> just had it commented out the last run.
>> 
>> --
>> Rob
>> 
>> @objectsource.org
>> 
>> ---------- Original Message -----------
>> From: "Rob Decker" <ro...@objectsource.org>
>> To: "MyFaces Discussion" <us...@myfaces.apache.org>
>> Sent: Mon, 25 Apr 2005 12:14:33 -0400
>> Subject: Re: myfaces has no respect for my forms boundaries
>> 
>> > If my bean scope is request (which is what I prefer since I have no need to 
>> > store the search in session) the same thing happens as far as the first search 
>> > working fine and the second getting overwritten somehow. In addition, my 
>> > scroller links don't work because the action doesn't get called on the 
>> > commandLink's, so it won't search at all. If I make it session then the 
>> > scroller links work and what I see in the logs is
>> > 
>> > searchBean.setStart(null)
>> > 
>> > repeatedly when I click on a scroller link (doesn't happen when bean is 
>> > request scope).
>> > 
>> > I guess it's doing that once for each form input value for start. It just 
>> > reloads the page if I have the bean in request scope.
>> > 
>> > --
>> > Rob
>> > 
>> > @objectsource.org
>> > 
>> > ---------- Original Message -----------
>> > From: Bill Dudney <bd...@mac.com>
>> > To: MyFaces Discussion <us...@myfaces.apache.org>
>> > Cc: MyFaces Discussion <us...@myfaces.apache.org>
>> > Sent: Mon, 25 Apr 2005 12:05:13 -0400
>> > Subject: Re: myfaces has no respect for my forms boundaries
>> > 
>> > > Hi Rob,
>> > > 
>> > > What scope is the backing bean (searchBean)? If its application or session it 
>> > > could be that it works the first time because nothing is set, on the second 
>> > > search the 'simple' search stuff is set as well as other stuff. A potential 
>> > > solution is to make the bean request scope.
>> > > 
>> > > HTH,
>> > > 
>> > > -bd-
>> > > 
>> > > On Monday, April 25, 2005, at 12:00PM, Rob Decker <ro...@objectsource.org> wrote:
>> > > 
>> > > >There is some weird stuff that goes on when I do a search. I have two ways to 
>do 
>> > it, a 
>> > > >quick search, which is just a link:
>> > > >
>> > > ><f:verbatim>&nbsp;New in last </f:verbatim>
>> > > >   <h:form style="display:inline">
>> > > >      <h:commandLink action="#{searchBean.search}">
>> > > >         <h:outputText value="Day"/>
>> > > >         <v:inputParam value="#{searchBean.searchType}" paramValue="QUICK"/>
>> > > >         <v:inputParam value="#{searchBean.searchField}" paramValue="NAME"/>
>> > > >         <v:inputParam value="#{searchBean.searchValue}" paramValue="*"/>
>> > > >         <v:inputParam value="#{searchBean.created}" paramValue="BETWEEN"/>
>> > > >         <v:inputParam value="#{searchBean.createdStartDate}" paramValue="#
>> > > >{searchBean.yesterday}">
>> > > >           <f:convertDateTime type="date" dateStyle="short"/>
>> > > >         </v:inputParam>
>> > > >         <v:inputParam value="#{searchBean.createdEndDate}" paramValue="#
>> > > >{searchBean.currentDate}">
>> > > >           <f:convertDateTime type="date" 
>> > dateStyle="short"/>                        
>> > > >         </v:inputParam>
>> > > >      </h:commandLink>
>> > > >   </h:form>
>> > > >
>> > > >Which works fine if the first search I do. Then I have an advanced search with 
>> the 
>> > > >fields broken out (not shown). It's on the same page and hidden/shown using 
>> > > >javascript. It has separate <h:form> tags around it. It works on a first search 
>> > too. 
>> > > >Since the other code isn't shown until after the first search it may be part of 
>> the 
>> > > >problem.
>> > > >
>> > > >If I search a second time, and change the search parameters, say first I search 
>> > > >for '*', which shows the results fine, then I change it to search for 'Test*' 
>> > (which 
>> > > >has 3 results). This what my logs show happen in the searchBeach:
>> > > >
>> > > >First search (with // comments):
>> > > >
>> > > >searchBean.setSearchValue(*) // sets the search value to * correctly
>> > > >(NAME LIKE %) start=0 // these are a dump of the params
>> > > >searchBean.search() // this is the search action
>> > > >
>> > > >Second search:
>> > > >
>> > > >searchBean.setSearchValue(Test*) // sets search value to Test* correctly
>> > > >searchBean.setSearchValue(null) // sets search value to null for some reason
>> > > >searchBean.setSearchValue(*) // sets search value to * for some reason
>> > > >(NAME LIKE %) start=0 // dump of params
>> > > >searchBean.search() // calls the search action
>> > > >
>> > > >It seems like after loading the bean correctly for a new search it decides to 
>> reset 
>> > > >the bean and load the previous search from some cache somewhere (?). 
>> > > >
>> > > >--
>> > > >Rob
>> > > >
>> > > >@objectsource.org
>> > > >
>> > > >
>> > > >---------- Original Message -----------
>> > > >From: "Rob Decker" <ro...@objectsource.org>
>> > > >To: "MyFaces Discussion" <us...@myfaces.apache.org>
>> > > >Sent: Mon, 25 Apr 2005 11:39:24 -0400
>> > > >Subject: Re: myfaces has no respect for my forms boundaries
>> > > >
>> > > >> Here's my jsp code. The code is included as a tiles definition in a subview 
>> > > >> before and after the dataTable that displays the search results like this:
>> > > >> 
>> > > >> <f:subview id="topScroller">
>> > > >>     <tiles:insert name="scroller" flush="false"/>
>> > > >> </f:subview>
>> > > >> 
>> > > >> The searchParams in the <h:outputText> are an <x:buffer> with <h:inputHidden> 
>> > > >> for the search params.
>> > > >> 
>> > > >> scroller tile:
>> > > >> 
>> > > >> <h:panelGrid columns="3" columnClasses="resultsSummary, resultsScroll, 
>> > > >> resultsSummary" width="100%" styleClass="resultsCount" rendered="#{!empty 
>> > > >> searchBean.searchResults && searchBean.searchResults.total gt 0 && 
>> > > >> (searchBean.searchType eq 'QUICK' || searchBean.searchType 
>eq 'ADVANCED')}">   
>> > > >>  <h:outputText value="Results #{searchBean.searchResults.start} to # 
>> > > >> {searchBean.searchResults.end} of #{searchBean.searchResults.total}"/>   
>> > > >>  <x:div style="display:inline">        <h:form style="display:inline">       
>> > > >>  <h:commandLink action="#{searchBean.search}" id="fplink" rendered="# 
>> > > >> {searchBean.searchResults.start gt searchBean.searchResults.resultsPerPage}" 
>> > > >> style="text-decoration:none" onmouseover="this.style.fontWeight='bold'" 
>> > > >onmouseout="this.style.fontWeight='normal'">
>> > > >>             <h:outputText value=" << "/>
>> > > >>             <v:inputParam value="#{searchBean.start}" paramValue="#
>> > > >> {results.firstPage}"/>
>> > > >>             <h:outputText value="#{searchParams}" escape="false"/>
>> > > >>         </h:commandLink>
>> > > >>         </h:form>
>> > > >>         <h:outputText id="fp" value=" << " rendered="#{!
>> > > >> (searchBean.searchResults.start gt 
>searchBean.searchResults.resultsPerPage)}"/>
>> > > >> 
>> > > >>         <h:form style="display:inline">    
>> > > >>         <h:commandLink action="#{searchBean.search}" id="pplink" rendered="#
>> > > >> {searchBean.searchResults.start gt 1}" style="text-decoration:none" 
>> > > >> onmouseover="this.style.fontWeight='bold'" 
>> > > >onmouseout="this.style.fontWeight='normal'">
>> > > >>             <h:outputText value=" < "/>
>> > > >>             <v:inputParam value="#{searchBean.start}" paramValue="#
>> > > >> {searchBean.searchResults.previousPage}"/>
>> > > >>             <h:outputText value="#{searchParams}" escape="false"/>
>> > > >>         </h:commandLink>
>> > > >>         </h:form>
>> > > >>         <h:outputText id="pp" value=" < " 
>> > > >> rendered="#{!(searchBean.searchResults.start gt 1)}"/>
>> > > >> 
>> > > >>         <x:dataList id="bps" rendered="#{searchBean.beginning}" value="#
>> > > >> {searchBean.beginningPages}" var="pstart" rowIndexVar="rowIndex">
>> > > >>             <h:form style="display:inline">
>> > > >>             <h:commandLink action="#{searchBean.search}" rendered="#{pstart 
>lt 
>> > > >> searchBean.searchResults.start or pstart gt searchBean.searchResults.end}" 
>> > > >> style="text- decoration:none" onmouseover="this.style.fontWeight='bold'" 
>> > > >onmouseout="this.style.fontWeight='normal'">
>> > > >>                 <h:outputText value=" #{rowIndex+1} "/>
>> > > >>                 <v:inputParam value="#{searchBean.start}" paramValue="#
>> {pstart}"/>
>> > > >>                 <h:outputText value="#{searchParams}" escape="false"/>
>> > > >>             </h:commandLink>
>> > > >>             </h:form>
>> > > >>             <h:outputText value=" #{rowIndex+1} " rendered="#{!(pstart lt 
>> > > >> searchBean.searchResults.start) and !(pstart gt 
>> searchBean.searchResults.end)}"/>
>> > > >>         </x:dataList>
>> > > >>         <h:outputText id="bpse" value=" ... " rendered="#
>> {searchBean.beginning}"/>
>> > > >>         <x:dataList id="mps" value="#{searchBean.middlePages}" var="pstart" 
>> > > >> rowIndexVar="rowIndex">
>> > > >>             <h:form style="display:inline">
>> > > >>             <h:commandLink action="#{searchBean.search}" rendered="#{pstart 
>lt 
>> > > >> searchBean.searchResults.start or pstart gt searchBean.searchResults.end}" 
>> > > >> style="text- decoration:none" onmouseover="this.style.fontWeight='bold'" 
>> > > >onmouseout="this.style.fontWeight='normal'">
>> > > >>                 <h:outputText value=" #{searchBean.begin+rowIndex+1} "/>
>> > > >>                 <v:inputParam value="#{searchBean.start}" paramValue="#
>> {pstart}"/>
>> > > >>                 <h:outputText value="#{searchParams}" escape="false"/>
>> > > >>             </h:commandLink>
>> > > >>             </h:form>
>> > > >>             <h:outputText value=" #{searchBean.begin+rowIndex+1} " rendered="#
>{!
>> > > >> (pstart lt searchBean.searchResults.start) and !(pstart gt 
>> > > >> searchBean.searchResults.end)}"/>        </x:dataList>        <h:outputText 
>> > > >> id="epse" value=" ... " rendered="#{searchBean.ending}"/>        <x:dataList 
>> > > >> id="eps" rendered="#{searchBean.ending}" value="# {searchBean.endingPages}" 
>> > > >> var="pstart" rowIndexVar="rowIndex" rowCountVar="rowCount">            
><h:form 
>> > > >> style="display:inline">            <h:commandLink 
>> > > >> action="#{searchBean.search}" rendered="#{pstart lt 
>> > > >> searchBean.searchResults.start or pstart gt searchBean.searchResults.end}" 
>> > > >> style="text- decoration:none" onmouseover="this.style.fontWeight='bold'" 
>> > > >onmouseout="this.style.fontWeight='normal'">
>> > > >>                 <h:outputText value=" #{searchBean.searchResults.numPages-
>> > > >> (rowCount- rowIndex)+1} "/>                <v:inputParam 
>> > > >> value="#{searchBean.start}" paramValue="#{pstart}"/>               
>> > > >>  <h:outputText value="#{searchParams}" escape="false"/>            
>> > </h:commandLink>
>> > > >>             </h:form>
>> > > >>             <h:outputText value=" #{searchBean.searchResults.numPages-
>> > > >> (rowCount- rowIndex)+1} " rendered="#{!(pstart lt 
>> > > >> searchBean.searchResults.start) and !(pstart gt 
>> searchBean.searchResults.end)}"/>
>> > > >>         </x:dataList>
>> > > >> 
>> > > >>         <h:form style="display:inline">
>> > > >>         <h:commandLink action="#{searchBean.search}" id="nplink" rendered="#
>> > > >> {searchBean.searchResults.end lt searchBean.searchResults.total}" style="text-
>> > > >> decoration:none" onmouseover="this.style.fontWeight='bold'" 
>> > > >> onmouseout="this.style.fontWeight='normal'">
>> > > >>             <h:outputText value=" > "/>
>> > > >>             <v:inputParam value="#{searchBean.start}" paramValue="#
>> > > >> {searchBean.searchResults.nextPage}"/>
>> > > >>             <h:outputText value="#{searchParams}" escape="false"/>
>> > > >>         </h:commandLink>
>> > > >>         </h:form>
>> > > >>         <h:outputText id="np" value=" > " 
>> > > >> rendered="#{!(searchBean.searchResults.end lt 
>> searchBean.searchResults.total)}"/>
>> > > >> 
>> > > >>         <h:form style="display:inline">
>> > > >>         <h:commandLink action="#{searchBean.search}" id="lplink" rendered="#
>> > > >> {searchBean.searchResults.end lt searchBean.searchResults.total-
>> > > >> searchBean.searchResults.resultsPerPage}" style="text-decoration:none" 
>> > > >> onmouseover="this.style.fontWeight='bold'" 
>> > > >onmouseout="this.style.fontWeight='normal'">
>> > > >>             <h:outputText value=" >> "/>
>> > > >>             <v:inputParam value="#{searchBean.start}" paramValue="#
>> > > >> {searchBean.searchResults.lastPage}"/>
>> > > >>             <h:outputText value="#{searchParams}" escape="false"/>
>> > > >>         </h:commandLink>
>> > > >>         </h:form>
>> > > >>         <h:outputText id="lp" value=" >> " 
>> > > >> rendered="#{!(searchBean.searchResults.end lt searchBean.searchResults.total-
>> > > >> searchBean.searchResults.resultsPerPage)}"/>    </x:div>    <h:outputText 
>> > value=""/>
>> > > >> </h:panelGrid>
>> > > >> 
>> > > >> --
>> > > >> Rob
>> > > >> 
>> > > >> @objectsource.org
>> > > >> 
>> > > >> ---------- Original Message -----------
>> > > >> From: "Rob Decker" <ro...@objectsource.org>
>> > > >> To: "MyFaces Discussion" <us...@myfaces.apache.org>
>> > > >> Sent: Mon, 25 Apr 2005 10:04:57 -0400
>> > > >> Subject: Re: myfaces has no respect for my forms boundaries
>> > > >> 
>> > > >> > Ok, give me an hour so to get to it. Thanks.
>> > > >> >   ----- Original Message ----- 
>> > > >> >   From: Bill Dudney 
>> > > >> >   To: MyFaces Discussion 
>> > > >> >   Cc: MyFaces Discussion 
>> > > >> >   Sent: Monday, April 25, 2005 9:53 AM
>> > > >> >   Subject: Re: myfaces has no respect for my forms boundaries
>> > > >> > 
>> > > >> >   Hi Rob,
>> > > >> > 
>> > > >> >   I too am using multiple forms on a single page without problems.
>> > > >> > 
>> > > >> >   Perhaps there is something wierd with your JSP code as Heath suggested? 
>If 
>> > > >> > you post some of it I'd be glad to take a look and see if anything obvious 
>> > > >> > pops out.
>> > > >> > 
>> > > >> >   TTFN,
>> > > >> > 
>> > > >> >   -bd-
>> > > >> > 
>> > > >> >   On Monday, April 25, 2005, at 08:58AM, Heath Borders 
>> > > >> > <he...@gmail.com> wrote:
>> > > >> > 
>> > > >> >   >
>> > > >> >   ><<Original Attached>>
>> > > >> > 
>> > > >> > ----------------------------------------------------------------------------
>--
>> > > >> > 
>> > > >> >   You must have some weird JSP code, because we're using multiple forms all 
>> > > >> > over the place without any problems.  MyFaces should only process the JSF 
>> tree 
>> > > >> > beneath a submitted form.  All others will not be processed.
>> > > >> > 
>> > > >> >   On 4/22/05, Rob Decker <ro...@objectsource.org> wrote: 
>> > > >> >     I read in Kito Mann's book that you can have multiple forms per jsf 
>page. 
>> > > >> > So I have a    bunch of forms to implement my paginator. One for each page 
>> > > >> > (plus a couple others). I     also have them twice (since it shows up top 
>and 
>> > > >> > bottom) by including a page fragment    with tiles.
>> > > >> > 
>> > > >> >     The thing is when a form is submitted (I click a commandLink in the 
>form)
>> > > >> >  it seems    like the inputs from all forms are collected up and set in the 
>> > > >> > backing bean, not just     the form the commandLink/button is located in.
>> > > >> > 
>> > > >> >     I was going to use the dataScroller but it seems like it expects all 
>the 
>> > > >> > data to    loaded in order for it to work. I'm not using hibernate 
>(although 
>> > > >> > oracle has row limit     too). But I don't want to change my back end code.
>> > > >> > 
>> > > >> >     Is there a way to get myfaces to respect my form boundaries?
>> > > >> > 
>> > > >> >     --
>> > > >> >     Rob
>> > > >> > 
>> > > >> >     @objectsource.org
>> > > >> > 
>> > > >> >   -- 
>> > > >> >   -Heath Borders-Wing
>> > > >> >   hborders@mail.win.org
>> > > >> ------- End of Original Message -------
>> > > >------- End of Original Message -------
>> > > >
>> > > >
>> > > >
>> > ------- End of Original Message -------
>> ------- End of Original Message -------
>------- End of Original Message -------
>
>
>

Re: myfaces has no respect for my forms boundaries

Posted by Rob Decker <ro...@objectsource.org>.
I removed this buffer:

<x:buffer into="#{searchParams}">
    <h:inputHidden value="#{searchBean.searchType}"/>
    <h:inputHidden value="#{searchBean.searchField}"/>
    <h:inputHidden value="#{searchBean.searchValue}"/>
    <h:inputHidden value="#{searchBean.created}"/>
    <h:inputHidden value="#{searchBean.createdStartDate}">
        <f:convertDateTime type="date" dateStyle="short"/>
    </h:inputHidden>
    <h:inputHidden value="#{searchBean.createdEndDate}">
        <f:convertDateTime type="date" dateStyle="short"/>
    </h:inputHidden>            
    <h:inputHidden value="#{searchBean.modified}"/>
    <h:inputHidden value="#{searchBean.modifiedStartDate}">
        <f:convertDateTime type="date" dateStyle="short"/>
    </h:inputHidden>
    <h:inputHidden value="#{searchBean.modifiedEndDate}">
        <f:convertDateTime type="date" dateStyle="short"/>
    </h:inputHidden>
    <h:inputHidden value="#{searchBean.resultsPerPage}"/>
</x:buffer>


and it fixed the overwritten search params. I was using this to store the search 
parameters for the different forms. My understanding was that it made a string that 
was written to the page with say, outputText. It is not inside any of the form tags 
and is just a top level element in the page (inside view after I stripped the page of 
tiles). But apparently when I submit a form on the page it includes all these hidden 
inputs from the buffer (because in the last incarnation I never wrote the buffer back 
to the page).

So there is a bug at least in that myfaces is including form fields that are not 
inside form elements but are otherwise in the component heirarchy in all forms on the 
page. 


--
Rob

@objectsource.org


---------- Original Message -----------
From: "Rob Decker" <ro...@objectsource.org>
To: "MyFaces Discussion" <us...@myfaces.apache.org>
Sent: Mon, 25 Apr 2005 12:45:07 -0400
Subject: Re: myfaces has no respect for my forms boundaries

> I got rid of the tiles/subviews and decided to try this in one page. I removed 
> the bottom scroller for now because the id's become duplicated if I put it in 
> the page twice. So now I have one page/view and the problem still persists in 
> the same way.
> 
> --
> Rob
> 
> @objectsource.org
> 
> ---------- Original Message -----------
> From: "Rob Decker" <ro...@objectsource.org>
> To: "MyFaces Discussion" <us...@myfaces.apache.org>
> Sent: Mon, 25 Apr 2005 12:21:10 -0400
> Subject: Re: myfaces has no respect for my forms boundaries
> 
> > Actually it always calls the .setStart(null) method repeatedly no matter the 
> > scope (I haven't actually application scope and see no point in doing so). I 
> > just had it commented out the last run.
> > 
> > --
> > Rob
> > 
> > @objectsource.org
> > 
> > ---------- Original Message -----------
> > From: "Rob Decker" <ro...@objectsource.org>
> > To: "MyFaces Discussion" <us...@myfaces.apache.org>
> > Sent: Mon, 25 Apr 2005 12:14:33 -0400
> > Subject: Re: myfaces has no respect for my forms boundaries
> > 
> > > If my bean scope is request (which is what I prefer since I have no need to 
> > > store the search in session) the same thing happens as far as the first search 
> > > working fine and the second getting overwritten somehow. In addition, my 
> > > scroller links don't work because the action doesn't get called on the 
> > > commandLink's, so it won't search at all. If I make it session then the 
> > > scroller links work and what I see in the logs is
> > > 
> > > searchBean.setStart(null)
> > > 
> > > repeatedly when I click on a scroller link (doesn't happen when bean is 
> > > request scope).
> > > 
> > > I guess it's doing that once for each form input value for start. It just 
> > > reloads the page if I have the bean in request scope.
> > > 
> > > --
> > > Rob
> > > 
> > > @objectsource.org
> > > 
> > > ---------- Original Message -----------
> > > From: Bill Dudney <bd...@mac.com>
> > > To: MyFaces Discussion <us...@myfaces.apache.org>
> > > Cc: MyFaces Discussion <us...@myfaces.apache.org>
> > > Sent: Mon, 25 Apr 2005 12:05:13 -0400
> > > Subject: Re: myfaces has no respect for my forms boundaries
> > > 
> > > > Hi Rob,
> > > > 
> > > > What scope is the backing bean (searchBean)? If its application or session it 
> > > > could be that it works the first time because nothing is set, on the second 
> > > > search the 'simple' search stuff is set as well as other stuff. A potential 
> > > > solution is to make the bean request scope.
> > > > 
> > > > HTH,
> > > > 
> > > > -bd-
> > > > 
> > > > On Monday, April 25, 2005, at 12:00PM, Rob Decker <ro...@objectsource.org> wrote:
> > > > 
> > > > >There is some weird stuff that goes on when I do a search. I have two ways to 
> do 
> > > it, a 
> > > > >quick search, which is just a link:
> > > > >
> > > > ><f:verbatim>&nbsp;New in last </f:verbatim>
> > > > >   <h:form style="display:inline">
> > > > >      <h:commandLink action="#{searchBean.search}">
> > > > >         <h:outputText value="Day"/>
> > > > >         <v:inputParam value="#{searchBean.searchType}" paramValue="QUICK"/>
> > > > >         <v:inputParam value="#{searchBean.searchField}" paramValue="NAME"/>
> > > > >         <v:inputParam value="#{searchBean.searchValue}" paramValue="*"/>
> > > > >         <v:inputParam value="#{searchBean.created}" paramValue="BETWEEN"/>
> > > > >         <v:inputParam value="#{searchBean.createdStartDate}" paramValue="#
> > > > >{searchBean.yesterday}">
> > > > >           <f:convertDateTime type="date" dateStyle="short"/>
> > > > >         </v:inputParam>
> > > > >         <v:inputParam value="#{searchBean.createdEndDate}" paramValue="#
> > > > >{searchBean.currentDate}">
> > > > >           <f:convertDateTime type="date" 
> > > dateStyle="short"/>                        
> > > > >         </v:inputParam>
> > > > >      </h:commandLink>
> > > > >   </h:form>
> > > > >
> > > > >Which works fine if the first search I do. Then I have an advanced search 
with 
> > the 
> > > > >fields broken out (not shown). It's on the same page and hidden/shown using 
> > > > >javascript. It has separate <h:form> tags around it. It works on a first 
search 
> > > too. 
> > > > >Since the other code isn't shown until after the first search it may be part 
of 
> > the 
> > > > >problem.
> > > > >
> > > > >If I search a second time, and change the search parameters, say first I 
search 
> > > > >for '*', which shows the results fine, then I change it to search for 'Test*' 
> > > (which 
> > > > >has 3 results). This what my logs show happen in the searchBeach:
> > > > >
> > > > >First search (with // comments):
> > > > >
> > > > >searchBean.setSearchValue(*) // sets the search value to * correctly
> > > > >(NAME LIKE %) start=0 // these are a dump of the params
> > > > >searchBean.search() // this is the search action
> > > > >
> > > > >Second search:
> > > > >
> > > > >searchBean.setSearchValue(Test*) // sets search value to Test* correctly
> > > > >searchBean.setSearchValue(null) // sets search value to null for some reason
> > > > >searchBean.setSearchValue(*) // sets search value to * for some reason
> > > > >(NAME LIKE %) start=0 // dump of params
> > > > >searchBean.search() // calls the search action
> > > > >
> > > > >It seems like after loading the bean correctly for a new search it decides to 
> > reset 
> > > > >the bean and load the previous search from some cache somewhere (?). 
> > > > >
> > > > >--
> > > > >Rob
> > > > >
> > > > >@objectsource.org
> > > > >
> > > > >
> > > > >---------- Original Message -----------
> > > > >From: "Rob Decker" <ro...@objectsource.org>
> > > > >To: "MyFaces Discussion" <us...@myfaces.apache.org>
> > > > >Sent: Mon, 25 Apr 2005 11:39:24 -0400
> > > > >Subject: Re: myfaces has no respect for my forms boundaries
> > > > >
> > > > >> Here's my jsp code. The code is included as a tiles definition in a subview 
> > > > >> before and after the dataTable that displays the search results like this:
> > > > >> 
> > > > >> <f:subview id="topScroller">
> > > > >>     <tiles:insert name="scroller" flush="false"/>
> > > > >> </f:subview>
> > > > >> 
> > > > >> The searchParams in the <h:outputText> are an <x:buffer> with 
<h:inputHidden> 
> > > > >> for the search params.
> > > > >> 
> > > > >> scroller tile:
> > > > >> 
> > > > >> <h:panelGrid columns="3" columnClasses="resultsSummary, resultsScroll, 
> > > > >> resultsSummary" width="100%" styleClass="resultsCount" rendered="#{!empty 
> > > > >> searchBean.searchResults && searchBean.searchResults.total gt 0 && 
> > > > >> (searchBean.searchType eq 'QUICK' || searchBean.searchType 
> eq 'ADVANCED')}">   
> > > > >>  <h:outputText value="Results #{searchBean.searchResults.start} to # 
> > > > >> {searchBean.searchResults.end} of #{searchBean.searchResults.total}"/>   
> > > > >>  <x:div style="display:inline">        <h:form 
style="display:inline">       
> > > > >>  <h:commandLink action="#{searchBean.search}" id="fplink" rendered="# 
> > > > >> {searchBean.searchResults.start gt 
searchBean.searchResults.resultsPerPage}" 
> > > > >> style="text-decoration:none" onmouseover="this.style.fontWeight='bold'" 
> > > > >onmouseout="this.style.fontWeight='normal'">
> > > > >>             <h:outputText value=" << "/>
> > > > >>             <v:inputParam value="#{searchBean.start}" paramValue="#
> > > > >> {results.firstPage}"/>
> > > > >>             <h:outputText value="#{searchParams}" escape="false"/>
> > > > >>         </h:commandLink>
> > > > >>         </h:form>
> > > > >>         <h:outputText id="fp" value=" << " rendered="#{!
> > > > >> (searchBean.searchResults.start gt 
> searchBean.searchResults.resultsPerPage)}"/>
> > > > >> 
> > > > >>         <h:form style="display:inline">    
> > > > >>         <h:commandLink action="#{searchBean.search}" id="pplink" rendered="#
> > > > >> {searchBean.searchResults.start gt 1}" style="text-decoration:none" 
> > > > >> onmouseover="this.style.fontWeight='bold'" 
> > > > >onmouseout="this.style.fontWeight='normal'">
> > > > >>             <h:outputText value=" < "/>
> > > > >>             <v:inputParam value="#{searchBean.start}" paramValue="#
> > > > >> {searchBean.searchResults.previousPage}"/>
> > > > >>             <h:outputText value="#{searchParams}" escape="false"/>
> > > > >>         </h:commandLink>
> > > > >>         </h:form>
> > > > >>         <h:outputText id="pp" value=" < " 
> > > > >> rendered="#{!(searchBean.searchResults.start gt 1)}"/>
> > > > >> 
> > > > >>         <x:dataList id="bps" rendered="#{searchBean.beginning}" value="#
> > > > >> {searchBean.beginningPages}" var="pstart" rowIndexVar="rowIndex">
> > > > >>             <h:form style="display:inline">
> > > > >>             <h:commandLink action="#{searchBean.search}" rendered="#{pstart 
> lt 
> > > > >> searchBean.searchResults.start or pstart gt searchBean.searchResults.end}" 
> > > > >> style="text- decoration:none" onmouseover="this.style.fontWeight='bold'" 
> > > > >onmouseout="this.style.fontWeight='normal'">
> > > > >>                 <h:outputText value=" #{rowIndex+1} "/>
> > > > >>                 <v:inputParam value="#{searchBean.start}" paramValue="#
> > {pstart}"/>
> > > > >>                 <h:outputText value="#{searchParams}" escape="false"/>
> > > > >>             </h:commandLink>
> > > > >>             </h:form>
> > > > >>             <h:outputText value=" #{rowIndex+1} " rendered="#{!(pstart lt 
> > > > >> searchBean.searchResults.start) and !(pstart gt 
> > searchBean.searchResults.end)}"/>
> > > > >>         </x:dataList>
> > > > >>         <h:outputText id="bpse" value=" ... " rendered="#
> > {searchBean.beginning}"/>
> > > > >>         <x:dataList id="mps" value="#{searchBean.middlePages}" var="pstart" 
> > > > >> rowIndexVar="rowIndex">
> > > > >>             <h:form style="display:inline">
> > > > >>             <h:commandLink action="#{searchBean.search}" rendered="#{pstart 
> lt 
> > > > >> searchBean.searchResults.start or pstart gt searchBean.searchResults.end}" 
> > > > >> style="text- decoration:none" onmouseover="this.style.fontWeight='bold'" 
> > > > >onmouseout="this.style.fontWeight='normal'">
> > > > >>                 <h:outputText value=" #{searchBean.begin+rowIndex+1} "/>
> > > > >>                 <v:inputParam value="#{searchBean.start}" paramValue="#
> > {pstart}"/>
> > > > >>                 <h:outputText value="#{searchParams}" escape="false"/>
> > > > >>             </h:commandLink>
> > > > >>             </h:form>
> > > > >>             <h:outputText value=" #{searchBean.begin+rowIndex+1} " 
rendered="#
> {!
> > > > >> (pstart lt searchBean.searchResults.start) and !(pstart gt 
> > > > >> searchBean.searchResults.end)}"/>        </x:dataList>        <h:outputText 
> > > > >> id="epse" value=" ... " rendered="#{searchBean.ending}"/>        
<x:dataList 
> > > > >> id="eps" rendered="#{searchBean.ending}" value="# {searchBean.endingPages}" 
> > > > >> var="pstart" rowIndexVar="rowIndex" rowCountVar="rowCount">            
> <h:form 
> > > > >> style="display:inline">            <h:commandLink 
> > > > >> action="#{searchBean.search}" rendered="#{pstart lt 
> > > > >> searchBean.searchResults.start or pstart gt searchBean.searchResults.end}" 
> > > > >> style="text- decoration:none" onmouseover="this.style.fontWeight='bold'" 
> > > > >onmouseout="this.style.fontWeight='normal'">
> > > > >>                 <h:outputText value=" #{searchBean.searchResults.numPages-
> > > > >> (rowCount- rowIndex)+1} "/>                <v:inputParam 
> > > > >> value="#{searchBean.start}" paramValue="#{pstart}"/>               
> > > > >>  <h:outputText value="#{searchParams}" escape="false"/>            
> > > </h:commandLink>
> > > > >>             </h:form>
> > > > >>             <h:outputText value=" #{searchBean.searchResults.numPages-
> > > > >> (rowCount- rowIndex)+1} " rendered="#{!(pstart lt 
> > > > >> searchBean.searchResults.start) and !(pstart gt 
> > searchBean.searchResults.end)}"/>
> > > > >>         </x:dataList>
> > > > >> 
> > > > >>         <h:form style="display:inline">
> > > > >>         <h:commandLink action="#{searchBean.search}" id="nplink" rendered="#
> > > > >> {searchBean.searchResults.end lt searchBean.searchResults.total}" 
style="text-
> > > > >> decoration:none" onmouseover="this.style.fontWeight='bold'" 
> > > > >> onmouseout="this.style.fontWeight='normal'">
> > > > >>             <h:outputText value=" > "/>
> > > > >>             <v:inputParam value="#{searchBean.start}" paramValue="#
> > > > >> {searchBean.searchResults.nextPage}"/>
> > > > >>             <h:outputText value="#{searchParams}" escape="false"/>
> > > > >>         </h:commandLink>
> > > > >>         </h:form>
> > > > >>         <h:outputText id="np" value=" > " 
> > > > >> rendered="#{!(searchBean.searchResults.end lt 
> > searchBean.searchResults.total)}"/>
> > > > >> 
> > > > >>         <h:form style="display:inline">
> > > > >>         <h:commandLink action="#{searchBean.search}" id="lplink" rendered="#
> > > > >> {searchBean.searchResults.end lt searchBean.searchResults.total-
> > > > >> searchBean.searchResults.resultsPerPage}" style="text-decoration:none" 
> > > > >> onmouseover="this.style.fontWeight='bold'" 
> > > > >onmouseout="this.style.fontWeight='normal'">
> > > > >>             <h:outputText value=" >> "/>
> > > > >>             <v:inputParam value="#{searchBean.start}" paramValue="#
> > > > >> {searchBean.searchResults.lastPage}"/>
> > > > >>             <h:outputText value="#{searchParams}" escape="false"/>
> > > > >>         </h:commandLink>
> > > > >>         </h:form>
> > > > >>         <h:outputText id="lp" value=" >> " 
> > > > >> rendered="#{!(searchBean.searchResults.end lt 
searchBean.searchResults.total-
> > > > >> searchBean.searchResults.resultsPerPage)}"/>    </x:div>    <h:outputText 
> > > value=""/>
> > > > >> </h:panelGrid>
> > > > >> 
> > > > >> --
> > > > >> Rob
> > > > >> 
> > > > >> @objectsource.org
> > > > >> 
> > > > >> ---------- Original Message -----------
> > > > >> From: "Rob Decker" <ro...@objectsource.org>
> > > > >> To: "MyFaces Discussion" <us...@myfaces.apache.org>
> > > > >> Sent: Mon, 25 Apr 2005 10:04:57 -0400
> > > > >> Subject: Re: myfaces has no respect for my forms boundaries
> > > > >> 
> > > > >> > Ok, give me an hour so to get to it. Thanks.
> > > > >> >   ----- Original Message ----- 
> > > > >> >   From: Bill Dudney 
> > > > >> >   To: MyFaces Discussion 
> > > > >> >   Cc: MyFaces Discussion 
> > > > >> >   Sent: Monday, April 25, 2005 9:53 AM
> > > > >> >   Subject: Re: myfaces has no respect for my forms boundaries
> > > > >> > 
> > > > >> >   Hi Rob,
> > > > >> > 
> > > > >> >   I too am using multiple forms on a single page without problems.
> > > > >> > 
> > > > >> >   Perhaps there is something wierd with your JSP code as Heath suggested? 
> If 
> > > > >> > you post some of it I'd be glad to take a look and see if anything 
obvious 
> > > > >> > pops out.
> > > > >> > 
> > > > >> >   TTFN,
> > > > >> > 
> > > > >> >   -bd-
> > > > >> > 
> > > > >> >   On Monday, April 25, 2005, at 08:58AM, Heath Borders 
> > > > >> > <he...@gmail.com> wrote:
> > > > >> > 
> > > > >> >   >
> > > > >> >   ><<Original Attached>>
> > > > >> > 
> > > > >> > --------------------------------------------------------------------------
--
> --
> > > > >> > 
> > > > >> >   You must have some weird JSP code, because we're using multiple forms 
all 
> > > > >> > over the place without any problems.  MyFaces should only process the JSF 
> > tree 
> > > > >> > beneath a submitted form.  All others will not be processed.
> > > > >> > 
> > > > >> >   On 4/22/05, Rob Decker <ro...@objectsource.org> wrote: 
> > > > >> >     I read in Kito Mann's book that you can have multiple forms per jsf 
> page. 
> > > > >> > So I have a    bunch of forms to implement my paginator. One for each 
page 
> > > > >> > (plus a couple others). I     also have them twice (since it shows up top 
> and 
> > > > >> > bottom) by including a page fragment    with tiles.
> > > > >> > 
> > > > >> >     The thing is when a form is submitted (I click a commandLink in the 
> form)
> > > > >> >  it seems    like the inputs from all forms are collected up and set in 
the 
> > > > >> > backing bean, not just     the form the commandLink/button is located in.
> > > > >> > 
> > > > >> >     I was going to use the dataScroller but it seems like it expects all 
> the 
> > > > >> > data to    loaded in order for it to work. I'm not using hibernate 
> (although 
> > > > >> > oracle has row limit     too). But I don't want to change my back end 
code.
> > > > >> > 
> > > > >> >     Is there a way to get myfaces to respect my form boundaries?
> > > > >> > 
> > > > >> >     --
> > > > >> >     Rob
> > > > >> > 
> > > > >> >     @objectsource.org
> > > > >> > 
> > > > >> >   -- 
> > > > >> >   -Heath Borders-Wing
> > > > >> >   hborders@mail.win.org
> > > > >> ------- End of Original Message -------
> > > > >------- End of Original Message -------
> > > > >
> > > > >
> > > > >
> > > ------- End of Original Message -------
> > ------- End of Original Message -------
> ------- End of Original Message -------
------- End of Original Message -------


Re: myfaces has no respect for my forms boundaries

Posted by Rob Decker <ro...@objectsource.org>.
I got rid of the tiles/subviews and decided to try this in one page. I removed the 
bottom scroller for now because the id's become duplicated if I put it in the page 
twice. So now I have one page/view and the problem still persists in the same way.

--
Rob

@objectsource.org


---------- Original Message -----------
From: "Rob Decker" <ro...@objectsource.org>
To: "MyFaces Discussion" <us...@myfaces.apache.org>
Sent: Mon, 25 Apr 2005 12:21:10 -0400
Subject: Re: myfaces has no respect for my forms boundaries

> Actually it always calls the .setStart(null) method repeatedly no matter the 
> scope (I haven't actually application scope and see no point in doing so). I 
> just had it commented out the last run.
> 
> --
> Rob
> 
> @objectsource.org
> 
> ---------- Original Message -----------
> From: "Rob Decker" <ro...@objectsource.org>
> To: "MyFaces Discussion" <us...@myfaces.apache.org>
> Sent: Mon, 25 Apr 2005 12:14:33 -0400
> Subject: Re: myfaces has no respect for my forms boundaries
> 
> > If my bean scope is request (which is what I prefer since I have no need to 
> > store the search in session) the same thing happens as far as the first search 
> > working fine and the second getting overwritten somehow. In addition, my 
> > scroller links don't work because the action doesn't get called on the 
> > commandLink's, so it won't search at all. If I make it session then the 
> > scroller links work and what I see in the logs is
> > 
> > searchBean.setStart(null)
> > 
> > repeatedly when I click on a scroller link (doesn't happen when bean is 
> > request scope).
> > 
> > I guess it's doing that once for each form input value for start. It just 
> > reloads the page if I have the bean in request scope.
> > 
> > --
> > Rob
> > 
> > @objectsource.org
> > 
> > ---------- Original Message -----------
> > From: Bill Dudney <bd...@mac.com>
> > To: MyFaces Discussion <us...@myfaces.apache.org>
> > Cc: MyFaces Discussion <us...@myfaces.apache.org>
> > Sent: Mon, 25 Apr 2005 12:05:13 -0400
> > Subject: Re: myfaces has no respect for my forms boundaries
> > 
> > > Hi Rob,
> > > 
> > > What scope is the backing bean (searchBean)? If its application or session it 
> > > could be that it works the first time because nothing is set, on the second 
> > > search the 'simple' search stuff is set as well as other stuff. A potential 
> > > solution is to make the bean request scope.
> > > 
> > > HTH,
> > > 
> > > -bd-
> > > 
> > > On Monday, April 25, 2005, at 12:00PM, Rob Decker <ro...@objectsource.org> wrote:
> > > 
> > > >There is some weird stuff that goes on when I do a search. I have two ways to 
do 
> > it, a 
> > > >quick search, which is just a link:
> > > >
> > > ><f:verbatim>&nbsp;New in last </f:verbatim>
> > > >   <h:form style="display:inline">
> > > >      <h:commandLink action="#{searchBean.search}">
> > > >         <h:outputText value="Day"/>
> > > >         <v:inputParam value="#{searchBean.searchType}" paramValue="QUICK"/>
> > > >         <v:inputParam value="#{searchBean.searchField}" paramValue="NAME"/>
> > > >         <v:inputParam value="#{searchBean.searchValue}" paramValue="*"/>
> > > >         <v:inputParam value="#{searchBean.created}" paramValue="BETWEEN"/>
> > > >         <v:inputParam value="#{searchBean.createdStartDate}" paramValue="#
> > > >{searchBean.yesterday}">
> > > >           <f:convertDateTime type="date" dateStyle="short"/>
> > > >         </v:inputParam>
> > > >         <v:inputParam value="#{searchBean.createdEndDate}" paramValue="#
> > > >{searchBean.currentDate}">
> > > >           <f:convertDateTime type="date" 
> > dateStyle="short"/>                        
> > > >         </v:inputParam>
> > > >      </h:commandLink>
> > > >   </h:form>
> > > >
> > > >Which works fine if the first search I do. Then I have an advanced search with 
> the 
> > > >fields broken out (not shown). It's on the same page and hidden/shown using 
> > > >javascript. It has separate <h:form> tags around it. It works on a first search 
> > too. 
> > > >Since the other code isn't shown until after the first search it may be part of 
> the 
> > > >problem.
> > > >
> > > >If I search a second time, and change the search parameters, say first I search 
> > > >for '*', which shows the results fine, then I change it to search for 'Test*' 
> > (which 
> > > >has 3 results). This what my logs show happen in the searchBeach:
> > > >
> > > >First search (with // comments):
> > > >
> > > >searchBean.setSearchValue(*) // sets the search value to * correctly
> > > >(NAME LIKE %) start=0 // these are a dump of the params
> > > >searchBean.search() // this is the search action
> > > >
> > > >Second search:
> > > >
> > > >searchBean.setSearchValue(Test*) // sets search value to Test* correctly
> > > >searchBean.setSearchValue(null) // sets search value to null for some reason
> > > >searchBean.setSearchValue(*) // sets search value to * for some reason
> > > >(NAME LIKE %) start=0 // dump of params
> > > >searchBean.search() // calls the search action
> > > >
> > > >It seems like after loading the bean correctly for a new search it decides to 
> reset 
> > > >the bean and load the previous search from some cache somewhere (?). 
> > > >
> > > >--
> > > >Rob
> > > >
> > > >@objectsource.org
> > > >
> > > >
> > > >---------- Original Message -----------
> > > >From: "Rob Decker" <ro...@objectsource.org>
> > > >To: "MyFaces Discussion" <us...@myfaces.apache.org>
> > > >Sent: Mon, 25 Apr 2005 11:39:24 -0400
> > > >Subject: Re: myfaces has no respect for my forms boundaries
> > > >
> > > >> Here's my jsp code. The code is included as a tiles definition in a subview 
> > > >> before and after the dataTable that displays the search results like this:
> > > >> 
> > > >> <f:subview id="topScroller">
> > > >>     <tiles:insert name="scroller" flush="false"/>
> > > >> </f:subview>
> > > >> 
> > > >> The searchParams in the <h:outputText> are an <x:buffer> with <h:inputHidden> 
> > > >> for the search params.
> > > >> 
> > > >> scroller tile:
> > > >> 
> > > >> <h:panelGrid columns="3" columnClasses="resultsSummary, resultsScroll, 
> > > >> resultsSummary" width="100%" styleClass="resultsCount" rendered="#{!empty 
> > > >> searchBean.searchResults && searchBean.searchResults.total gt 0 && 
> > > >> (searchBean.searchType eq 'QUICK' || searchBean.searchType 
eq 'ADVANCED')}">   
> > > >>  <h:outputText value="Results #{searchBean.searchResults.start} to # 
> > > >> {searchBean.searchResults.end} of #{searchBean.searchResults.total}"/>   
> > > >>  <x:div style="display:inline">        <h:form style="display:inline">       
> > > >>  <h:commandLink action="#{searchBean.search}" id="fplink" rendered="# 
> > > >> {searchBean.searchResults.start gt searchBean.searchResults.resultsPerPage}" 
> > > >> style="text-decoration:none" onmouseover="this.style.fontWeight='bold'" 
> > > >onmouseout="this.style.fontWeight='normal'">
> > > >>             <h:outputText value=" << "/>
> > > >>             <v:inputParam value="#{searchBean.start}" paramValue="#
> > > >> {results.firstPage}"/>
> > > >>             <h:outputText value="#{searchParams}" escape="false"/>
> > > >>         </h:commandLink>
> > > >>         </h:form>
> > > >>         <h:outputText id="fp" value=" << " rendered="#{!
> > > >> (searchBean.searchResults.start gt 
searchBean.searchResults.resultsPerPage)}"/>
> > > >> 
> > > >>         <h:form style="display:inline">    
> > > >>         <h:commandLink action="#{searchBean.search}" id="pplink" rendered="#
> > > >> {searchBean.searchResults.start gt 1}" style="text-decoration:none" 
> > > >> onmouseover="this.style.fontWeight='bold'" 
> > > >onmouseout="this.style.fontWeight='normal'">
> > > >>             <h:outputText value=" < "/>
> > > >>             <v:inputParam value="#{searchBean.start}" paramValue="#
> > > >> {searchBean.searchResults.previousPage}"/>
> > > >>             <h:outputText value="#{searchParams}" escape="false"/>
> > > >>         </h:commandLink>
> > > >>         </h:form>
> > > >>         <h:outputText id="pp" value=" < " 
> > > >> rendered="#{!(searchBean.searchResults.start gt 1)}"/>
> > > >> 
> > > >>         <x:dataList id="bps" rendered="#{searchBean.beginning}" value="#
> > > >> {searchBean.beginningPages}" var="pstart" rowIndexVar="rowIndex">
> > > >>             <h:form style="display:inline">
> > > >>             <h:commandLink action="#{searchBean.search}" rendered="#{pstart 
lt 
> > > >> searchBean.searchResults.start or pstart gt searchBean.searchResults.end}" 
> > > >> style="text- decoration:none" onmouseover="this.style.fontWeight='bold'" 
> > > >onmouseout="this.style.fontWeight='normal'">
> > > >>                 <h:outputText value=" #{rowIndex+1} "/>
> > > >>                 <v:inputParam value="#{searchBean.start}" paramValue="#
> {pstart}"/>
> > > >>                 <h:outputText value="#{searchParams}" escape="false"/>
> > > >>             </h:commandLink>
> > > >>             </h:form>
> > > >>             <h:outputText value=" #{rowIndex+1} " rendered="#{!(pstart lt 
> > > >> searchBean.searchResults.start) and !(pstart gt 
> searchBean.searchResults.end)}"/>
> > > >>         </x:dataList>
> > > >>         <h:outputText id="bpse" value=" ... " rendered="#
> {searchBean.beginning}"/>
> > > >>         <x:dataList id="mps" value="#{searchBean.middlePages}" var="pstart" 
> > > >> rowIndexVar="rowIndex">
> > > >>             <h:form style="display:inline">
> > > >>             <h:commandLink action="#{searchBean.search}" rendered="#{pstart 
lt 
> > > >> searchBean.searchResults.start or pstart gt searchBean.searchResults.end}" 
> > > >> style="text- decoration:none" onmouseover="this.style.fontWeight='bold'" 
> > > >onmouseout="this.style.fontWeight='normal'">
> > > >>                 <h:outputText value=" #{searchBean.begin+rowIndex+1} "/>
> > > >>                 <v:inputParam value="#{searchBean.start}" paramValue="#
> {pstart}"/>
> > > >>                 <h:outputText value="#{searchParams}" escape="false"/>
> > > >>             </h:commandLink>
> > > >>             </h:form>
> > > >>             <h:outputText value=" #{searchBean.begin+rowIndex+1} " rendered="#
{!
> > > >> (pstart lt searchBean.searchResults.start) and !(pstart gt 
> > > >> searchBean.searchResults.end)}"/>        </x:dataList>        <h:outputText 
> > > >> id="epse" value=" ... " rendered="#{searchBean.ending}"/>        <x:dataList 
> > > >> id="eps" rendered="#{searchBean.ending}" value="# {searchBean.endingPages}" 
> > > >> var="pstart" rowIndexVar="rowIndex" rowCountVar="rowCount">            
<h:form 
> > > >> style="display:inline">            <h:commandLink 
> > > >> action="#{searchBean.search}" rendered="#{pstart lt 
> > > >> searchBean.searchResults.start or pstart gt searchBean.searchResults.end}" 
> > > >> style="text- decoration:none" onmouseover="this.style.fontWeight='bold'" 
> > > >onmouseout="this.style.fontWeight='normal'">
> > > >>                 <h:outputText value=" #{searchBean.searchResults.numPages-
> > > >> (rowCount- rowIndex)+1} "/>                <v:inputParam 
> > > >> value="#{searchBean.start}" paramValue="#{pstart}"/>               
> > > >>  <h:outputText value="#{searchParams}" escape="false"/>            
> > </h:commandLink>
> > > >>             </h:form>
> > > >>             <h:outputText value=" #{searchBean.searchResults.numPages-
> > > >> (rowCount- rowIndex)+1} " rendered="#{!(pstart lt 
> > > >> searchBean.searchResults.start) and !(pstart gt 
> searchBean.searchResults.end)}"/>
> > > >>         </x:dataList>
> > > >> 
> > > >>         <h:form style="display:inline">
> > > >>         <h:commandLink action="#{searchBean.search}" id="nplink" rendered="#
> > > >> {searchBean.searchResults.end lt searchBean.searchResults.total}" style="text-
> > > >> decoration:none" onmouseover="this.style.fontWeight='bold'" 
> > > >> onmouseout="this.style.fontWeight='normal'">
> > > >>             <h:outputText value=" > "/>
> > > >>             <v:inputParam value="#{searchBean.start}" paramValue="#
> > > >> {searchBean.searchResults.nextPage}"/>
> > > >>             <h:outputText value="#{searchParams}" escape="false"/>
> > > >>         </h:commandLink>
> > > >>         </h:form>
> > > >>         <h:outputText id="np" value=" > " 
> > > >> rendered="#{!(searchBean.searchResults.end lt 
> searchBean.searchResults.total)}"/>
> > > >> 
> > > >>         <h:form style="display:inline">
> > > >>         <h:commandLink action="#{searchBean.search}" id="lplink" rendered="#
> > > >> {searchBean.searchResults.end lt searchBean.searchResults.total-
> > > >> searchBean.searchResults.resultsPerPage}" style="text-decoration:none" 
> > > >> onmouseover="this.style.fontWeight='bold'" 
> > > >onmouseout="this.style.fontWeight='normal'">
> > > >>             <h:outputText value=" >> "/>
> > > >>             <v:inputParam value="#{searchBean.start}" paramValue="#
> > > >> {searchBean.searchResults.lastPage}"/>
> > > >>             <h:outputText value="#{searchParams}" escape="false"/>
> > > >>         </h:commandLink>
> > > >>         </h:form>
> > > >>         <h:outputText id="lp" value=" >> " 
> > > >> rendered="#{!(searchBean.searchResults.end lt searchBean.searchResults.total-
> > > >> searchBean.searchResults.resultsPerPage)}"/>    </x:div>    <h:outputText 
> > value=""/>
> > > >> </h:panelGrid>
> > > >> 
> > > >> --
> > > >> Rob
> > > >> 
> > > >> @objectsource.org
> > > >> 
> > > >> ---------- Original Message -----------
> > > >> From: "Rob Decker" <ro...@objectsource.org>
> > > >> To: "MyFaces Discussion" <us...@myfaces.apache.org>
> > > >> Sent: Mon, 25 Apr 2005 10:04:57 -0400
> > > >> Subject: Re: myfaces has no respect for my forms boundaries
> > > >> 
> > > >> > Ok, give me an hour so to get to it. Thanks.
> > > >> >   ----- Original Message ----- 
> > > >> >   From: Bill Dudney 
> > > >> >   To: MyFaces Discussion 
> > > >> >   Cc: MyFaces Discussion 
> > > >> >   Sent: Monday, April 25, 2005 9:53 AM
> > > >> >   Subject: Re: myfaces has no respect for my forms boundaries
> > > >> > 
> > > >> >   Hi Rob,
> > > >> > 
> > > >> >   I too am using multiple forms on a single page without problems.
> > > >> > 
> > > >> >   Perhaps there is something wierd with your JSP code as Heath suggested? 
If 
> > > >> > you post some of it I'd be glad to take a look and see if anything obvious 
> > > >> > pops out.
> > > >> > 
> > > >> >   TTFN,
> > > >> > 
> > > >> >   -bd-
> > > >> > 
> > > >> >   On Monday, April 25, 2005, at 08:58AM, Heath Borders 
> > > >> > <he...@gmail.com> wrote:
> > > >> > 
> > > >> >   >
> > > >> >   ><<Original Attached>>
> > > >> > 
> > > >> > ----------------------------------------------------------------------------
--
> > > >> > 
> > > >> >   You must have some weird JSP code, because we're using multiple forms all 
> > > >> > over the place without any problems.  MyFaces should only process the JSF 
> tree 
> > > >> > beneath a submitted form.  All others will not be processed.
> > > >> > 
> > > >> >   On 4/22/05, Rob Decker <ro...@objectsource.org> wrote: 
> > > >> >     I read in Kito Mann's book that you can have multiple forms per jsf 
page. 
> > > >> > So I have a    bunch of forms to implement my paginator. One for each page 
> > > >> > (plus a couple others). I     also have them twice (since it shows up top 
and 
> > > >> > bottom) by including a page fragment    with tiles.
> > > >> > 
> > > >> >     The thing is when a form is submitted (I click a commandLink in the 
form)
> > > >> >  it seems    like the inputs from all forms are collected up and set in the 
> > > >> > backing bean, not just     the form the commandLink/button is located in.
> > > >> > 
> > > >> >     I was going to use the dataScroller but it seems like it expects all 
the 
> > > >> > data to    loaded in order for it to work. I'm not using hibernate 
(although 
> > > >> > oracle has row limit     too). But I don't want to change my back end code.
> > > >> > 
> > > >> >     Is there a way to get myfaces to respect my form boundaries?
> > > >> > 
> > > >> >     --
> > > >> >     Rob
> > > >> > 
> > > >> >     @objectsource.org
> > > >> > 
> > > >> >   -- 
> > > >> >   -Heath Borders-Wing
> > > >> >   hborders@mail.win.org
> > > >> ------- End of Original Message -------
> > > >------- End of Original Message -------
> > > >
> > > >
> > > >
> > ------- End of Original Message -------
> ------- End of Original Message -------
------- End of Original Message -------


Re: myfaces has no respect for my forms boundaries

Posted by Rob Decker <ro...@objectsource.org>.
Actually it always calls the .setStart(null) method repeatedly no matter the scope (I 
haven't actually application scope and see no point in doing so). I just had it 
commented out the last run.

--
Rob

@objectsource.org


---------- Original Message -----------
From: "Rob Decker" <ro...@objectsource.org>
To: "MyFaces Discussion" <us...@myfaces.apache.org>
Sent: Mon, 25 Apr 2005 12:14:33 -0400
Subject: Re: myfaces has no respect for my forms boundaries

> If my bean scope is request (which is what I prefer since I have no need to 
> store the search in session) the same thing happens as far as the first search 
> working fine and the second getting overwritten somehow. In addition, my 
> scroller links don't work because the action doesn't get called on the 
> commandLink's, so it won't search at all. If I make it session then the 
> scroller links work and what I see in the logs is
> 
> searchBean.setStart(null)
> 
> repeatedly when I click on a scroller link (doesn't happen when bean is 
> request scope).
> 
> I guess it's doing that once for each form input value for start. It just 
> reloads the page if I have the bean in request scope.
> 
> --
> Rob
> 
> @objectsource.org
> 
> ---------- Original Message -----------
> From: Bill Dudney <bd...@mac.com>
> To: MyFaces Discussion <us...@myfaces.apache.org>
> Cc: MyFaces Discussion <us...@myfaces.apache.org>
> Sent: Mon, 25 Apr 2005 12:05:13 -0400
> Subject: Re: myfaces has no respect for my forms boundaries
> 
> > Hi Rob,
> > 
> > What scope is the backing bean (searchBean)? If its application or session it 
> > could be that it works the first time because nothing is set, on the second 
> > search the 'simple' search stuff is set as well as other stuff. A potential 
> > solution is to make the bean request scope.
> > 
> > HTH,
> > 
> > -bd-
> > 
> > On Monday, April 25, 2005, at 12:00PM, Rob Decker <ro...@objectsource.org> wrote:
> > 
> > >There is some weird stuff that goes on when I do a search. I have two ways to do 
> it, a 
> > >quick search, which is just a link:
> > >
> > ><f:verbatim>&nbsp;New in last </f:verbatim>
> > >   <h:form style="display:inline">
> > >      <h:commandLink action="#{searchBean.search}">
> > >         <h:outputText value="Day"/>
> > >         <v:inputParam value="#{searchBean.searchType}" paramValue="QUICK"/>
> > >         <v:inputParam value="#{searchBean.searchField}" paramValue="NAME"/>
> > >         <v:inputParam value="#{searchBean.searchValue}" paramValue="*"/>
> > >         <v:inputParam value="#{searchBean.created}" paramValue="BETWEEN"/>
> > >         <v:inputParam value="#{searchBean.createdStartDate}" paramValue="#
> > >{searchBean.yesterday}">
> > >           <f:convertDateTime type="date" dateStyle="short"/>
> > >         </v:inputParam>
> > >         <v:inputParam value="#{searchBean.createdEndDate}" paramValue="#
> > >{searchBean.currentDate}">
> > >           <f:convertDateTime type="date" 
> dateStyle="short"/>                        
> > >         </v:inputParam>
> > >      </h:commandLink>
> > >   </h:form>
> > >
> > >Which works fine if the first search I do. Then I have an advanced search with 
the 
> > >fields broken out (not shown). It's on the same page and hidden/shown using 
> > >javascript. It has separate <h:form> tags around it. It works on a first search 
> too. 
> > >Since the other code isn't shown until after the first search it may be part of 
the 
> > >problem.
> > >
> > >If I search a second time, and change the search parameters, say first I search 
> > >for '*', which shows the results fine, then I change it to search for 'Test*' 
> (which 
> > >has 3 results). This what my logs show happen in the searchBeach:
> > >
> > >First search (with // comments):
> > >
> > >searchBean.setSearchValue(*) // sets the search value to * correctly
> > >(NAME LIKE %) start=0 // these are a dump of the params
> > >searchBean.search() // this is the search action
> > >
> > >Second search:
> > >
> > >searchBean.setSearchValue(Test*) // sets search value to Test* correctly
> > >searchBean.setSearchValue(null) // sets search value to null for some reason
> > >searchBean.setSearchValue(*) // sets search value to * for some reason
> > >(NAME LIKE %) start=0 // dump of params
> > >searchBean.search() // calls the search action
> > >
> > >It seems like after loading the bean correctly for a new search it decides to 
reset 
> > >the bean and load the previous search from some cache somewhere (?). 
> > >
> > >--
> > >Rob
> > >
> > >@objectsource.org
> > >
> > >
> > >---------- Original Message -----------
> > >From: "Rob Decker" <ro...@objectsource.org>
> > >To: "MyFaces Discussion" <us...@myfaces.apache.org>
> > >Sent: Mon, 25 Apr 2005 11:39:24 -0400
> > >Subject: Re: myfaces has no respect for my forms boundaries
> > >
> > >> Here's my jsp code. The code is included as a tiles definition in a subview 
> > >> before and after the dataTable that displays the search results like this:
> > >> 
> > >> <f:subview id="topScroller">
> > >>     <tiles:insert name="scroller" flush="false"/>
> > >> </f:subview>
> > >> 
> > >> The searchParams in the <h:outputText> are an <x:buffer> with <h:inputHidden> 
> > >> for the search params.
> > >> 
> > >> scroller tile:
> > >> 
> > >> <h:panelGrid columns="3" columnClasses="resultsSummary, resultsScroll, 
> > >> resultsSummary" width="100%" styleClass="resultsCount" rendered="#{!empty 
> > >> searchBean.searchResults && searchBean.searchResults.total gt 0 && 
> > >> (searchBean.searchType eq 'QUICK' || searchBean.searchType eq 'ADVANCED')}">   
> > >>  <h:outputText value="Results #{searchBean.searchResults.start} to # 
> > >> {searchBean.searchResults.end} of #{searchBean.searchResults.total}"/>   
> > >>  <x:div style="display:inline">        <h:form style="display:inline">       
> > >>  <h:commandLink action="#{searchBean.search}" id="fplink" rendered="# 
> > >> {searchBean.searchResults.start gt searchBean.searchResults.resultsPerPage}" 
> > >> style="text-decoration:none" onmouseover="this.style.fontWeight='bold'" 
> > >onmouseout="this.style.fontWeight='normal'">
> > >>             <h:outputText value=" << "/>
> > >>             <v:inputParam value="#{searchBean.start}" paramValue="#
> > >> {results.firstPage}"/>
> > >>             <h:outputText value="#{searchParams}" escape="false"/>
> > >>         </h:commandLink>
> > >>         </h:form>
> > >>         <h:outputText id="fp" value=" << " rendered="#{!
> > >> (searchBean.searchResults.start gt searchBean.searchResults.resultsPerPage)}"/>
> > >> 
> > >>         <h:form style="display:inline">    
> > >>         <h:commandLink action="#{searchBean.search}" id="pplink" rendered="#
> > >> {searchBean.searchResults.start gt 1}" style="text-decoration:none" 
> > >> onmouseover="this.style.fontWeight='bold'" 
> > >onmouseout="this.style.fontWeight='normal'">
> > >>             <h:outputText value=" < "/>
> > >>             <v:inputParam value="#{searchBean.start}" paramValue="#
> > >> {searchBean.searchResults.previousPage}"/>
> > >>             <h:outputText value="#{searchParams}" escape="false"/>
> > >>         </h:commandLink>
> > >>         </h:form>
> > >>         <h:outputText id="pp" value=" < " 
> > >> rendered="#{!(searchBean.searchResults.start gt 1)}"/>
> > >> 
> > >>         <x:dataList id="bps" rendered="#{searchBean.beginning}" value="#
> > >> {searchBean.beginningPages}" var="pstart" rowIndexVar="rowIndex">
> > >>             <h:form style="display:inline">
> > >>             <h:commandLink action="#{searchBean.search}" rendered="#{pstart lt 
> > >> searchBean.searchResults.start or pstart gt searchBean.searchResults.end}" 
> > >> style="text- decoration:none" onmouseover="this.style.fontWeight='bold'" 
> > >onmouseout="this.style.fontWeight='normal'">
> > >>                 <h:outputText value=" #{rowIndex+1} "/>
> > >>                 <v:inputParam value="#{searchBean.start}" paramValue="#
{pstart}"/>
> > >>                 <h:outputText value="#{searchParams}" escape="false"/>
> > >>             </h:commandLink>
> > >>             </h:form>
> > >>             <h:outputText value=" #{rowIndex+1} " rendered="#{!(pstart lt 
> > >> searchBean.searchResults.start) and !(pstart gt 
searchBean.searchResults.end)}"/>
> > >>         </x:dataList>
> > >>         <h:outputText id="bpse" value=" ... " rendered="#
{searchBean.beginning}"/>
> > >>         <x:dataList id="mps" value="#{searchBean.middlePages}" var="pstart" 
> > >> rowIndexVar="rowIndex">
> > >>             <h:form style="display:inline">
> > >>             <h:commandLink action="#{searchBean.search}" rendered="#{pstart lt 
> > >> searchBean.searchResults.start or pstart gt searchBean.searchResults.end}" 
> > >> style="text- decoration:none" onmouseover="this.style.fontWeight='bold'" 
> > >onmouseout="this.style.fontWeight='normal'">
> > >>                 <h:outputText value=" #{searchBean.begin+rowIndex+1} "/>
> > >>                 <v:inputParam value="#{searchBean.start}" paramValue="#
{pstart}"/>
> > >>                 <h:outputText value="#{searchParams}" escape="false"/>
> > >>             </h:commandLink>
> > >>             </h:form>
> > >>             <h:outputText value=" #{searchBean.begin+rowIndex+1} " rendered="#{!
> > >> (pstart lt searchBean.searchResults.start) and !(pstart gt 
> > >> searchBean.searchResults.end)}"/>        </x:dataList>        <h:outputText 
> > >> id="epse" value=" ... " rendered="#{searchBean.ending}"/>        <x:dataList 
> > >> id="eps" rendered="#{searchBean.ending}" value="# {searchBean.endingPages}" 
> > >> var="pstart" rowIndexVar="rowIndex" rowCountVar="rowCount">            <h:form 
> > >> style="display:inline">            <h:commandLink 
> > >> action="#{searchBean.search}" rendered="#{pstart lt 
> > >> searchBean.searchResults.start or pstart gt searchBean.searchResults.end}" 
> > >> style="text- decoration:none" onmouseover="this.style.fontWeight='bold'" 
> > >onmouseout="this.style.fontWeight='normal'">
> > >>                 <h:outputText value=" #{searchBean.searchResults.numPages-
> > >> (rowCount- rowIndex)+1} "/>                <v:inputParam 
> > >> value="#{searchBean.start}" paramValue="#{pstart}"/>               
> > >>  <h:outputText value="#{searchParams}" escape="false"/>            
> </h:commandLink>
> > >>             </h:form>
> > >>             <h:outputText value=" #{searchBean.searchResults.numPages-
> > >> (rowCount- rowIndex)+1} " rendered="#{!(pstart lt 
> > >> searchBean.searchResults.start) and !(pstart gt 
searchBean.searchResults.end)}"/>
> > >>         </x:dataList>
> > >> 
> > >>         <h:form style="display:inline">
> > >>         <h:commandLink action="#{searchBean.search}" id="nplink" rendered="#
> > >> {searchBean.searchResults.end lt searchBean.searchResults.total}" style="text-
> > >> decoration:none" onmouseover="this.style.fontWeight='bold'" 
> > >> onmouseout="this.style.fontWeight='normal'">
> > >>             <h:outputText value=" > "/>
> > >>             <v:inputParam value="#{searchBean.start}" paramValue="#
> > >> {searchBean.searchResults.nextPage}"/>
> > >>             <h:outputText value="#{searchParams}" escape="false"/>
> > >>         </h:commandLink>
> > >>         </h:form>
> > >>         <h:outputText id="np" value=" > " 
> > >> rendered="#{!(searchBean.searchResults.end lt 
searchBean.searchResults.total)}"/>
> > >> 
> > >>         <h:form style="display:inline">
> > >>         <h:commandLink action="#{searchBean.search}" id="lplink" rendered="#
> > >> {searchBean.searchResults.end lt searchBean.searchResults.total-
> > >> searchBean.searchResults.resultsPerPage}" style="text-decoration:none" 
> > >> onmouseover="this.style.fontWeight='bold'" 
> > >onmouseout="this.style.fontWeight='normal'">
> > >>             <h:outputText value=" >> "/>
> > >>             <v:inputParam value="#{searchBean.start}" paramValue="#
> > >> {searchBean.searchResults.lastPage}"/>
> > >>             <h:outputText value="#{searchParams}" escape="false"/>
> > >>         </h:commandLink>
> > >>         </h:form>
> > >>         <h:outputText id="lp" value=" >> " 
> > >> rendered="#{!(searchBean.searchResults.end lt searchBean.searchResults.total-
> > >> searchBean.searchResults.resultsPerPage)}"/>    </x:div>    <h:outputText 
> value=""/>
> > >> </h:panelGrid>
> > >> 
> > >> --
> > >> Rob
> > >> 
> > >> @objectsource.org
> > >> 
> > >> ---------- Original Message -----------
> > >> From: "Rob Decker" <ro...@objectsource.org>
> > >> To: "MyFaces Discussion" <us...@myfaces.apache.org>
> > >> Sent: Mon, 25 Apr 2005 10:04:57 -0400
> > >> Subject: Re: myfaces has no respect for my forms boundaries
> > >> 
> > >> > Ok, give me an hour so to get to it. Thanks.
> > >> >   ----- Original Message ----- 
> > >> >   From: Bill Dudney 
> > >> >   To: MyFaces Discussion 
> > >> >   Cc: MyFaces Discussion 
> > >> >   Sent: Monday, April 25, 2005 9:53 AM
> > >> >   Subject: Re: myfaces has no respect for my forms boundaries
> > >> > 
> > >> >   Hi Rob,
> > >> > 
> > >> >   I too am using multiple forms on a single page without problems.
> > >> > 
> > >> >   Perhaps there is something wierd with your JSP code as Heath suggested? If 
> > >> > you post some of it I'd be glad to take a look and see if anything obvious 
> > >> > pops out.
> > >> > 
> > >> >   TTFN,
> > >> > 
> > >> >   -bd-
> > >> > 
> > >> >   On Monday, April 25, 2005, at 08:58AM, Heath Borders 
> > >> > <he...@gmail.com> wrote:
> > >> > 
> > >> >   >
> > >> >   ><<Original Attached>>
> > >> > 
> > >> > ------------------------------------------------------------------------------
> > >> > 
> > >> >   You must have some weird JSP code, because we're using multiple forms all 
> > >> > over the place without any problems.  MyFaces should only process the JSF 
tree 
> > >> > beneath a submitted form.  All others will not be processed.
> > >> > 
> > >> >   On 4/22/05, Rob Decker <ro...@objectsource.org> wrote: 
> > >> >     I read in Kito Mann's book that you can have multiple forms per jsf page. 
> > >> > So I have a    bunch of forms to implement my paginator. One for each page 
> > >> > (plus a couple others). I     also have them twice (since it shows up top and 
> > >> > bottom) by including a page fragment    with tiles.
> > >> > 
> > >> >     The thing is when a form is submitted (I click a commandLink in the form)
> > >> >  it seems    like the inputs from all forms are collected up and set in the 
> > >> > backing bean, not just     the form the commandLink/button is located in.
> > >> > 
> > >> >     I was going to use the dataScroller but it seems like it expects all the 
> > >> > data to    loaded in order for it to work. I'm not using hibernate (although 
> > >> > oracle has row limit     too). But I don't want to change my back end code.
> > >> > 
> > >> >     Is there a way to get myfaces to respect my form boundaries?
> > >> > 
> > >> >     --
> > >> >     Rob
> > >> > 
> > >> >     @objectsource.org
> > >> > 
> > >> >   -- 
> > >> >   -Heath Borders-Wing
> > >> >   hborders@mail.win.org
> > >> ------- End of Original Message -------
> > >------- End of Original Message -------
> > >
> > >
> > >
> ------- End of Original Message -------
------- End of Original Message -------


Re: myfaces has no respect for my forms boundaries

Posted by Rob Decker <ro...@objectsource.org>.
If my bean scope is request (which is what I prefer since I have no need to store the 
search in session) the same thing happens as far as the first search working fine and 
the second getting overwritten somehow. In addition, my scroller links don't work 
because the action doesn't get called on the commandLink's, so it won't search at all. 
If I make it session then the scroller links work and what I see in the logs is 

searchBean.setStart(null) 

repeatedly when I click on a scroller link (doesn't happen when bean is request scope).

I guess it's doing that once for each form input value for start. It just reloads the 
page if I have the bean in request scope.

--
Rob

@objectsource.org


---------- Original Message -----------
From: Bill Dudney <bd...@mac.com>
To: MyFaces Discussion <us...@myfaces.apache.org>
Cc: MyFaces Discussion <us...@myfaces.apache.org>
Sent: Mon, 25 Apr 2005 12:05:13 -0400
Subject: Re: myfaces has no respect for my forms boundaries

> Hi Rob,
> 
> What scope is the backing bean (searchBean)? If its application or session it 
> could be that it works the first time because nothing is set, on the second 
> search the 'simple' search stuff is set as well as other stuff. A potential 
> solution is to make the bean request scope.
> 
> HTH,
> 
> -bd-
> 
> On Monday, April 25, 2005, at 12:00PM, Rob Decker <ro...@objectsource.org> wrote:
> 
> >There is some weird stuff that goes on when I do a search. I have two ways to do 
it, a 
> >quick search, which is just a link:
> >
> ><f:verbatim>&nbsp;New in last </f:verbatim>
> >   <h:form style="display:inline">
> >      <h:commandLink action="#{searchBean.search}">
> >         <h:outputText value="Day"/>
> >         <v:inputParam value="#{searchBean.searchType}" paramValue="QUICK"/>
> >         <v:inputParam value="#{searchBean.searchField}" paramValue="NAME"/>
> >         <v:inputParam value="#{searchBean.searchValue}" paramValue="*"/>
> >         <v:inputParam value="#{searchBean.created}" paramValue="BETWEEN"/>
> >         <v:inputParam value="#{searchBean.createdStartDate}" paramValue="#
> >{searchBean.yesterday}">
> >           <f:convertDateTime type="date" dateStyle="short"/>
> >         </v:inputParam>
> >         <v:inputParam value="#{searchBean.createdEndDate}" paramValue="#
> >{searchBean.currentDate}">
> >           <f:convertDateTime type="date" 
dateStyle="short"/>                        
> >         </v:inputParam>
> >      </h:commandLink>
> >   </h:form>
> >
> >Which works fine if the first search I do. Then I have an advanced search with the 
> >fields broken out (not shown). It's on the same page and hidden/shown using 
> >javascript. It has separate <h:form> tags around it. It works on a first search 
too. 
> >Since the other code isn't shown until after the first search it may be part of the 
> >problem.
> >
> >If I search a second time, and change the search parameters, say first I search 
> >for '*', which shows the results fine, then I change it to search for 'Test*' 
(which 
> >has 3 results). This what my logs show happen in the searchBeach:
> >
> >First search (with // comments):
> >
> >searchBean.setSearchValue(*) // sets the search value to * correctly
> >(NAME LIKE %) start=0 // these are a dump of the params
> >searchBean.search() // this is the search action
> >
> >Second search:
> >
> >searchBean.setSearchValue(Test*) // sets search value to Test* correctly
> >searchBean.setSearchValue(null) // sets search value to null for some reason
> >searchBean.setSearchValue(*) // sets search value to * for some reason
> >(NAME LIKE %) start=0 // dump of params
> >searchBean.search() // calls the search action
> >
> >It seems like after loading the bean correctly for a new search it decides to reset 
> >the bean and load the previous search from some cache somewhere (?). 
> >
> >--
> >Rob
> >
> >@objectsource.org
> >
> >
> >---------- Original Message -----------
> >From: "Rob Decker" <ro...@objectsource.org>
> >To: "MyFaces Discussion" <us...@myfaces.apache.org>
> >Sent: Mon, 25 Apr 2005 11:39:24 -0400
> >Subject: Re: myfaces has no respect for my forms boundaries
> >
> >> Here's my jsp code. The code is included as a tiles definition in a subview 
> >> before and after the dataTable that displays the search results like this:
> >> 
> >> <f:subview id="topScroller">
> >>     <tiles:insert name="scroller" flush="false"/>
> >> </f:subview>
> >> 
> >> The searchParams in the <h:outputText> are an <x:buffer> with <h:inputHidden> 
> >> for the search params.
> >> 
> >> scroller tile:
> >> 
> >> <h:panelGrid columns="3" columnClasses="resultsSummary, resultsScroll, 
> >> resultsSummary" width="100%" styleClass="resultsCount" rendered="#{!empty 
> >> searchBean.searchResults && searchBean.searchResults.total gt 0 && 
> >> (searchBean.searchType eq 'QUICK' || searchBean.searchType eq 'ADVANCED')}">   
> >>  <h:outputText value="Results #{searchBean.searchResults.start} to # 
> >> {searchBean.searchResults.end} of #{searchBean.searchResults.total}"/>   
> >>  <x:div style="display:inline">        <h:form style="display:inline">       
> >>  <h:commandLink action="#{searchBean.search}" id="fplink" rendered="# 
> >> {searchBean.searchResults.start gt searchBean.searchResults.resultsPerPage}" 
> >> style="text-decoration:none" onmouseover="this.style.fontWeight='bold'" 
> >onmouseout="this.style.fontWeight='normal'">
> >>             <h:outputText value=" << "/>
> >>             <v:inputParam value="#{searchBean.start}" paramValue="#
> >> {results.firstPage}"/>
> >>             <h:outputText value="#{searchParams}" escape="false"/>
> >>         </h:commandLink>
> >>         </h:form>
> >>         <h:outputText id="fp" value=" << " rendered="#{!
> >> (searchBean.searchResults.start gt searchBean.searchResults.resultsPerPage)}"/>
> >> 
> >>         <h:form style="display:inline">    
> >>         <h:commandLink action="#{searchBean.search}" id="pplink" rendered="#
> >> {searchBean.searchResults.start gt 1}" style="text-decoration:none" 
> >> onmouseover="this.style.fontWeight='bold'" 
> >onmouseout="this.style.fontWeight='normal'">
> >>             <h:outputText value=" < "/>
> >>             <v:inputParam value="#{searchBean.start}" paramValue="#
> >> {searchBean.searchResults.previousPage}"/>
> >>             <h:outputText value="#{searchParams}" escape="false"/>
> >>         </h:commandLink>
> >>         </h:form>
> >>         <h:outputText id="pp" value=" < " 
> >> rendered="#{!(searchBean.searchResults.start gt 1)}"/>
> >> 
> >>         <x:dataList id="bps" rendered="#{searchBean.beginning}" value="#
> >> {searchBean.beginningPages}" var="pstart" rowIndexVar="rowIndex">
> >>             <h:form style="display:inline">
> >>             <h:commandLink action="#{searchBean.search}" rendered="#{pstart lt 
> >> searchBean.searchResults.start or pstart gt searchBean.searchResults.end}" 
> >> style="text- decoration:none" onmouseover="this.style.fontWeight='bold'" 
> >onmouseout="this.style.fontWeight='normal'">
> >>                 <h:outputText value=" #{rowIndex+1} "/>
> >>                 <v:inputParam value="#{searchBean.start}" paramValue="#{pstart}"/>
> >>                 <h:outputText value="#{searchParams}" escape="false"/>
> >>             </h:commandLink>
> >>             </h:form>
> >>             <h:outputText value=" #{rowIndex+1} " rendered="#{!(pstart lt 
> >> searchBean.searchResults.start) and !(pstart gt searchBean.searchResults.end)}"/>
> >>         </x:dataList>
> >>         <h:outputText id="bpse" value=" ... " rendered="#{searchBean.beginning}"/>
> >>         <x:dataList id="mps" value="#{searchBean.middlePages}" var="pstart" 
> >> rowIndexVar="rowIndex">
> >>             <h:form style="display:inline">
> >>             <h:commandLink action="#{searchBean.search}" rendered="#{pstart lt 
> >> searchBean.searchResults.start or pstart gt searchBean.searchResults.end}" 
> >> style="text- decoration:none" onmouseover="this.style.fontWeight='bold'" 
> >onmouseout="this.style.fontWeight='normal'">
> >>                 <h:outputText value=" #{searchBean.begin+rowIndex+1} "/>
> >>                 <v:inputParam value="#{searchBean.start}" paramValue="#{pstart}"/>
> >>                 <h:outputText value="#{searchParams}" escape="false"/>
> >>             </h:commandLink>
> >>             </h:form>
> >>             <h:outputText value=" #{searchBean.begin+rowIndex+1} " rendered="#{!
> >> (pstart lt searchBean.searchResults.start) and !(pstart gt 
> >> searchBean.searchResults.end)}"/>        </x:dataList>        <h:outputText 
> >> id="epse" value=" ... " rendered="#{searchBean.ending}"/>        <x:dataList 
> >> id="eps" rendered="#{searchBean.ending}" value="# {searchBean.endingPages}" 
> >> var="pstart" rowIndexVar="rowIndex" rowCountVar="rowCount">            <h:form 
> >> style="display:inline">            <h:commandLink 
> >> action="#{searchBean.search}" rendered="#{pstart lt 
> >> searchBean.searchResults.start or pstart gt searchBean.searchResults.end}" 
> >> style="text- decoration:none" onmouseover="this.style.fontWeight='bold'" 
> >onmouseout="this.style.fontWeight='normal'">
> >>                 <h:outputText value=" #{searchBean.searchResults.numPages-
> >> (rowCount- rowIndex)+1} "/>                <v:inputParam 
> >> value="#{searchBean.start}" paramValue="#{pstart}"/>               
> >>  <h:outputText value="#{searchParams}" escape="false"/>            
</h:commandLink>
> >>             </h:form>
> >>             <h:outputText value=" #{searchBean.searchResults.numPages-
> >> (rowCount- rowIndex)+1} " rendered="#{!(pstart lt 
> >> searchBean.searchResults.start) and !(pstart gt searchBean.searchResults.end)}"/>
> >>         </x:dataList>
> >> 
> >>         <h:form style="display:inline">
> >>         <h:commandLink action="#{searchBean.search}" id="nplink" rendered="#
> >> {searchBean.searchResults.end lt searchBean.searchResults.total}" style="text-
> >> decoration:none" onmouseover="this.style.fontWeight='bold'" 
> >> onmouseout="this.style.fontWeight='normal'">
> >>             <h:outputText value=" > "/>
> >>             <v:inputParam value="#{searchBean.start}" paramValue="#
> >> {searchBean.searchResults.nextPage}"/>
> >>             <h:outputText value="#{searchParams}" escape="false"/>
> >>         </h:commandLink>
> >>         </h:form>
> >>         <h:outputText id="np" value=" > " 
> >> rendered="#{!(searchBean.searchResults.end lt searchBean.searchResults.total)}"/>
> >> 
> >>         <h:form style="display:inline">
> >>         <h:commandLink action="#{searchBean.search}" id="lplink" rendered="#
> >> {searchBean.searchResults.end lt searchBean.searchResults.total-
> >> searchBean.searchResults.resultsPerPage}" style="text-decoration:none" 
> >> onmouseover="this.style.fontWeight='bold'" 
> >onmouseout="this.style.fontWeight='normal'">
> >>             <h:outputText value=" >> "/>
> >>             <v:inputParam value="#{searchBean.start}" paramValue="#
> >> {searchBean.searchResults.lastPage}"/>
> >>             <h:outputText value="#{searchParams}" escape="false"/>
> >>         </h:commandLink>
> >>         </h:form>
> >>         <h:outputText id="lp" value=" >> " 
> >> rendered="#{!(searchBean.searchResults.end lt searchBean.searchResults.total-
> >> searchBean.searchResults.resultsPerPage)}"/>    </x:div>    <h:outputText 
value=""/>
> >> </h:panelGrid>
> >> 
> >> --
> >> Rob
> >> 
> >> @objectsource.org
> >> 
> >> ---------- Original Message -----------
> >> From: "Rob Decker" <ro...@objectsource.org>
> >> To: "MyFaces Discussion" <us...@myfaces.apache.org>
> >> Sent: Mon, 25 Apr 2005 10:04:57 -0400
> >> Subject: Re: myfaces has no respect for my forms boundaries
> >> 
> >> > Ok, give me an hour so to get to it. Thanks.
> >> >   ----- Original Message ----- 
> >> >   From: Bill Dudney 
> >> >   To: MyFaces Discussion 
> >> >   Cc: MyFaces Discussion 
> >> >   Sent: Monday, April 25, 2005 9:53 AM
> >> >   Subject: Re: myfaces has no respect for my forms boundaries
> >> > 
> >> >   Hi Rob,
> >> > 
> >> >   I too am using multiple forms on a single page without problems.
> >> > 
> >> >   Perhaps there is something wierd with your JSP code as Heath suggested? If 
> >> > you post some of it I'd be glad to take a look and see if anything obvious 
> >> > pops out.
> >> > 
> >> >   TTFN,
> >> > 
> >> >   -bd-
> >> > 
> >> >   On Monday, April 25, 2005, at 08:58AM, Heath Borders 
> >> > <he...@gmail.com> wrote:
> >> > 
> >> >   >
> >> >   ><<Original Attached>>
> >> > 
> >> > ------------------------------------------------------------------------------
> >> > 
> >> >   You must have some weird JSP code, because we're using multiple forms all 
> >> > over the place without any problems.  MyFaces should only process the JSF tree 
> >> > beneath a submitted form.  All others will not be processed.
> >> > 
> >> >   On 4/22/05, Rob Decker <ro...@objectsource.org> wrote: 
> >> >     I read in Kito Mann's book that you can have multiple forms per jsf page. 
> >> > So I have a    bunch of forms to implement my paginator. One for each page 
> >> > (plus a couple others). I     also have them twice (since it shows up top and 
> >> > bottom) by including a page fragment    with tiles.
> >> > 
> >> >     The thing is when a form is submitted (I click a commandLink in the form)
> >> >  it seems    like the inputs from all forms are collected up and set in the 
> >> > backing bean, not just     the form the commandLink/button is located in.
> >> > 
> >> >     I was going to use the dataScroller but it seems like it expects all the 
> >> > data to    loaded in order for it to work. I'm not using hibernate (although 
> >> > oracle has row limit     too). But I don't want to change my back end code.
> >> > 
> >> >     Is there a way to get myfaces to respect my form boundaries?
> >> > 
> >> >     --
> >> >     Rob
> >> > 
> >> >     @objectsource.org
> >> > 
> >> >   -- 
> >> >   -Heath Borders-Wing
> >> >   hborders@mail.win.org
> >> ------- End of Original Message -------
> >------- End of Original Message -------
> >
> >
> >
------- End of Original Message -------


Re: myfaces has no respect for my forms boundaries

Posted by Bill Dudney <bd...@mac.com>.
Hi Rob,

What scope is the backing bean (searchBean)? If its application or session it could be that it works the first time because nothing is set, on the second search the 'simple' search stuff is set as well as other stuff. A potential solution is to make the bean request scope.

HTH,

-bd-
 
On Monday, April 25, 2005, at 12:00PM, Rob Decker <ro...@objectsource.org> wrote:

>There is some weird stuff that goes on when I do a search. I have two ways to do it, a 
>quick search, which is just a link:
>
><f:verbatim>&nbsp;New in last </f:verbatim>
>   <h:form style="display:inline">
>      <h:commandLink action="#{searchBean.search}">
>         <h:outputText value="Day"/>
>         <v:inputParam value="#{searchBean.searchType}" paramValue="QUICK"/>
>         <v:inputParam value="#{searchBean.searchField}" paramValue="NAME"/>
>         <v:inputParam value="#{searchBean.searchValue}" paramValue="*"/>
>         <v:inputParam value="#{searchBean.created}" paramValue="BETWEEN"/>
>         <v:inputParam value="#{searchBean.createdStartDate}" paramValue="#
>{searchBean.yesterday}">
>           <f:convertDateTime type="date" dateStyle="short"/>
>         </v:inputParam>
>         <v:inputParam value="#{searchBean.createdEndDate}" paramValue="#
>{searchBean.currentDate}">
>           <f:convertDateTime type="date" dateStyle="short"/>                        
>         </v:inputParam>
>      </h:commandLink>
>   </h:form>
>
>Which works fine if the first search I do. Then I have an advanced search with the 
>fields broken out (not shown). It's on the same page and hidden/shown using 
>javascript. It has separate <h:form> tags around it. It works on a first search too. 
>Since the other code isn't shown until after the first search it may be part of the 
>problem.
>
>If I search a second time, and change the search parameters, say first I search 
>for '*', which shows the results fine, then I change it to search for 'Test*' (which 
>has 3 results). This what my logs show happen in the searchBeach:
>
>First search (with // comments):
>
>searchBean.setSearchValue(*) // sets the search value to * correctly
>(NAME LIKE %) start=0 // these are a dump of the params
>searchBean.search() // this is the search action
>
>Second search:
>
>searchBean.setSearchValue(Test*) // sets search value to Test* correctly
>searchBean.setSearchValue(null) // sets search value to null for some reason
>searchBean.setSearchValue(*) // sets search value to * for some reason
>(NAME LIKE %) start=0 // dump of params
>searchBean.search() // calls the search action
>
>It seems like after loading the bean correctly for a new search it decides to reset 
>the bean and load the previous search from some cache somewhere (?). 
>
>--
>Rob
>
>@objectsource.org
>
>
>---------- Original Message -----------
>From: "Rob Decker" <ro...@objectsource.org>
>To: "MyFaces Discussion" <us...@myfaces.apache.org>
>Sent: Mon, 25 Apr 2005 11:39:24 -0400
>Subject: Re: myfaces has no respect for my forms boundaries
>
>> Here's my jsp code. The code is included as a tiles definition in a subview 
>> before and after the dataTable that displays the search results like this:
>> 
>> <f:subview id="topScroller">
>>     <tiles:insert name="scroller" flush="false"/>
>> </f:subview>
>> 
>> The searchParams in the <h:outputText> are an <x:buffer> with <h:inputHidden> 
>> for the search params.
>> 
>> scroller tile:
>> 
>> <h:panelGrid columns="3" columnClasses="resultsSummary, resultsScroll, 
>> resultsSummary" width="100%" styleClass="resultsCount" rendered="#{!empty 
>> searchBean.searchResults && searchBean.searchResults.total gt 0 && 
>> (searchBean.searchType eq 'QUICK' || searchBean.searchType eq 'ADVANCED')}">   
>>  <h:outputText value="Results #{searchBean.searchResults.start} to # 
>> {searchBean.searchResults.end} of #{searchBean.searchResults.total}"/>   
>>  <x:div style="display:inline">        <h:form style="display:inline">       
>>  <h:commandLink action="#{searchBean.search}" id="fplink" rendered="# 
>> {searchBean.searchResults.start gt searchBean.searchResults.resultsPerPage}" 
>> style="text-decoration:none" onmouseover="this.style.fontWeight='bold'" 
>onmouseout="this.style.fontWeight='normal'">
>>             <h:outputText value=" << "/>
>>             <v:inputParam value="#{searchBean.start}" paramValue="#
>> {results.firstPage}"/>
>>             <h:outputText value="#{searchParams}" escape="false"/>
>>         </h:commandLink>
>>         </h:form>
>>         <h:outputText id="fp" value=" << " rendered="#{!
>> (searchBean.searchResults.start gt searchBean.searchResults.resultsPerPage)}"/>
>> 
>>         <h:form style="display:inline">    
>>         <h:commandLink action="#{searchBean.search}" id="pplink" rendered="#
>> {searchBean.searchResults.start gt 1}" style="text-decoration:none" 
>> onmouseover="this.style.fontWeight='bold'" 
>onmouseout="this.style.fontWeight='normal'">
>>             <h:outputText value=" < "/>
>>             <v:inputParam value="#{searchBean.start}" paramValue="#
>> {searchBean.searchResults.previousPage}"/>
>>             <h:outputText value="#{searchParams}" escape="false"/>
>>         </h:commandLink>
>>         </h:form>
>>         <h:outputText id="pp" value=" < " 
>> rendered="#{!(searchBean.searchResults.start gt 1)}"/>
>> 
>>         <x:dataList id="bps" rendered="#{searchBean.beginning}" value="#
>> {searchBean.beginningPages}" var="pstart" rowIndexVar="rowIndex">
>>             <h:form style="display:inline">
>>             <h:commandLink action="#{searchBean.search}" rendered="#{pstart lt 
>> searchBean.searchResults.start or pstart gt searchBean.searchResults.end}" 
>> style="text- decoration:none" onmouseover="this.style.fontWeight='bold'" 
>onmouseout="this.style.fontWeight='normal'">
>>                 <h:outputText value=" #{rowIndex+1} "/>
>>                 <v:inputParam value="#{searchBean.start}" paramValue="#{pstart}"/>
>>                 <h:outputText value="#{searchParams}" escape="false"/>
>>             </h:commandLink>
>>             </h:form>
>>             <h:outputText value=" #{rowIndex+1} " rendered="#{!(pstart lt 
>> searchBean.searchResults.start) and !(pstart gt searchBean.searchResults.end)}"/>
>>         </x:dataList>
>>         <h:outputText id="bpse" value=" ... " rendered="#{searchBean.beginning}"/>
>>         <x:dataList id="mps" value="#{searchBean.middlePages}" var="pstart" 
>> rowIndexVar="rowIndex">
>>             <h:form style="display:inline">
>>             <h:commandLink action="#{searchBean.search}" rendered="#{pstart lt 
>> searchBean.searchResults.start or pstart gt searchBean.searchResults.end}" 
>> style="text- decoration:none" onmouseover="this.style.fontWeight='bold'" 
>onmouseout="this.style.fontWeight='normal'">
>>                 <h:outputText value=" #{searchBean.begin+rowIndex+1} "/>
>>                 <v:inputParam value="#{searchBean.start}" paramValue="#{pstart}"/>
>>                 <h:outputText value="#{searchParams}" escape="false"/>
>>             </h:commandLink>
>>             </h:form>
>>             <h:outputText value=" #{searchBean.begin+rowIndex+1} " rendered="#{!
>> (pstart lt searchBean.searchResults.start) and !(pstart gt 
>> searchBean.searchResults.end)}"/>        </x:dataList>        <h:outputText 
>> id="epse" value=" ... " rendered="#{searchBean.ending}"/>        <x:dataList 
>> id="eps" rendered="#{searchBean.ending}" value="# {searchBean.endingPages}" 
>> var="pstart" rowIndexVar="rowIndex" rowCountVar="rowCount">            <h:form 
>> style="display:inline">            <h:commandLink 
>> action="#{searchBean.search}" rendered="#{pstart lt 
>> searchBean.searchResults.start or pstart gt searchBean.searchResults.end}" 
>> style="text- decoration:none" onmouseover="this.style.fontWeight='bold'" 
>onmouseout="this.style.fontWeight='normal'">
>>                 <h:outputText value=" #{searchBean.searchResults.numPages-
>> (rowCount- rowIndex)+1} "/>                <v:inputParam 
>> value="#{searchBean.start}" paramValue="#{pstart}"/>               
>>  <h:outputText value="#{searchParams}" escape="false"/>            </h:commandLink>
>>             </h:form>
>>             <h:outputText value=" #{searchBean.searchResults.numPages-
>> (rowCount- rowIndex)+1} " rendered="#{!(pstart lt 
>> searchBean.searchResults.start) and !(pstart gt searchBean.searchResults.end)}"/>
>>         </x:dataList>
>> 
>>         <h:form style="display:inline">
>>         <h:commandLink action="#{searchBean.search}" id="nplink" rendered="#
>> {searchBean.searchResults.end lt searchBean.searchResults.total}" style="text-
>> decoration:none" onmouseover="this.style.fontWeight='bold'" 
>> onmouseout="this.style.fontWeight='normal'">
>>             <h:outputText value=" > "/>
>>             <v:inputParam value="#{searchBean.start}" paramValue="#
>> {searchBean.searchResults.nextPage}"/>
>>             <h:outputText value="#{searchParams}" escape="false"/>
>>         </h:commandLink>
>>         </h:form>
>>         <h:outputText id="np" value=" > " 
>> rendered="#{!(searchBean.searchResults.end lt searchBean.searchResults.total)}"/>
>> 
>>         <h:form style="display:inline">
>>         <h:commandLink action="#{searchBean.search}" id="lplink" rendered="#
>> {searchBean.searchResults.end lt searchBean.searchResults.total-
>> searchBean.searchResults.resultsPerPage}" style="text-decoration:none" 
>> onmouseover="this.style.fontWeight='bold'" 
>onmouseout="this.style.fontWeight='normal'">
>>             <h:outputText value=" >> "/>
>>             <v:inputParam value="#{searchBean.start}" paramValue="#
>> {searchBean.searchResults.lastPage}"/>
>>             <h:outputText value="#{searchParams}" escape="false"/>
>>         </h:commandLink>
>>         </h:form>
>>         <h:outputText id="lp" value=" >> " 
>> rendered="#{!(searchBean.searchResults.end lt searchBean.searchResults.total-
>> searchBean.searchResults.resultsPerPage)}"/>    </x:div>    <h:outputText value=""/>
>> </h:panelGrid>
>> 
>> --
>> Rob
>> 
>> @objectsource.org
>> 
>> ---------- Original Message -----------
>> From: "Rob Decker" <ro...@objectsource.org>
>> To: "MyFaces Discussion" <us...@myfaces.apache.org>
>> Sent: Mon, 25 Apr 2005 10:04:57 -0400
>> Subject: Re: myfaces has no respect for my forms boundaries
>> 
>> > Ok, give me an hour so to get to it. Thanks.
>> >   ----- Original Message ----- 
>> >   From: Bill Dudney 
>> >   To: MyFaces Discussion 
>> >   Cc: MyFaces Discussion 
>> >   Sent: Monday, April 25, 2005 9:53 AM
>> >   Subject: Re: myfaces has no respect for my forms boundaries
>> > 
>> >   Hi Rob,
>> > 
>> >   I too am using multiple forms on a single page without problems.
>> > 
>> >   Perhaps there is something wierd with your JSP code as Heath suggested? If 
>> > you post some of it I'd be glad to take a look and see if anything obvious 
>> > pops out.
>> > 
>> >   TTFN,
>> > 
>> >   -bd-
>> > 
>> >   On Monday, April 25, 2005, at 08:58AM, Heath Borders 
>> > <he...@gmail.com> wrote:
>> > 
>> >   >
>> >   ><<Original Attached>>
>> > 
>> > ------------------------------------------------------------------------------
>> > 
>> >   You must have some weird JSP code, because we're using multiple forms all 
>> > over the place without any problems.  MyFaces should only process the JSF tree 
>> > beneath a submitted form.  All others will not be processed.
>> > 
>> >   On 4/22/05, Rob Decker <ro...@objectsource.org> wrote: 
>> >     I read in Kito Mann's book that you can have multiple forms per jsf page. 
>> > So I have a    bunch of forms to implement my paginator. One for each page 
>> > (plus a couple others). I     also have them twice (since it shows up top and 
>> > bottom) by including a page fragment    with tiles.
>> > 
>> >     The thing is when a form is submitted (I click a commandLink in the form)
>> >  it seems    like the inputs from all forms are collected up and set in the 
>> > backing bean, not just     the form the commandLink/button is located in.
>> > 
>> >     I was going to use the dataScroller but it seems like it expects all the 
>> > data to    loaded in order for it to work. I'm not using hibernate (although 
>> > oracle has row limit     too). But I don't want to change my back end code.
>> > 
>> >     Is there a way to get myfaces to respect my form boundaries?
>> > 
>> >     --
>> >     Rob
>> > 
>> >     @objectsource.org
>> > 
>> >   -- 
>> >   -Heath Borders-Wing
>> >   hborders@mail.win.org
>> ------- End of Original Message -------
>------- End of Original Message -------
>
>
>

Re: myfaces has no respect for my forms boundaries

Posted by Rob Decker <ro...@objectsource.org>.
There is some weird stuff that goes on when I do a search. I have two ways to do it, a 
quick search, which is just a link:

<f:verbatim>&nbsp;New in last </f:verbatim>
   <h:form style="display:inline">
      <h:commandLink action="#{searchBean.search}">
         <h:outputText value="Day"/>
         <v:inputParam value="#{searchBean.searchType}" paramValue="QUICK"/>
         <v:inputParam value="#{searchBean.searchField}" paramValue="NAME"/>
         <v:inputParam value="#{searchBean.searchValue}" paramValue="*"/>
         <v:inputParam value="#{searchBean.created}" paramValue="BETWEEN"/>
         <v:inputParam value="#{searchBean.createdStartDate}" paramValue="#
{searchBean.yesterday}">
           <f:convertDateTime type="date" dateStyle="short"/>
         </v:inputParam>
         <v:inputParam value="#{searchBean.createdEndDate}" paramValue="#
{searchBean.currentDate}">
           <f:convertDateTime type="date" dateStyle="short"/>                        
         </v:inputParam>
      </h:commandLink>
   </h:form>

Which works fine if the first search I do. Then I have an advanced search with the 
fields broken out (not shown). It's on the same page and hidden/shown using 
javascript. It has separate <h:form> tags around it. It works on a first search too. 
Since the other code isn't shown until after the first search it may be part of the 
problem.

If I search a second time, and change the search parameters, say first I search 
for '*', which shows the results fine, then I change it to search for 'Test*' (which 
has 3 results). This what my logs show happen in the searchBeach:

First search (with // comments):

searchBean.setSearchValue(*) // sets the search value to * correctly
(NAME LIKE %) start=0 // these are a dump of the params
searchBean.search() // this is the search action

Second search:

searchBean.setSearchValue(Test*) // sets search value to Test* correctly
searchBean.setSearchValue(null) // sets search value to null for some reason
searchBean.setSearchValue(*) // sets search value to * for some reason
(NAME LIKE %) start=0 // dump of params
searchBean.search() // calls the search action

It seems like after loading the bean correctly for a new search it decides to reset 
the bean and load the previous search from some cache somewhere (?). 

--
Rob

@objectsource.org


---------- Original Message -----------
From: "Rob Decker" <ro...@objectsource.org>
To: "MyFaces Discussion" <us...@myfaces.apache.org>
Sent: Mon, 25 Apr 2005 11:39:24 -0400
Subject: Re: myfaces has no respect for my forms boundaries

> Here's my jsp code. The code is included as a tiles definition in a subview 
> before and after the dataTable that displays the search results like this:
> 
> <f:subview id="topScroller">
>     <tiles:insert name="scroller" flush="false"/>
> </f:subview>
> 
> The searchParams in the <h:outputText> are an <x:buffer> with <h:inputHidden> 
> for the search params.
> 
> scroller tile:
> 
> <h:panelGrid columns="3" columnClasses="resultsSummary, resultsScroll, 
> resultsSummary" width="100%" styleClass="resultsCount" rendered="#{!empty 
> searchBean.searchResults && searchBean.searchResults.total gt 0 && 
> (searchBean.searchType eq 'QUICK' || searchBean.searchType eq 'ADVANCED')}">   
>  <h:outputText value="Results #{searchBean.searchResults.start} to # 
> {searchBean.searchResults.end} of #{searchBean.searchResults.total}"/>   
>  <x:div style="display:inline">        <h:form style="display:inline">       
>  <h:commandLink action="#{searchBean.search}" id="fplink" rendered="# 
> {searchBean.searchResults.start gt searchBean.searchResults.resultsPerPage}" 
> style="text-decoration:none" onmouseover="this.style.fontWeight='bold'" 
onmouseout="this.style.fontWeight='normal'">
>             <h:outputText value=" << "/>
>             <v:inputParam value="#{searchBean.start}" paramValue="#
> {results.firstPage}"/>
>             <h:outputText value="#{searchParams}" escape="false"/>
>         </h:commandLink>
>         </h:form>
>         <h:outputText id="fp" value=" << " rendered="#{!
> (searchBean.searchResults.start gt searchBean.searchResults.resultsPerPage)}"/>
> 
>         <h:form style="display:inline">    
>         <h:commandLink action="#{searchBean.search}" id="pplink" rendered="#
> {searchBean.searchResults.start gt 1}" style="text-decoration:none" 
> onmouseover="this.style.fontWeight='bold'" 
onmouseout="this.style.fontWeight='normal'">
>             <h:outputText value=" < "/>
>             <v:inputParam value="#{searchBean.start}" paramValue="#
> {searchBean.searchResults.previousPage}"/>
>             <h:outputText value="#{searchParams}" escape="false"/>
>         </h:commandLink>
>         </h:form>
>         <h:outputText id="pp" value=" < " 
> rendered="#{!(searchBean.searchResults.start gt 1)}"/>
> 
>         <x:dataList id="bps" rendered="#{searchBean.beginning}" value="#
> {searchBean.beginningPages}" var="pstart" rowIndexVar="rowIndex">
>             <h:form style="display:inline">
>             <h:commandLink action="#{searchBean.search}" rendered="#{pstart lt 
> searchBean.searchResults.start or pstart gt searchBean.searchResults.end}" 
> style="text- decoration:none" onmouseover="this.style.fontWeight='bold'" 
onmouseout="this.style.fontWeight='normal'">
>                 <h:outputText value=" #{rowIndex+1} "/>
>                 <v:inputParam value="#{searchBean.start}" paramValue="#{pstart}"/>
>                 <h:outputText value="#{searchParams}" escape="false"/>
>             </h:commandLink>
>             </h:form>
>             <h:outputText value=" #{rowIndex+1} " rendered="#{!(pstart lt 
> searchBean.searchResults.start) and !(pstart gt searchBean.searchResults.end)}"/>
>         </x:dataList>
>         <h:outputText id="bpse" value=" ... " rendered="#{searchBean.beginning}"/>
>         <x:dataList id="mps" value="#{searchBean.middlePages}" var="pstart" 
> rowIndexVar="rowIndex">
>             <h:form style="display:inline">
>             <h:commandLink action="#{searchBean.search}" rendered="#{pstart lt 
> searchBean.searchResults.start or pstart gt searchBean.searchResults.end}" 
> style="text- decoration:none" onmouseover="this.style.fontWeight='bold'" 
onmouseout="this.style.fontWeight='normal'">
>                 <h:outputText value=" #{searchBean.begin+rowIndex+1} "/>
>                 <v:inputParam value="#{searchBean.start}" paramValue="#{pstart}"/>
>                 <h:outputText value="#{searchParams}" escape="false"/>
>             </h:commandLink>
>             </h:form>
>             <h:outputText value=" #{searchBean.begin+rowIndex+1} " rendered="#{!
> (pstart lt searchBean.searchResults.start) and !(pstart gt 
> searchBean.searchResults.end)}"/>        </x:dataList>        <h:outputText 
> id="epse" value=" ... " rendered="#{searchBean.ending}"/>        <x:dataList 
> id="eps" rendered="#{searchBean.ending}" value="# {searchBean.endingPages}" 
> var="pstart" rowIndexVar="rowIndex" rowCountVar="rowCount">            <h:form 
> style="display:inline">            <h:commandLink 
> action="#{searchBean.search}" rendered="#{pstart lt 
> searchBean.searchResults.start or pstart gt searchBean.searchResults.end}" 
> style="text- decoration:none" onmouseover="this.style.fontWeight='bold'" 
onmouseout="this.style.fontWeight='normal'">
>                 <h:outputText value=" #{searchBean.searchResults.numPages-
> (rowCount- rowIndex)+1} "/>                <v:inputParam 
> value="#{searchBean.start}" paramValue="#{pstart}"/>               
>  <h:outputText value="#{searchParams}" escape="false"/>            </h:commandLink>
>             </h:form>
>             <h:outputText value=" #{searchBean.searchResults.numPages-
> (rowCount- rowIndex)+1} " rendered="#{!(pstart lt 
> searchBean.searchResults.start) and !(pstart gt searchBean.searchResults.end)}"/>
>         </x:dataList>
> 
>         <h:form style="display:inline">
>         <h:commandLink action="#{searchBean.search}" id="nplink" rendered="#
> {searchBean.searchResults.end lt searchBean.searchResults.total}" style="text-
> decoration:none" onmouseover="this.style.fontWeight='bold'" 
> onmouseout="this.style.fontWeight='normal'">
>             <h:outputText value=" > "/>
>             <v:inputParam value="#{searchBean.start}" paramValue="#
> {searchBean.searchResults.nextPage}"/>
>             <h:outputText value="#{searchParams}" escape="false"/>
>         </h:commandLink>
>         </h:form>
>         <h:outputText id="np" value=" > " 
> rendered="#{!(searchBean.searchResults.end lt searchBean.searchResults.total)}"/>
> 
>         <h:form style="display:inline">
>         <h:commandLink action="#{searchBean.search}" id="lplink" rendered="#
> {searchBean.searchResults.end lt searchBean.searchResults.total-
> searchBean.searchResults.resultsPerPage}" style="text-decoration:none" 
> onmouseover="this.style.fontWeight='bold'" 
onmouseout="this.style.fontWeight='normal'">
>             <h:outputText value=" >> "/>
>             <v:inputParam value="#{searchBean.start}" paramValue="#
> {searchBean.searchResults.lastPage}"/>
>             <h:outputText value="#{searchParams}" escape="false"/>
>         </h:commandLink>
>         </h:form>
>         <h:outputText id="lp" value=" >> " 
> rendered="#{!(searchBean.searchResults.end lt searchBean.searchResults.total-
> searchBean.searchResults.resultsPerPage)}"/>    </x:div>    <h:outputText value=""/>
> </h:panelGrid>
> 
> --
> Rob
> 
> @objectsource.org
> 
> ---------- Original Message -----------
> From: "Rob Decker" <ro...@objectsource.org>
> To: "MyFaces Discussion" <us...@myfaces.apache.org>
> Sent: Mon, 25 Apr 2005 10:04:57 -0400
> Subject: Re: myfaces has no respect for my forms boundaries
> 
> > Ok, give me an hour so to get to it. Thanks.
> >   ----- Original Message ----- 
> >   From: Bill Dudney 
> >   To: MyFaces Discussion 
> >   Cc: MyFaces Discussion 
> >   Sent: Monday, April 25, 2005 9:53 AM
> >   Subject: Re: myfaces has no respect for my forms boundaries
> > 
> >   Hi Rob,
> > 
> >   I too am using multiple forms on a single page without problems.
> > 
> >   Perhaps there is something wierd with your JSP code as Heath suggested? If 
> > you post some of it I'd be glad to take a look and see if anything obvious 
> > pops out.
> > 
> >   TTFN,
> > 
> >   -bd-
> > 
> >   On Monday, April 25, 2005, at 08:58AM, Heath Borders 
> > <he...@gmail.com> wrote:
> > 
> >   >
> >   ><<Original Attached>>
> > 
> > ------------------------------------------------------------------------------
> > 
> >   You must have some weird JSP code, because we're using multiple forms all 
> > over the place without any problems.  MyFaces should only process the JSF tree 
> > beneath a submitted form.  All others will not be processed.
> > 
> >   On 4/22/05, Rob Decker <ro...@objectsource.org> wrote: 
> >     I read in Kito Mann's book that you can have multiple forms per jsf page. 
> > So I have a    bunch of forms to implement my paginator. One for each page 
> > (plus a couple others). I     also have them twice (since it shows up top and 
> > bottom) by including a page fragment    with tiles.
> > 
> >     The thing is when a form is submitted (I click a commandLink in the form)
> >  it seems    like the inputs from all forms are collected up and set in the 
> > backing bean, not just     the form the commandLink/button is located in.
> > 
> >     I was going to use the dataScroller but it seems like it expects all the 
> > data to    loaded in order for it to work. I'm not using hibernate (although 
> > oracle has row limit     too). But I don't want to change my back end code.
> > 
> >     Is there a way to get myfaces to respect my form boundaries?
> > 
> >     --
> >     Rob
> > 
> >     @objectsource.org
> > 
> >   -- 
> >   -Heath Borders-Wing
> >   hborders@mail.win.org
> ------- End of Original Message -------
------- End of Original Message -------


Re: myfaces has no respect for my forms boundaries

Posted by Rob Decker <ro...@objectsource.org>.
Here's my jsp code. The code is included as a tiles definition in a subview before and 
after the dataTable that displays the search results like this:

<f:subview id="topScroller">
    <tiles:insert name="scroller" flush="false"/>
</f:subview>

The searchParams in the <h:outputText> are an <x:buffer> with <h:inputHidden> for the 
search params.

scroller tile:

<h:panelGrid columns="3" columnClasses="resultsSummary, resultsScroll, resultsSummary" 
width="100%" styleClass="resultsCount" rendered="#{!empty searchBean.searchResults && 
searchBean.searchResults.total gt 0 && (searchBean.searchType eq 'QUICK' || 
searchBean.searchType eq 'ADVANCED')}">
    <h:outputText value="Results #{searchBean.searchResults.start} to #
{searchBean.searchResults.end} of #{searchBean.searchResults.total}"/>
    <x:div style="display:inline">
        <h:form style="display:inline">
        <h:commandLink action="#{searchBean.search}" id="fplink" rendered="#
{searchBean.searchResults.start gt searchBean.searchResults.resultsPerPage}" 
style="text-decoration:none" onmouseover="this.style.fontWeight='bold'" 
onmouseout="this.style.fontWeight='normal'">
            <h:outputText value=" << "/>
            <v:inputParam value="#{searchBean.start}" paramValue="#
{results.firstPage}"/>
            <h:outputText value="#{searchParams}" escape="false"/>
        </h:commandLink>
        </h:form>
        <h:outputText id="fp" value=" << " rendered="#{!
(searchBean.searchResults.start gt searchBean.searchResults.resultsPerPage)}"/>
    
        <h:form style="display:inline">    
        <h:commandLink action="#{searchBean.search}" id="pplink" rendered="#
{searchBean.searchResults.start gt 1}" style="text-decoration:none" 
onmouseover="this.style.fontWeight='bold'" onmouseout="this.style.fontWeight='normal'">
            <h:outputText value=" < "/>
            <v:inputParam value="#{searchBean.start}" paramValue="#
{searchBean.searchResults.previousPage}"/>
            <h:outputText value="#{searchParams}" escape="false"/>
        </h:commandLink>
        </h:form>
        <h:outputText id="pp" value=" < " rendered="#{!(searchBean.searchResults.start 
gt 1)}"/>
        
        <x:dataList id="bps" rendered="#{searchBean.beginning}" value="#
{searchBean.beginningPages}" var="pstart" rowIndexVar="rowIndex">
            <h:form style="display:inline">
            <h:commandLink action="#{searchBean.search}" rendered="#{pstart lt 
searchBean.searchResults.start or pstart gt searchBean.searchResults.end}" style="text-
decoration:none" onmouseover="this.style.fontWeight='bold'" 
onmouseout="this.style.fontWeight='normal'">
                <h:outputText value=" #{rowIndex+1} "/>
                <v:inputParam value="#{searchBean.start}" paramValue="#{pstart}"/>
                <h:outputText value="#{searchParams}" escape="false"/>
            </h:commandLink>
            </h:form>
            <h:outputText value=" #{rowIndex+1} " rendered="#{!(pstart lt 
searchBean.searchResults.start) and !(pstart gt searchBean.searchResults.end)}"/>
        </x:dataList>
        <h:outputText id="bpse" value=" ... " rendered="#{searchBean.beginning}"/>
        <x:dataList id="mps" value="#{searchBean.middlePages}" var="pstart" 
rowIndexVar="rowIndex">
            <h:form style="display:inline">
            <h:commandLink action="#{searchBean.search}" rendered="#{pstart lt 
searchBean.searchResults.start or pstart gt searchBean.searchResults.end}" style="text-
decoration:none" onmouseover="this.style.fontWeight='bold'" 
onmouseout="this.style.fontWeight='normal'">
                <h:outputText value=" #{searchBean.begin+rowIndex+1} "/>
                <v:inputParam value="#{searchBean.start}" paramValue="#{pstart}"/>
                <h:outputText value="#{searchParams}" escape="false"/>
            </h:commandLink>
            </h:form>
            <h:outputText value=" #{searchBean.begin+rowIndex+1} " rendered="#{!
(pstart lt searchBean.searchResults.start) and !(pstart gt 
searchBean.searchResults.end)}"/>
        </x:dataList>
        <h:outputText id="epse" value=" ... " rendered="#{searchBean.ending}"/>
        <x:dataList id="eps" rendered="#{searchBean.ending}" value="#
{searchBean.endingPages}" var="pstart" rowIndexVar="rowIndex" rowCountVar="rowCount">
            <h:form style="display:inline">
            <h:commandLink action="#{searchBean.search}" rendered="#{pstart lt 
searchBean.searchResults.start or pstart gt searchBean.searchResults.end}" style="text-
decoration:none" onmouseover="this.style.fontWeight='bold'" 
onmouseout="this.style.fontWeight='normal'">
                <h:outputText value=" #{searchBean.searchResults.numPages-(rowCount-
rowIndex)+1} "/>
                <v:inputParam value="#{searchBean.start}" paramValue="#{pstart}"/>
                <h:outputText value="#{searchParams}" escape="false"/>
            </h:commandLink>
            </h:form>
            <h:outputText value=" #{searchBean.searchResults.numPages-(rowCount-
rowIndex)+1} " rendered="#{!(pstart lt searchBean.searchResults.start) and !(pstart gt 
searchBean.searchResults.end)}"/>
        </x:dataList>
        
        <h:form style="display:inline">
        <h:commandLink action="#{searchBean.search}" id="nplink" rendered="#
{searchBean.searchResults.end lt searchBean.searchResults.total}" style="text-
decoration:none" onmouseover="this.style.fontWeight='bold'" 
onmouseout="this.style.fontWeight='normal'">
            <h:outputText value=" > "/>
            <v:inputParam value="#{searchBean.start}" paramValue="#
{searchBean.searchResults.nextPage}"/>
            <h:outputText value="#{searchParams}" escape="false"/>
        </h:commandLink>
        </h:form>
        <h:outputText id="np" value=" > " rendered="#{!(searchBean.searchResults.end 
lt searchBean.searchResults.total)}"/>
        
        <h:form style="display:inline">
        <h:commandLink action="#{searchBean.search}" id="lplink" rendered="#
{searchBean.searchResults.end lt searchBean.searchResults.total-
searchBean.searchResults.resultsPerPage}" style="text-decoration:none" 
onmouseover="this.style.fontWeight='bold'" onmouseout="this.style.fontWeight='normal'">
            <h:outputText value=" >> "/>
            <v:inputParam value="#{searchBean.start}" paramValue="#
{searchBean.searchResults.lastPage}"/>
            <h:outputText value="#{searchParams}" escape="false"/>
        </h:commandLink>
        </h:form>
        <h:outputText id="lp" value=" >> " rendered="#{!(searchBean.searchResults.end 
lt searchBean.searchResults.total-searchBean.searchResults.resultsPerPage)}"/>
    </x:div>
    <h:outputText value=""/>
</h:panelGrid>

--
Rob

@objectsource.org


---------- Original Message -----------
From: "Rob Decker" <ro...@objectsource.org>
To: "MyFaces Discussion" <us...@myfaces.apache.org>
Sent: Mon, 25 Apr 2005 10:04:57 -0400
Subject: Re: myfaces has no respect for my forms boundaries

> Ok, give me an hour so to get to it. Thanks.
>   ----- Original Message ----- 
>   From: Bill Dudney 
>   To: MyFaces Discussion 
>   Cc: MyFaces Discussion 
>   Sent: Monday, April 25, 2005 9:53 AM
>   Subject: Re: myfaces has no respect for my forms boundaries
> 
>   Hi Rob,
> 
>   I too am using multiple forms on a single page without problems.
> 
>   Perhaps there is something wierd with your JSP code as Heath suggested? If 
> you post some of it I'd be glad to take a look and see if anything obvious 
> pops out.
> 
>   TTFN,
> 
>   -bd-
> 
>   On Monday, April 25, 2005, at 08:58AM, Heath Borders 
> <he...@gmail.com> wrote:
> 
>   >
>   ><<Original Attached>>
> 
> ------------------------------------------------------------------------------
> 
>   You must have some weird JSP code, because we're using multiple forms all 
> over the place without any problems.  MyFaces should only process the JSF tree 
> beneath a submitted form.  All others will not be processed.
> 
>   On 4/22/05, Rob Decker <ro...@objectsource.org> wrote: 
>     I read in Kito Mann's book that you can have multiple forms per jsf page. 
> So I have a    bunch of forms to implement my paginator. One for each page 
> (plus a couple others). I     also have them twice (since it shows up top and 
> bottom) by including a page fragment    with tiles.
> 
>     The thing is when a form is submitted (I click a commandLink in the form)
>  it seems    like the inputs from all forms are collected up and set in the 
> backing bean, not just     the form the commandLink/button is located in.
> 
>     I was going to use the dataScroller but it seems like it expects all the 
> data to    loaded in order for it to work. I'm not using hibernate (although 
> oracle has row limit     too). But I don't want to change my back end code.
> 
>     Is there a way to get myfaces to respect my form boundaries?
> 
>     --
>     Rob
> 
>     @objectsource.org
> 
>   -- 
>   -Heath Borders-Wing
>   hborders@mail.win.org
------- End of Original Message -------


Re: myfaces has no respect for my forms boundaries

Posted by Rob Decker <ro...@objectsource.org>.
Ok, give me an hour so to get to it. Thanks.
  ----- Original Message ----- 
  From: Bill Dudney 
  To: MyFaces Discussion 
  Cc: MyFaces Discussion 
  Sent: Monday, April 25, 2005 9:53 AM
  Subject: Re: myfaces has no respect for my forms boundaries


  Hi Rob,

  I too am using multiple forms on a single page without problems.

  Perhaps there is something wierd with your JSP code as Heath suggested? If you post some of it I'd be glad to take a look and see if anything obvious pops out.

  TTFN,

  -bd-

  On Monday, April 25, 2005, at 08:58AM, Heath Borders <he...@gmail.com> wrote:

  >
  ><<Original Attached>>



------------------------------------------------------------------------------


  You must have some weird JSP code, because we're using multiple forms all over the place without any problems.  MyFaces should only process the JSF tree beneath a submitted form.  All others will not be processed.


  On 4/22/05, Rob Decker <ro...@objectsource.org> wrote: 
    I read in Kito Mann's book that you can have multiple forms per jsf page. So I have a
    bunch of forms to implement my paginator. One for each page (plus a couple others). I 
    also have them twice (since it shows up top and bottom) by including a page fragment
    with tiles.

    The thing is when a form is submitted (I click a commandLink in the form) it seems
    like the inputs from all forms are collected up and set in the backing bean, not just 
    the form the commandLink/button is located in.

    I was going to use the dataScroller but it seems like it expects all the data to
    loaded in order for it to work. I'm not using hibernate (although oracle has row limit 
    too). But I don't want to change my back end code.

    Is there a way to get myfaces to respect my form boundaries?

    --
    Rob

    @objectsource.org





  -- 
  -Heath Borders-Wing
  hborders@mail.win.org

Re: myfaces has no respect for my forms boundaries

Posted by Bill Dudney <bd...@mac.com>.
 Hi Rob,

I too am using multiple forms on a single page without problems.

Perhaps there is something wierd with your JSP code as Heath suggested? If you post some of it I'd be glad to take a look and see if anything obvious pops out.

TTFN,

-bd-

On Monday, April 25, 2005, at 08:58AM, Heath Borders <he...@gmail.com> wrote:

>
><<Original Attached>>

Re: myfaces has no respect for my forms boundaries

Posted by Rob Decker <ro...@objectsource.org>.
You don't have to make fun of my jsp code. It's in a dataList where it happens. 
  ----- Original Message ----- 
  From: Heath Borders 
  To: MyFaces Discussion 
  Sent: Monday, April 25, 2005 8:58 AM
  Subject: Re: myfaces has no respect for my forms boundaries


  You must have some weird JSP code, because we're using multiple forms all over the place without any problems.  MyFaces should only process the JSF tree beneath a submitted form.  All others will not be processed.


  On 4/22/05, Rob Decker <ro...@objectsource.org> wrote: 
    I read in Kito Mann's book that you can have multiple forms per jsf page. So I have a
    bunch of forms to implement my paginator. One for each page (plus a couple others). I 
    also have them twice (since it shows up top and bottom) by including a page fragment
    with tiles.

    The thing is when a form is submitted (I click a commandLink in the form) it seems
    like the inputs from all forms are collected up and set in the backing bean, not just 
    the form the commandLink/button is located in.

    I was going to use the dataScroller but it seems like it expects all the data to
    loaded in order for it to work. I'm not using hibernate (although oracle has row limit 
    too). But I don't want to change my back end code.

    Is there a way to get myfaces to respect my form boundaries?

    --
    Rob

    @objectsource.org





  -- 
  -Heath Borders-Wing
  hborders@mail.win.org

Re: myfaces has no respect for my forms boundaries

Posted by Heath Borders <he...@gmail.com>.
You must have some weird JSP code, because we're using multiple forms all 
over the place without any problems. MyFaces should only process the JSF 
tree beneath a submitted form. All others will not be processed.

On 4/22/05, Rob Decker <ro...@objectsource.org> wrote: 
> 
> I read in Kito Mann's book that you can have multiple forms per jsf page. 
> So I have a
> bunch of forms to implement my paginator. One for each page (plus a couple 
> others). I
> also have them twice (since it shows up top and bottom) by including a 
> page fragment
> with tiles.
> 
> The thing is when a form is submitted (I click a commandLink in the form) 
> it seems
> like the inputs from all forms are collected up and set in the backing 
> bean, not just
> the form the commandLink/button is located in.
> 
> I was going to use the dataScroller but it seems like it expects all the 
> data to
> loaded in order for it to work. I'm not using hibernate (although oracle 
> has row limit
> too). But I don't want to change my back end code.
> 
> Is there a way to get myfaces to respect my form boundaries?
> 
> --
> Rob
> 
> @objectsource.org <http://objectsource.org>
> 
> 


-- 
-Heath Borders-Wing
hborders@mail.win.org