| Author |
Getting Message from properties file in servlet
|
ashish kulkarni
Ranch Hand
Joined: Aug 15, 2002
Posts: 130
|
|
Hi, If i have to get messages from properties file and display them in jsp i use <bean:message key="index.title"/> tag to do so, if i want to get this same message in my servlet how can i do it, i want this message as String in servlet
|
A$HI$H
|
 |
Tim Holloway
Saloon Keeper
Joined: Jun 25, 2001
Posts: 14456
|
|
It's a standard Java Resource file. If you'll notice, the path of your Application Resources file ("classname") is one of the parameters that gets passed into the Struts controller servlet. If all else fails, download the Struts source code and see how THEY do it, but I think it's not that complicated. Cautionary note, however. The intent of Struts is that the Struts Servlet ALWAYS gets called in order to ensure central control and continuity. Think twice about plunking in a servlet that sidesteps that policy, or you may get burned someday. Consider either extending the standard Struts servlet (if you need control for every pass) or, if you have specialized needs, there's not really that much difference in the way a Struts Action perform() method works over the HttpServlet's own service() method.
|
Customer surveys are for companies who didn't pay proper attention to begin with.
|
 |
zb cong
Ranch Hand
Joined: Jan 14, 2002
Posts: 403
|
|
|
you can use "getResourceAsStream(String RelativePath)" to locate your properties files within the servlet,or use "getResource(.....)" method get the message from the properties file within the struts Action class.
|
 |
 |
|
|
subject: Getting Message from properties file in servlet
|
|
|