Re: question about PrettyNavigationHandler, how can I configure and use it properly.

Splash Forums PrettyFaces Users question about PrettyNavigationHandler, how can I configure and use it properly. Re: question about PrettyNavigationHandler, how can I configure and use it properly.

#22773

nicmon
Participant

really appreciate for prompt responses. I’ve changed my application to work like sample CRUD. Also thrown out the navigation-rules from faces-config.xml.

everything almost works, the only thing is that I want to have my action triggers on RowSelect Event on DataTable and not a link in an extra column (the Link has worked properly as well).

so if I have these lines on my results page:

<p:dataTable value="#{searchForm.userRequests}" var="userRequest" rowKey="#{userRequest.id}" liveScroll="true" rows="25" 		        					 selectionMode="single" selection="#{userRequestResultBean.selectedUserRequest}">

<p:ajax event="rowSelect" listener="#{userRequestResultBean.onRowSelect}" />

<p:column>
<pretty:link mappingId="userRequestDetail">
<f:param value="#{userRequest.id}" />
Edit
</pretty:link>
</p:column>

and these in RowSelect Event Handler:

public void onRowSelect(SelectEvent event) throws IOException {
this.selectedUserRequest = (UserRequest) event.getObject();

final FacesContext context = FacesContext.getCurrentInstance();
final ExternalContext externalContext = context.getExternalContext();
externalContext.redirect("/pages/userRequestDetailPage.xhtml");
}

it doesn’t work, as it expects a parameter which we pass by using f:param, but how can I specify the parameter here?

the target bean looks like this:

@Controller
@Scope(WebApplicationContext.SCOPE_REQUEST)
@Data
@URLMapping(id = "userRequestDetail", pattern = "/userRequestDetail/#{userRequestDetailBean.id}", viewId = "/pages/userRequestDetailPage.xhtml")
public class UserRequestDetailBean {
private Integer id;

private UserRequest userRequest;

@Resource
private UserRequestInventoryService userRequestInventoryService;

@URLAction
public void init() {
userRequest = userRequestInventoryService.readUserRequest(id);
}

}

Thanks again.