I have JBoss portal server and I have two applications (different EAR files) deployed in it.
I provide a link in my first application which takes the user to a page in the second application. Both implement JSF framework.
Now, how can I pass parameter from the first application to second application? Can i pass request parameters? I would like to avoid query strings too.
I tried to get the backing bean of the first application, in the second application but I guess it wont work.
Every FacesContext is unique for each application.
By design, enterprise applications (EARs) are independent of each other. The FacesContext is different, and so are the user sessions. However, if you're clicking a link in one application that sends you to the other application, you have a number of options. You can pass the information as part of the URL; you can put it into form data and post it; you can even store it in a cookie.
Beyond that, there are ways of making two independent processes communicate information. You could store the information in a shared resource, like a database, or on the file system, or you have some kind of inter-process communication: RMI, Corba, socket connections, JMS. The only thing you can't do is get one application to look into the data of the other. You should think of them as two separate applications running on different servers.
Joined: Oct 14, 2009
I have been trying various ways. Even sending via the URL get / post method as you have mentioned.
But it does not seem to work. Please have a look at the following code snippet.
To set the attribute in portlet session final FacesContext fcRequest = FacesContext.getCurrentInstance();
final PortletSession objPortletSess = (PortletSession) fcRequest.getExternalContext().getSession(false);
objPortletSess.setAttribute("fileId", getStrSelFileId(), PortletSession.APPLICATION_SCOPE);
To get the attribute from portlet session PortletSession objPortletSess = (PortletSession) fcRequest.getExternalContext().getSession(false);
String strSelFileId = (String) objPortletSess.getAttribute("fileId", PortletSession.APPLICATION_SCOPE);
Sorry, I didn't even notice you said you are running JBoss Portal. There are some mechanisms for portlet to portlet communication, beyond what I mentioned. It looks like that's what you're getting at. Unfortunately, I have very limited experience with portals, and none whatsoever with JBoss Portal, so I can't help you there.
Joined: Oct 14, 2009
Finally I got a way that works.
I tried passing request parameters from the 1st application to the 2nd application using a servlet in the 2nd app.
And from there I will set the parameter back to a session & use a redirect to my portal page, which will use up the parameter.
I shall post the code soon.
subject: Parameter passing from one app (EAR) to another EAR