Jump to content

Recommended Posts

  • Replies 37
  • Created
  • Last Reply

Top Posters In This Topic

  • chinni005

    19

  • Thingarodu

    8

  • chandu1987

    3

  • ChampakDas

    2

Popular Days

Top Posters In This Topic

Posted

[quote name='Thingarodu' timestamp='1352434185' post='1302767613']

asalu mee code lo servlets vunnaya??? oka vela vunte nuvvu create chesina servlet ni instantiate chesi, aa instantiate chesina servlet object nunchi "getServletContext()" method call cheyyi....
[/quote]
yeah servlets unnayi..

Posted

[color=#000000][font=Arial,]But if the class is by itself not a [/font][/color]HttpServlet[color=#000000][font=Arial,] at all, then you'd really need to move the properties file into the classpath.[/font][/color]
[color=#000000][font=Arial,]na situation idi?[/font][/color]


[color=#000000][font=Arial,]idhi solution la dorikindhi.. idhi chesthunna ravatledhu?[/font][/color]

Posted

[quote name='chandu1987' timestamp='1352434188' post='1302767614']
poni "class.getresource" try cheyyi
[/quote]
[color=#000000][font=Consolas, Menlo, Monaco,]prop.load(getClass().[/font][/color]prop.load(getClass().getResourceAsStream("sample.properties"));[color=#000000][font=Consolas, Menlo, Monaco,]("sample.properties"));[/font][/color]
[color=#000000][font=Consolas, Menlo, Monaco,][background=rgb(238, 238, 238)]idhi kuda try chesa.. I tried giving relative path too but not working :([/background][/font][/color]

Posted

anna neenu nee fan ni [img]http://www.andhrafriends.com/uploads/profile/photo-thumb-33867.jpg?_r=1352424972[/img]

Posted
S#d^ [quote name='MUSHTODU' timestamp='1352434796' post='1302767636']
anna neenu nee fan ni [img]http://www.andhrafriends.com/uploads/profile/photo-thumb-33867.jpg?_r=1352424972[/img]
[/quote]
Posted

[quote name='GatisKandis' timestamp='1352434993' post='1302767649']
LTT help..
[/quote]
tq ne id :3D_Smiles:

Posted

oka sari idi try cheyyi... I think this should work for you


ResourceBundle rb = ResourceBundle.getBundle( "com.test.sample");

[color=#ff0000]Properties file should be in the "com.test" package with name as "sample.properties".[/color]

then you can get the values from properties using rb.getString( "name" )

Posted

[quote name='Hava5' timestamp='1352434536' post='1302767630']
[color=#000000][font=Consolas, Menlo, Monaco,]prop.load(getClass().[/font][/color]prop.load(getClass().getResourceAsStream("sample.properties"));[color=#000000][font=Consolas, Menlo, Monaco,]("sample.properties"));[/font][/color]
[color=#000000][font=Consolas, Menlo, Monaco,][background=rgb(238, 238, 238)]idhi kuda try chesa.. I tried giving relative path too but not working :([/background][/font][/color]
[/quote]

endhku work cheyyatla...i mean em error vastundhi...try print the path and then add your properties file to that path and try again...

For Eg this is what I used in my class:



[CODE]
Class<ExampleClass> clazz = ExampleClass.class;
InputStream inputStream = clazz
.getResourceAsStream("/WEB-INF/resources/examplefolder/" + imageName);
[/CODE]


here clazz
.getResourceAsStream is giving the classpath location which is just before the WEB-INF folder, so I have added the image location which is relative to the classpath location given by that method

Posted

[quote name='MUSHTODU' timestamp='1352434796' post='1302767636']
anna neenu nee fan ni [img]http://www.andhrafriends.com/uploads/profile/photo-thumb-33867.jpg?_r=1352424972[/img]
[/quote]
[img]http://i56.tinypic.com/2w2r5gm.jpg[/img]

Posted

com/hava5/servletexample/user.properties ah?

com.hava5.servletexample.user.properties ah?

Posted

[quote name='Hava5' timestamp='1352435427' post='1302767669']
com/hava5/servletexample/user.properties ah?

com.hava5.servletexample.user.properties ah?
[/quote]


[color=#282828][font=helvetica, arial, sans-serif]ResourceBundle rb = ResourceBundle.getBundle( "[/font][/color]com.hava5.servletexample.user[color=#282828][font=helvetica, arial, sans-serif]");[/font][/color]

Posted

changed
[quote name='Hava5' timestamp='1352435120' post='1302767653']
tq ne id :3D_Smiles:
[/quote]

Posted

[quote name='chandu1987' timestamp='1352435272' post='1302767662']
endhku work cheyyatla...i mean em error vastundhi...try print the path and then add your properties file to that path and try again...

For Eg this is what I used in my class:



[CODE]
Class<ExampleClass> clazz = ExampleClass.class;
InputStream inputStream = clazz
.getResourceAsStream("/WEB-INF/resources/examplefolder/" + imageName);
[/CODE]


here clazz
.getResourceAsStream is giving the classpath location which is just before the WEB-INF folder, so I have added the image location which is relative to the classpath location given by that method
[/quote]
Null pointer Exception osthundhi bro.. servlet class run ayeppudu.. ee properties loading line daggara severe Exception ani ento chupisthundhi

×
×
  • Create New...