1

I'm currently using JSF 2.2 with Deltaspike. We use the Multi-Window-Handling from Deltaspike to handle separate windows. It works great but in a specific case, we need the window ID.

I am able to read it with: FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("dswid");

Is there a more elegant way, maybe with injection into my bean?

Regards,

Sebastian

Sebastian S.
  • 493
  • 1
  • 5
  • 17
  • Possible duplicate of [Depedency inject request parameter with CDI and JSF2](https://stackoverflow.com/questions/13239975/depedency-inject-request-parameter-with-cdi-and-jsf2) – Kukeltje Feb 15 '19 at 14:39

2 Answers2

2

You can use Param from OmniFaces. I find it more elegant, but it is a third libary.

@Inject @Param
private String dswid;
jklee
  • 2,198
  • 2
  • 15
  • 25
0

If you don't want to add a library, you can also inject the external context.

@Inject private ExternalContext externalContext;

Lisa
  • 1
  • 1
    Without dependency on a different framework AND with real injection of the param, not just the context, see https://stackoverflow.com/questions/13239975/depedency-inject-request-parameter-with-cdi-and-jsf2 and Deltaspike and OmniFaces should be part of a jsf project at all times ;-) – Kukeltje Feb 15 '19 at 14:37