• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Devaka Cooray
  • Ron McLeod
  • paul wheaton
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Frits Walraven
  • Scott Selikoff

Open commandLink in new tab/window

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I'm using JSF2 and I have pageA and pageB, where pageA have a table where each row is a record, let's call it entityX.

When a record is selected via commandLink, the details can be viewed in pageB.

So the details are displayed in pageB via MBeanB...

Normally, this approach works well. However, if I choose to open the link in a new tab/window, it will open pageB directly without going through the select method in MBeanA. My question is, how can I change the commandLink to always go through the same workflow, regardless if the target is the same window or a new tab/window.

BTW, I can't use commandButton for some reasons... and my users require multi-tab functionalities.

Thanks!

Ad
 
Saloon Keeper
Posts: 26267
186
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There are 2 reasons to avoid opening secondary windows in JSF webapps:

1. JSF doesn't support separate workflows and confusion may result since the same beans that the original page employed are also going to be used in the secondary page, except in the case of Request Scope beans, where each request gets its own bean anyway. View Scope is just a modified Session Scope and I'm suspecting that Flash Scope is going to likewise have conflicts.

2. It really annoys me as a user to have pages (or in my case, tabs) popping up all over the place.

You showed us what your backing bean code looks like, but to open a page in a new window, you have to code the commandLink tag properly (commandButton does not support "open in new window", BTW). So if you could include the commandLink definition that would be most helpful.
 
Ad Tan
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For my case, it is not really whether multi-tabs should be available, but my concerns are with unknown behavior, there might be potential security issues, ie, users may be able to make use of multi-tab to access entities that are normally unavailable.

Anyway, to resolve this issue, what I have done is to provide the following:
1. Use a commandButton instead, which prevents opening new tabs (hopefully, haven't test which browser plugins still allows that)
2. Use a commandLink but change target to "_blank", thus forcing a new tab/window.

Ad
 
Without subsidies, chem-ag food costs four times more than organic. Or this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic