You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by pa...@wipro.com on 2007/02/21 09:35:12 UTC

How to make Reusable JSP

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

Re: How to make Reusable JSP

Posted by Cagatay Civici <ca...@gmail.com>.
Hi,

Here's an example;
http://www.jroller.com/page/cagataycivici?entry=jsf_composition_components_with_aliasbean

Regards,

Cagatay

On 2/21/07, pallavi.roy@wipro.com <pa...@wipro.com> 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
>