Hi Cagatay,
 
I have gone through the link which helps on forming composite objects.
But i have a slightly different requirement.
I was going through the wiki link for alias bean usage
http://wiki.apache.org/myfaces/AliasBean.
Which has an illustration of this example.
How come it has the same holder value and different bean names.Do you
know the reason.
 
... main form using the alias bean
<x:aliasBean alias="#{holder}" value="#{databean1}">
 <f:subView>
   <jsp:include page="subpage.jsp"/>
 </f:subView>
</x:aliasBean>
 
<x:aliasBean alias="#{holder}" value="#{databean2}">
 <f:subView>
   <jsp:include page="subpage.jsp"/>
 </f:subView>
</x:aliasBean>
 
<x:aliasBean alias="#{holder}" value="#{databean3}">
 <f:subView>
   <jsp:include page="subpage.jsp"/>
 </f:subView>
</x:aliasBean>
 
------------------------------------------------------------------------
------------------------------------------------------------------------
------------------------------------
 
I have taken your example of class Geo { private String longitude;
private String latitude;}
I have my databean class Stadium { private String name; private String
club; private Geo geoLoc1; private Geo geoLoc2;}
I have my managed bean StadiumController { private Stadium std;}
 
Can i want to do something like this.
 
<t:aliasBeansScope>
  <t:aliasBean alias="#{my_Geo}"
value="#{my_Stadium.geoLoc1}"></t:aliasBean>
  <f:subview id="abc">
    <jsp:include page="geoLoc.jsp"></jsp:include> 
  </f:subview>
         
  <t:aliasBean alias="#{my_AnGeo}"
value="#{my_Stadium.geoLoc2}"></t:aliasBean>
  <f:subview id="xyz">
     <jsp:include page="geoLoc.jsp"></jsp:include> 
  </f:subview>
</t:aliasBeansScope>
 
But how do i ensure reusabilty in my geoLoc.jsp.????
 
 <h:panelGrid columns="2">
        <h:outputText value="Please enter longitude" />
        <h:inputText id="txt_lattitude" value="#{my_Geo.longitude}" />
 
        <h:outputText value="Please enter latitude" />
        <h:inputText id="txt_longitude" value="#{my_Geo.latitude}" />
 </h:panelGrid>
 
This is my faces-config.xml.
 
<managed-bean>
     <managed-bean-name>my_Geo</managed-bean-name>
     <managed-bean-class>com.exper.acs.Geo</managed-bean-class>
     <managed-bean-scope>request</managed-bean-scope>
 </managed-bean>
 
 <managed-bean>
     <managed-bean-name>my_AnGeo</managed-bean-name>
     <managed-bean-class>com.exper.acs.Geo</managed-bean-class>
     <managed-bean-scope>request</managed-bean-scope>
 </managed-bean>
 
 <managed-bean>
     <managed-bean-name>my_Stadium</managed-bean-name>
     <managed-bean-class>com.exper.acs.Stadium</managed-bean-class>
     <managed-bean-scope>request</managed-bean-scope>
     
     <managed-property>
           <property-name>geoLoc1</property-name>
           <value>#{my_Geo}</value>
      </managed-property>
      <managed-property>
           <property-name>geoLoc2</property-name>
           <value>#{my_AnGeo}</value>
      </managed-property>
     <managed-bean>
 
 
Best Regards,
Pallavi 
________________________________

