I practic the sample in core servlets/jsp using init(config)to get param from web server.but I have set the web.xml,I could not get parma through config.getInitParameter in servlet.Maybe this example in core and more servlets/jsp.Who have done this successful?I use jbuilder6 so the web server is tomcat.who can halp me ,thanks.
Two objects have the method getInitParameter. ServletConfig and Servlet. Which one you use depends on where you placed the parameter in the web.xml. If it is within the servlet tags, you use the method on Servlet. This is useful for parameters that are specific to a single Servlet/JSP and have no meaning to other parts of the system. If it defined within the context-param, you use the ServletConfig object and it is available to all the servlets and jsp within your application.
thanks Carl I just use ServletConfig.getInitParameter in a servlet init(ServletConfig config)to get a init value of a servlet.I config web.xml and add<servletname><servletclass>and so on,just like the Core-Servlets-JSP said. but I could not get the param like the book said.I do not know how to do.
Hi Greg, this can't be to difficult. You may post your servlet java code and the web.xml here. Please don't forget put it in code in Instand UBB Code Code tags and activate checkbox "Disable smilies in this post" Axel
Joined: May 08, 2002
The example is in the 2.7chapter in core servlet/jsp.I think it is right but I could not get the result.Maybe it is a problem in configing the tomcat.I use jbuilder6 enterprise edition.so it use tomcat as a web server.the web.xml file is the <default webapp>/deployment discriptors/web.xml.I hope someone who are familior the configure of jbuilder or tomcat could help me.thank a lot. the procedure init
Joined: May 08, 2002
I have got a clue.If I use <servlet-mapping> map my class into a /servlet/myclass model and use the alias in browser, the result is right.but the book did say this,I still wanna know if this is difference bettween tomcat 3.0 to tomcat 3.2.3(jbuilder6 used)?