aspose file tools*
The moose likes Struts and the fly likes bean:write  tag Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "bean:write  tag" Watch "bean:write  tag" New topic
Author

bean:write tag

aamchi mumbai
Greenhorn

Joined: Mar 04, 2005
Posts: 19
Hi,

i have hashmap which contain following values

HashMap hm = new HashMap();
hm.put("id", "111");
hm.put("name", "Java");
hh.put("date",new java.util.Date());

request.setAttribute("data", hm);

in jsp

<bean:write name="data" property="id"/> <!-- Working Fine -->
<bean:write name="data" property="name"/> <!-- Working Fine -->
<bean:write name="data" property="date"/> <!-- THIS IS NOT WORKING -->

i am stuck here.

Thanks in Advance
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 5288
    
  10

In what way is it not working? Is it throwing an exception or is it just not displaying in the format that you want?


Junilu - [How to Ask Questions] [How to Answer Questions]
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Since you are trying to display a date, you need to tell Struts how to format the date. Here is how:

  • In your ApplicationResources.properties file, create a key such as date.format=MM/dd/yy (this can be any valid Java date format)
  • In your <bean:write tag, specify formatKey="date.format"


  • Merrill
    Consultant, Sima Solutions
    aamchi mumbai
    Greenhorn

    Joined: Mar 04, 2005
    Posts: 19
    Originally posted by Junilu Lacar:
    In what way is it not working? Is it throwing an exception or is it just not displaying in the format that you want?


    its not throwing any exception but it is not displaying that value.
    aamchi mumbai
    Greenhorn

    Joined: Mar 04, 2005
    Posts: 19
    Thanks it is working now
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: bean:write tag