this is much better than what i just stumbled upon I think then,
correct? Here is what I just did (and it actually worked to my
surprise)....
FacesContext ctx = FacesContext.getCurrentInstance();
ExternalContext extCtx = ctx.getExternalContext();
Map<Object, Object> sessionMap = extCtx.getApplicationMap();
ProjectBean projBean = new ProjectBean();
projBean.setNodeId(nodeId);
projBean.setName("desc="+node.getDescription());
projBean.setDescription("TempDescriptionDean");
sessionMap.put("projectBean", projBean);
I like your way better though! Thank you very much!!!
thanks,
dean
Ricardo Tercero Lozano wrote:
You can get a reference to a managed bean defined in faces-config.xml
this way:
ValueBinding bind =
FacesContext.getCurrentInstance().getApplication()
.createValueBinding("#{myBean}");
MyBean myBean = (MyBean)bind.getValue(this.facesContext);
It can be done too using the variableResolver. El expression can
reference a managed bean or a property (eg. #{myBean.myProperty}. You
can get an set a value.
If myBean doesn't exists, Faces creates a new instance and returns it.
On 3/31/06, *Dean Hiller* < [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>> wrote:
I am not sure I understand. In treeBean, how do I get a
folderBean(that
will be created if it doesn't exist). I was looking at
FacestContext
ExternalContext
I could not find any methods that I can use to look up
"folderBean"(and
create a FolderBean if one doesn't exist), but I suppose I am just
missing this. Could you point me to the method?
LASTLY, can this bean be request scoped in this case then? it sounds
like it to me, but I am a newb in this stuff.
thanks,
dean
Ricardo Tercero Lozano wrote:
> In order to send information from one bean to another you can
use the
> variable resover or the value binding. When the action to navigate
> from tree.jsp to editFolder.jsp, you can locate the folderBean
(if it
> doesn't exist it'll be created) and set the data you want to send.
>
>
>
> On 3/30/06, *Dean Hiller* <[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>
> <mailto: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>> wrote:
>
> I am have this
>
> treeBean -> tree.jsp
> folderBean -> editFolder.jsp
>
> When someone click on the tree.jsp, I need to fill in the
folderBean
> with the folderName, folderId, and folderDescription
> properties. What
> is the best design for this? I am quite the newb to all
this. I am
> thinking session state right now is easiest, and I retrieve the
> folderBean in treeBean.editFolder() action method and fill
it in, so
> when editFolder.jsp renders, it renders with the correct
data. Please
> suggest alternatives and what you think is the best.
>
> Lastly, what about dealing with someone who opens up two
windows(which
> would be in the same session). Couldn't he possibly step on
himself
> since I am storing this stuff in the session above?
>
> thanks,
> dean
>
>