wood burning stoves 2.0*
The moose likes JSF and the fly likes param needs unique ID even if in different forms? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "param needs unique ID even if in different forms?" Watch "param needs unique ID even if in different forms?" New topic
Author

param needs unique ID even if in different forms?

Oliver Chua
Greenhorn

Joined: Feb 27, 2004
Posts: 29
I am trying to incorporate Jsptags' Pager taglib in my JSF application
but I am stuck with this problem...

I'm using JSF1.1 RI...

The taglib has a pages tag, that sets up the clickable links to jump to certain pages.
When I click on the link, the associated action is not called.

The <previous> link works, but the <pages> links doesn't.
The only difference I can see is that the <pages> is called multiple times.

Initially, I had one form, but I kept getting the duplicate id error.
Since I cannot append to the id attribute to make it unique,
I decided to make each link a form...

I don't know if this is an issue but the <pages> param id is the same,
although they belong to different forms.
Can anyone verify if this is a bug or not?

Even if I leave out the id in the hope that the
compiler generate an id for each link, the same problem happens.

I attempted to append a number to the id attribute to make it unique,
like this id="pagesp#{pageNumber}", but it is not accepted by the compiler.

Anybody has an idea how to get this to work?

<CODE>
<pg :p rev>
<h:form>
<%request.setAttribute("pagerOffset", GeneralAction.extractOffset(pageUrl));%>

<h:commandLink id="prev" value="<<Previous"
action="#{groupingAction.search}">
<f :p aram id="prevp" name="pager.offset" value="#{pagerOffset}" />
</h:commandLink>
</h:form>
</pg :p rev>



<pg :p ages>
<h:form>
<c:set scope="request" var="pageNumber" value="${pageNumber}" />
<%request.setAttribute("pagerOffset", GeneralAction.extractOffset(pageUrl));%>

<h utputText value="#{pageNumber}"
rendered="#{pageNumber==currentPageNumber}" />

<h:commandLink id="pages" value="#{pageNumber}"
action="#{groupingAction.search}"
rendered="#{pageNumber!=currentPageNumber}">
<f :p aram id="pagesp" name="pager.offset" value="#{pagerOffset}" />
</h:commandLink>
</h:form>
</pg :p ages>

</CODE>
[ May 25, 2005: Message edited by: Oliver Chua ]
Jeremy Wilson
Ranch Hand

Joined: Feb 18, 2003
Posts: 166
I believe you can only have one form per page using jsf. I think they are trying to overcome this limitation in the second release of jsf. This may be where you problem is coming from.


Jeremy Wilson
Oliver Chua
Greenhorn

Joined: Feb 27, 2004
Posts: 29
>I believe you can only have one form per page using jsf.
I'm posting a simplified version that recreates the problem...

This code tries to make 2 commandLinks, effectively creating 2 forms on the page. then it tries to insert the same 2 commandLinks inside a dataTable.

The behavior is as expected for the independent commandLinks. This would debunk the assertion that JSF1.1 does not support multiple forms in one page.

For the commandLinks inside the dataTable, the behavior is not the expected one. It does not forward to the next jsp.

Can anyone figure out why?

Page with form



Result Page


Faces-config

[ May 31, 2005: Message edited by: Oliver Chua ]
 
Don't get me started about those stupid light bulbs.
 
subject: param needs unique ID even if in different forms?
 
Similar Threads
Pagination in JSP
jsp tag pagination and tiles
Paging in JSP
Pagination?
Pager Tags Newbie