File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes Problem in creating a search result page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Problem in creating a search result page" Watch "Problem in creating a search result page" New topic

Problem in creating a search result page

Victor Williams Stafusa da Silva
Ranch Hand

Joined: May 24, 2007
Posts: 34
Hi. I am new to JSF and I am having trouble in creating a search result page in JSF.

This is in my file "/telas/buscar_exame.jsp":

This a snippet of my faces-config.xml:

My managed bean has an attribute called "visualizadorExames" which is a Collection<Visualizador>. There is a getter for this too.
The class Visualizador is an inner class of my managed bean (i.e. a smelly ugly hack) and has an attribute "exame" that is just an entity class already populated (the thing shown in the result).
The class Visualizador has a method prosseguir() which put the corresponding "exame" attribute in another managed bean (used in the next screen) and return the String "prosseguir" (don't looks good too).

Well... The result is a disaster. There are 2 problems here. The first is that my panel is not rendered correctly (the search results looks messy). But my big show-stopper problem is that clicking in a result does not navigate to the next page, instead it reloads the search result page.

About the nesting of the <a4j:form>, this is because the content outside the <a4j:repeat> tag needs to use the external form (ie, it is the search form and the search results needs to be in the middle of it), while the <a4j:form> nested in the <a4j:repeat> tag is intended to be the form that submits to show the next screen.

I am a novice to JSF. I just started to study it seriously three weeks ago.

Can somebody help me?

Edit: debugging it, looks like that the prosseguir() method is never called. So i wonder what is being called when I click the link.
About the rendering problem, I already tried to change the order of the tags, but no success.

Edit 2: I fixed the rendering problem and cleaned up the ugly stuff thanks to this.
But it still not working, it still comes back to the same page. I did what was in the article, but used <a4j:repeat> instead of <h:dataTable> because dataTable did not played well with <a4j:form> (yes, I tried with dataTable).

SCJP 6.0 - 88%, SCWCD 5 - 79%, SCJA - 96%, SCSNI - 68%, SCBCD 5 - 95%
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17410

From what I can tell from the RichFaces documentation, a4j:form isn't something that you really need anymore. An h:form should do it.

However, I'm curious about how the datatable tag "doesn't play well with a4j:form". I've never seen any problems.

An IDE is no substitute for an Intelligent Developer.
I agree. Here's the link:
subject: Problem in creating a search result page
It's not a secret anymore!