954,600 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Accessing data over multiple JSF pages

Hi
I want to pass the data from one JSF page to another without using query string.
Any idea how this can be done??

babbu
Posting Whiz in Training
208 posts since Jun 2009
Reputation Points: -1
Solved Threads: 23
 

Session

peter_budo
Code tags enforcer
Moderator
15,436 posts since Dec 2004
Reputation Points: 2,806
Solved Threads: 902
 

I have tried all that..all resulting into null pointer exceptions, probably I have gone wrong somewhere. Please advise.

babbu
Posting Whiz in Training
208 posts since Jun 2009
Reputation Points: -1
Solved Threads: 23
 

Well then post your session coding attempt and I'm sure someone will look at it. Without code we are just hypothetically talking about issue... not really productive

peter_budo
Code tags enforcer
Moderator
15,436 posts since Dec 2004
Reputation Points: 2,806
Solved Threads: 902
 

I have tried the following.
I managed to get the value from the parent window to the popup. But I am unable to fetch that value in processAction method of the FacesPortlet.
request.getAttribute("attributeName"); returns null.

public class ModelManagedBean {

	public static final String
		SHARED_STRING_KEY = “sharedStringKey”;

	public String getSharedString() {
		return PortletSessionUtil.getSharedSessionAttribute(
			SHARED_STRING_KEY);
	}

	public void setSharedString(String value) {
		PortletSessionUtil.setSharedSessionAttribute(
			SHARED_STRING_KEY, value);
	}
}

public class PortletSessionUtil {

	public static Object getSharedSessionAttribute(
		String key) {

		FacesContext facesContext =
			FacesContext.getCurrentInstance();

		ExternalContext externalContext =
			facesContext.getExternalContext();

		PortletSession portletSession =
			(PortletSession) externalContext().getSession(false);

		return portletSession.getAttribute(
			key, PortletSession.APPLICATION_SCOPE);
	}

	public static void setSharedSessionAttribute(
		String key, Object value) {

		FacesContext facesContext =
			FacesContext.getCurrentInstance();

		ExternalContext externalContext =
			facesContext.getExternalContext();

		PortletSession portletSession =
			(PortletSession)externalContext().getSession(false);

		portletSession.setAttribute(
			key, value, PortletSession.APPLICATION_SCOPE);
	}
}


getAttribute method here returns null as well

babbu
Posting Whiz in Training
208 posts since Jun 2009
Reputation Points: -1
Solved Threads: 23
 

For anyone who might be interested. This is what I have done.
The second page is a popup so in page2 i use the following code.

window.opener.document.getelementbyID["element name"];
babbu
Posting Whiz in Training
208 posts since Jun 2009
Reputation Points: -1
Solved Threads: 23
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You