Hi ,

I want to populate drop down list from property file.I already done this
coding by using MessageResources Class of org.apache.struts.util.* package
in my Action like the way


*tank.properties*
natureoftan...@concrete CHAMBERS,a...@c.m.d.a,d...@dug WELL,p...@pit PRIVY
detailsoftheseptictan...@high DRAIN OPEN,m...@man HOLE OPEN,n...@night SOIL 
LIQUID

*action*
Code Fragment

                MessageResources messages =
MessageResources.getMessageResources("/config/tank");
                String natureTankList =
messages.getMessage(request.getLocale(), "natureoftank");
                String []newList = natureTankList.split(",");
                TreeMap natureOfTankList=new TreeMap();
                int index;
                for(index=0;index<newList.length;index++){
                    int splitIndex = newList[index].indexOf("@");
natureOfTankList.put(newList[index].substring(0,splitIndex),newList[index].substring(splitIndex+1,newList[index].length()));
                }
                request.setAttribute(NATURE_OF_TANK_LIST,natureOfTankList);



is it right way to take properties from property file?If it is not right
please give me best way to take properties.I don't know how to populate
properties from property file.I googled for the code snippet or any other
article or tutorial for this but i haven't found any on this.

Actual property is like a way

*tank.properties*
C=CONCRETE CHAMBERS
A=C.M.D.A
D=DUG WELL
P=PIT PRIVY

H=HIGH DRAIN OPEN
M=MAN HOLE OPEN
N=NIGHT SOIL LIQUID


Regards,
Rajendar

Reply via email to