From: Cagatay Civici [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, February 21, 2007 7:20 PM
To: MyFaces Discussion
Subject: Re: How to make Reusable JSP


Hi,

Here's more info;

http://wiki.apache.org/myfaces/Creating_Composite_Components

By use of alias bean you can define any number of composition components
like jspf's in your page. 

Cagatay


On 2/21/07, [EMAIL PROTECTED] <[EMAIL PROTECTED] > wrote: 

        Hi Cagatay,
         
        What a marvellous solution.
        But can it help me to inlcude the jsp fragment twice in a jsp
without overwriting the previous value.
        Please let me know the importance of <t:aliasBeansScope> in the
below example.
        
         
        <t:aliasBeansScope>
              <t:aliasBean alias="#{geoLocationAlias}"
value="#{StadiumEditBean.stadium.geoLocation}" />
                    <f:subview id="geoLocationView">
                        <%@ include file="geoLocation.jspf"%>
                    </f:subview>
        </t:aliasBeansScope>
         
        Best Regards,
        Pallavi 


________________________________

        From: Cagatay Civici [mailto:[EMAIL PROTECTED] 
        Sent: Wednesday, February 21, 2007 2:09 PM
        To: MyFaces Discussion
        Subject: Re: How to make Reusable JSP
        
        
        
        Hi,
        
        Here's an example;
        
http://www.jroller.com/page/cagataycivici?entry=jsf_composition_componen
ts_with_aliasbean 
        
        Regards,
        
        Cagatay
        
        
        On 2/21/07, [EMAIL PROTECTED] < [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> > wrote: 

                Hi All,
                 
                A) I have a common address JSP which i want to use it in
several other Jsps.
                Having the content below and i want to set this address
value in a common AddressVO object(POJO).
                 
                <h:outputText value="Enter the address" />
                <h:inputText id="add1" value="#{pc_AddressVO.addLine}"
/>
                 
                B) I want to use this data in another jsp in the
following manner.
                <f:view>
                 <h:form id="myform" >
                 Enter Name : <h:inputText id="name1"
value="#{pc_ClaimsDataBean.myVO.name}"/>
                 Enter Profession : <h:inputText id="prof1"
value="#{pc_ClaimsDataBean.myVO.profession}" />
                 <f:subview id="xyz">
                 <jsp:include page="Address.jsp" />
                 </f:subview>
                 Enter TCN : <h:inputText id="tcn1"
value="#{pc_ClaimsDataBean.tcn}"  />
                 Enter Status : <h:inputText id="status1"
value="#{pc_ClaimsDataBean.status}" /> 
                 <f:subview id="abc">
                 <jsp:include page="Address.jsp" />
                 </f:subview>
                 <h:commandButton id="button1" value="Submit"
action="#{pc_ClaimsManageBean.save}" />
                 </h:form>
                </f:view>
                 
                C) In my ClaimsManageBean I want to set the data in my
ClaimsDataBean in the follwoing manner
                 
                ValueBinding bind1 =
fc.getApplication().createValueBinding("#{pc_ClaimsDataBean}");
                ClaimsDataBean iniVO =
(ClaimsDataBean)bind1.getValue(fc); 
                ValueBinding bind2 =
fc.getApplication().createValueBinding("#{pc_AddressVO}");
                AddressVO initVO = (AddressVO)bind2.getValue(fc); 
                iniVO.setAddVO(initVO);
                 
                But this will give a problem , the last value set in the
AddressVO will be set in the DataBean i lose the previous value.
                Is there a way i can make a reusable jsp which can be
used in other JSPs several times.
                What are the other possible design strategies.
                 
                Best Regards,
                Pallavi 

                

                 
                 
                 
                 
                 

The information contained in this electronic message and any attachments
to this message are intended for the exclusive use of the addressee(s)
and may contain proprietary, confidential or privileged information. If
you are not the intended recipient, you should not disseminate,
distribute or copy this e-mail. Please notify the sender immediately and
destroy all copies of this message and any attachments. 

WARNING: Computer viruses can be transmitted via email. The recipient
should check this email and any attachments for the presence of viruses.
The company accepts no liability for any damage caused by any virus
transmitted by this email. 

www.wipro.com
        


        

The information contained in this electronic message and any attachments
to this message are intended for the exclusive use of the addressee(s)
and may contain proprietary, confidential or privileged information. If
you are not the intended recipient, you should not disseminate,
distribute or copy this e-mail. Please notify the sender immediately and
destroy all copies of this message and any attachments. 

WARNING: Computer viruses can be transmitted via email. The recipient
should check this email and any attachments for the presence of viruses.
The company accepts no liability for any damage caused by any virus
transmitted by this email. 

www.wipro.com
        





The information contained in this electronic message and any attachments to 
this message are intended for the exclusive use of the addressee(s) and may 
contain proprietary, confidential or privileged information. If you are not the 
intended recipient, you should not disseminate, distribute or copy this e-mail. 
Please notify the sender immediately and destroy all copies of this message and 
any attachments. 

WARNING: Computer viruses can be transmitted via email. The recipient should 
check this email and any attachments for the presence of viruses. The company 
accepts no liability for any damage caused by any virus transmitted by this 
email.
 
www.wipro.com

Reply via email to