Re: freemarker not able to render a Javabean inside javabean

ganu05 <[email protected]>
Newsgroups gmane.comp.web.freemarker.user
Message-ID <[email protected]>
Thanks it worked.. for employees addressDTO was null..



ganu05 wrote:
> 
> Hi,
> 
> 
> I have a EmployeeDTO class with a getter, setter for AddressDTO class
> where AddressDTO class contains a list of addresses.
> 
> when i am trying to display the Employee address information i am getting
> an exception. please help!
> My code goes like this:
> 
>   class EmployeeDTO{
> 
>       private AddressDTO addressDTO;
> 
>  getAddressDTO() {...}
> setAddressDTO(){....}
> 
> and other fields goes here...
> }
> class AddressDTO{
> 
>       private List<String> addresses;
> 
>  getAddresses() {...}
> setAddresses(){....}
> 
> and other fields goes here...
> }
> 
> 
> struts action class:
> 
> class MyAction extends Action{
> 	
>     public ActionForward execute(
>             ActionMapping mapping,
>             ActionForm form,
>             HttpServletRequest req,
>             HttpServletResponse resp) throws Exception {
>     	
> // getting employee info from DB
>     		req.setAttribute("employeeDTO", employeeDTO);
> }
> 
> template code:
> 
> <table>
> <tr><td>${employeeDTO.name}<td></tr>
> <#list employeeDTO.addressDTO.addresses as address>
> <tr><td>${address}<td></tr>
> </#list>
> </table>
> 
> 
> Page is printing Employee Name but giving following exception:
> 
> Expression employeeDTO.addressDTO is undefined on line 15, column 19 in
> Employee.ftl.
> The problematic instruction:
> ----------
> ==> ${employeeDTO.addressDTO.addresses} [on line 15, column 17 in
> Employee.ftl]
> ----------
> 
> Java backtrace for programmers:
> ----------
> freemarker.core.InvalidReferenceException: Expression
> employeeDTO.addressDTO is undefined on line 15, column 19 in Employee.ftl.
> 	at freemarker.core.TemplateObject.assertNonNull(TemplateObject.java:124)
> 
> 
> please help!!!!!!!
> 
> 

-- 
View this message in context: http://www.nabble.com/freemarker-not-able-to-render-a-Javabean-inside-javabean-tp25958139p25969718.html
Sent from the freemarker-user mailing list archive at Nabble.com.


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.