Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to use a bean to get the value for a h:inputText and another bean to set it?

Posted on 2008-10-02
1
Medium Priority
?
363 Views
Last Modified: 2013-11-24
I want to be able to get the value for a h:inputText from a bean x and set it into bean y, without changing the value of the x bean. How can I achieve this?
0
Comment
Question by:daraii
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 1

Accepted Solution

by:
peter-blackwood earned 2000 total points
ID: 22722130
You have probably solved this by now, but just in case, you can define bean x to contain a property of type Y.

In faces-config do the code below, then in class X add setter and getter for ybean.  You can then access any public methods in ybean.


<managed-bean>
	<managed-bean-name>ybean</managed-bean-name>
	<managed-bean-class>
		com.example.Y
	</managed-bean-class>
	<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
 
<managed-bean>
	<managed-bean-name>xbean</managed-bean-name>
	<managed-bean-class>
		com.example.X
	</managed-bean-class>
	<managed-bean-scope>request</managed-bean-scope>
	<managed-property>
		<property-name>ybean</property-name>
		<value>#{ybean}</value>
	</managed-property>
</managed-bean>

Open in new window

0

Featured Post

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
While opting for any web-to-print solution, you need to discuss with your team and some of your end users and know their opinions about your decisions. In this article we list down some questions you need to ask yourself.
The viewer will learn how to implement Singleton Design Pattern in Java.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question