-
1. Re: Opening links in new tabs/windows problem
harut Mar 4, 2010 7:47 AM (in response to frisch)Hi,
If you have no ajax related functionality after clicking on a4j:cammandLink, and you use commandLinks just for opening new page based on some action functionality, then you can just use rest:link (RestFaces) instead of commandLink.
For Example, add this in your xhtml:
................
xmlns:rest="http://restfaces.dev.java.net"
.................
....
.................
<rest:link value="viewCurrentTask">
<h:outputText value="#{taskBean.fullName}" />
<f:param name="taskId" value="#{taskBean.id}"/>
</rest:link>And add corresponding Rest Action method:
/**
* Action method called when user selects any task to view it.
*
* @return String for navigation purposes.
*/
@HttpAction(value="viewCurrentTask", pattern="pages/taskView.jsf:taskId={taskId}")
public String taskSelectedForView(@Param("taskId") Long taskId) {
// some functional
return "/pages/taskView.xhtml";
}For more info https://restfaces.dev.java.net/docs-1.3/documentation.html
Hope this will help.
-
2. Re: Opening links in new tabs/windows problem
frisch Mar 5, 2010 3:07 AM (in response to harut)Hi,
thanks for your tip. All links have actions or actionListeners and then I use faces.config to redirect the user to the proper page. I have a pretty big application and I have links on every page. Do you know of a easier way to achieve this withour replacing all links in my code with <rest:link> ?
thanks
-
3. Re: Opening links in new tabs/windows problem
harut Mar 5, 2010 3:44 AM (in response to frisch)Hi,
Unfortunately I have no other solution for it. I had a same problem several months ago, and after all I found that Restfaces provides the best solution for it (besides that Restfaces provides very easy solutions for writing data initialization functionality when the page loads first time by writing "View Listener", most JSF developers do that in the Constructor of the Bean class which is not a good solution for that in my opinion...).
Regards.