chinni005 Posted November 9, 2012 Author Report Posted November 9, 2012 [quote name='Thingarodu' timestamp='1352435144' post='1302767655'] 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" ) [/quote]java.util.MissingResourceException: Can't find bundle for base name com.tekreliance.servletexample.user.properties, locale en_US java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1427) java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1250) java.util.ResourceBundle.getBundle(ResourceBundle.java:705) com.tekreliance.servletexample.Service.getConnection(Service.java:16) com.tekreliance.servletexample.MyServlet.doPost(MyServlet.java:50) javax.servlet.http.HttpServlet.service(HttpServlet.java:641) javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
chinni005 Posted November 9, 2012 Author Report Posted November 9, 2012 bhayya.. oka 2 JSP's unnayi Home n Succes and veeti kosam oka web.xml undhi and nenu oka Myservlet class rakunna..! and oka properties file lo db url username and password pettukunna.! ee oka service class theskuni dbconnections kosam oka connection object ni return chese method ni raaskunna e class lo..! so with the same class i'm trying to load the properties file to register the driver and established a connection.. So, e service class separate class complete ga.. hard code chykunda evarayina db ki connect avvalankunte ee class ni instantiate chesi connect ayyettu..! now i'm facing problem in loading this properties file an also the main aim of the task is Home.jsp lo username n password fields untaayi db lo konni records unayi.. e user given username db records tho match ayithe..! na Servlet class lo RequestDispatcher use chei home page ni Succes page ki forward chesthunna idhi matter
Thingarodu Posted November 9, 2012 Report Posted November 9, 2012 [quote name='Hava5' timestamp='1352435980' post='1302767691'] java.util.MissingResourceException: Can't find bundle for base name com.tekreliance.servletexample.user.[color=#ff0000]properties[/color], locale en_US java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1427) java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1250) java.util.ResourceBundle.getBundle(ResourceBundle.java:705) com.tekreliance.servletexample.Service.getConnection(Service.java:16) com.tekreliance.servletexample.MyServlet.doPost(MyServlet.java:50) javax.servlet.http.HttpServlet.service(HttpServlet.java:641) javax.servlet.http.HttpServlet.service(HttpServlet.java:722) [/quote] ResourceBundle lo ".properties" ani mention cheyyakudadu.... just mention it as "com.tekreliance.servletexample.user"
ZuniorVentiyar Posted November 9, 2012 Report Posted November 9, 2012 try this ...... make sure your property file is in classpath ............ InputStream inputStream = Thread.currentThread().getContextClassLoader().getResource(propertyFileName).openStream(); Properties theProps = new Properties(); theProps.load(inputStream);
chandu1987 Posted November 9, 2012 Report Posted November 9, 2012 [quote name='Hava5' timestamp='1352436387' post='1302767707'] bhayya.. oka 2 JSP's unnayi Home n Succes and veeti kosam oka web.xml undhi and nenu oka Myservlet class rakunna..! and oka properties file lo db url username and password pettukunna.! ee oka service class theskuni dbconnections kosam oka connection object ni return chese method ni raaskunna e class lo..! so with the same class i'm trying to load the properties file to register the driver and established a connection.. So, e service class separate class complete ga.. hard code chykunda evarayina db ki connect avvalankunte ee class ni instantiate chesi connect ayyettu..! now i'm facing problem in loading this properties file an also the main aim of the task is Home.jsp lo username n password fields untaayi db lo konni records unayi.. e user given username db records tho match ayithe..! na Servlet class lo RequestDispatcher use chei home page ni Succes page ki forward chesthunna idhi matter [/quote] task easy gane undhi...but nenu antha experienced kaadhule....neeku simple steps lo cheppatanki....but naaku time isthe....google chesi complete cheyyagalanemoo...then I can explain it to you
chinni005 Posted November 9, 2012 Author Report Posted November 9, 2012 [quote name='chandu1987' timestamp='1352436769' post='1302767727'] task easy gane undhi...but nenu antha experienced kaadhule....neeku simple steps lo cheppatanki....but naaku time isthe....google chesi complete cheyyagalanemoo...then I can explain it to you [/quote] yup easy task
fake_Bezawada Posted November 9, 2012 Report Posted November 9, 2012 this.getClass().getResouceAsStream("/load.properties); ba idhi use chey work out avachu
Recommended Posts