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
356 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 500 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

756 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