struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From phyopiyo <phyop...@yahoo.com.sg>
Subject [Shale - Clay] nested properties in @managed-bean-name can't work
Date Sat, 03 Jun 2006 13:28:59 GMT

Hi 

I could not get/set property values of nested properties in my managed bean.
I am using normal HTML to reference to JSF components defined in my
clay-config.xml.   Here is the code fragment.

<!-- ======== in HTML page =========== -->
<span jsfid="clay" allowBody="false" managedBeanName="testBean" />
...//supporing HTMLs code here
<tr>
   <td>
      <label jsfid="testObjLabel">Mock password</label>
   </td>
   <td>
      <input jsfid="testObj" type="text" class="data_form">
   </td>
   <td>
      <span jsfid="testObjMessage" class="error_form">Mock Error
Message</span>
   </td>
</tr>
...//supporing HTMLs code here

<!-- ============ in clay-config.xml ============ -->
<component jsfid="testObjLabel" extends="outputLabel" allowBody="false">
        <attributes>
	        <set name="value" value="#{messages['common.label.test']}" />
		<set name="for" value="testObj" />
	</attributes>
</component>
<component jsfid="testObj" extends="inputText" id="testObj">
   <attributes>
   <set name="value" value="#{@managed-bean-name.nestedProperty.testObj}" />
   <set name="required" value="true" />
   </attributes>
</component>
<component jsfid="testObjMessage" extends="message" allowBody="false">
	<attributes>
		<set name="for" value="testObj" />
	</attributes>
</component>

<!-- ============ in respective backing bean ========= -->
public class TestBean extends AbstractViewController{

   private NestedClass nestedProperty;
     
   public NestedClass getNestedProperty(){
      return nestedProperty;
   }

   public void setNestedProperty(NestedClass nested){
      nestedProperty = nested;
   }

   // ... all other related methods like 'save', 'canel' etc.
}

<!-- ====== nested property class ========-->
public class NestedClass{

   private String testObj;
   
   public String getTestObj(){
      return testObj;
   }

   public void setTestObj(String test){
      testObj = test;
   }
}
<!-- ========== in faces-config.xml ==========-->
<managed-bean>
	<managed-bean-name>testBean</managed-bean-name>
	<managed-bean-class>
		com.test.TestBean
	</managed-bean-class>
	<managed-bean-scope>request</managed-bean-scope>
</managed-bean>

<!-- ========== End ============== -->
I knew that we must use managed-beans in xxx$yyy  format, if the URL is like
http://localhost:8080/myapplication/xxx/yyy.html.  But my case here is using
http://localhost:8080/myapplication/testBean.html.  Therefore, I gave my
managed-bean name 'testBean' without any $ character.

When i submit the form, I am getting '  "testObj": Error during model data
update.  ' error message.  When I try out other immediate properties (e.g.
@managed-bean-name.propertyOne ), i can set/gett it perfectly.  The error
only happen when i used nested properties (e.g.
@managed-bean-name.propertyOne.littleNestedProperty).

Is there any thing that I need to do to solve this problem? I have already
read through and study the 'rolodex' example came along with Shale.  But it
is too confusing and could not understand it because there are so many
components defined inside and i lost track.  I also found that Rolodex
sample can successfully use nested bean properties from managed-bean.  but i
just can't do it and can't find the reason why... 

thank you for spending your precious time to read my mail....


Regards to all,
Phyo


--
View this message in context: http://www.nabble.com/-Shale---Clay--nested-properties-in-%40managed-bean-name-can%27t-work-t1727504.html#a4693586
Sent from the Struts - User forum at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message