CPPSERV


Home Projects Jobs Clientele Contact

cppserv


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem with initializing a servlet.



> You should never be overriding Servlet::init(ServletConfig&)
> There is another one - HttpServlet::init() - not the empty parameter
> list.
> You should override that one (and there is no need to call parent's
> init() method -  it's empty.).

I tried that initially, but with the same result: getInitParameter()
operations returned null.
That's why I tried init(ServletConfig&) hoping that it will create config
object. Apparently it didn't.
Any ideas why getServletConfig().getInitParameter("bla") does not work in
init()?

>
> sergey@total-knowledge.com wrote:
>> I need to initialize my servlet using init(ServletConfig& conf).
>> I know I have to call GenericServlet' init(conf) in order to do that(btw
>> the documentation still has java syntax: super.init(conf)).
>> Here is what I do:
>>
>> void UuServlet::init(ServletConfig& conf)
>> {
>>   servlet::GenericServlet::init(conf);
>>   string strUID = conf.getInitParameter("UID");
>> }
>>
>> getInitParameter("UID") returns null, despite of the fact that I have
>> this
>> parameter defined in my engine.xml:
>>
>>     <servlet name="UuServlet" dso="./debug/libui/libuu.so">
>>         <parameter name="UID" value="sergey"/>
>>     </servlet>
>>
>> What am I doing wrong?
>>
>> Thanks.
>>
>>
>
> --
> Ilya A. Volynets-Evenbakh
> Total Knowledge. CTO
> http://www.total-knowledge.com
>
>



Authoright © Total Knowledge: 2001-2008