struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rajendar are <aare.rajen...@gmail.com>
Subject Re: How to populate drop down from propery file in Struts html
Date Thu, 15 Oct 2009 09:50:25 GMT
Hi all,
At last I got solution

MessageResources messages =
MessageResources.getMessageResources("/config/messages_EN");
String message = messages.getMessage(request.getLocale(),
"message.delete.error");


Thanks & Regards,
Rajendar

2009/10/15 rajendar are <aare.rajendar@gmail.com>

> Hi,
> Instead of this I used below code in the Dispach Action add method
>
> 1 MessageResources msgRsrc=getResources(request,"fileName");
> 2 String msgProperty =msgRsrc.getMessage("msg.delete.error");
>
> But it will give me null pointer at 2 line.
>
> Regards,
> Rajendar
>
> 2009/10/15 Muthu Velappan <muthu.velappan@aspiresys.com>
>
>
>>
>> Try this one..
>>
>> You can load the properties file in servlet using this line
>>
>>        URL url = servletContext.getResource("/WEB-INF/option.properties");
>>        Properties props = new Properties().load(url.openStream());
>>
>> Now you have all the key value pair from properties files into your
>> properties object. Prepare a collection object from this one and set it to
>> the request and use in jsp.
>>
>> This is a quite a round about workaround but this will work for ur
>> requirement.
>>
>> Thanks,
>> Muthu
>>
>> -----Original Message-----
>> From: rajendar are [mailto:aare.rajendar@gmail.com]
>> Sent: Thursday, October 15, 2009 12:34 PM
>> To: user@struts.apache.org
>> Subject: How to populate drop down from propery file in Struts html
>>
>> Hi,
>>
>> I want to populate drop down in my jsp(struts html) from property
>> file.Still
>> I used property files for Action Fom properties and Messages.Please send
>> if
>> any source code is there other wise please give me idea
>> 1)how can i get the options list from property file to
>> HashMap/TreeMap/ArrayList in my Action
>>
>> After that I will set this to my request and will call in jsp
>>
>>
>>
>> Regards,
>> Rajendar
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message