Questions tagged [servletconfig]

37 questions
59
votes
11 answers

ServletConfig vs ServletContext

What is the difference between ServletConfig and ServletContext interface?
Sumithra
  • 6,587
  • 19
  • 51
  • 50
14
votes
4 answers

How to portably read configuration data from a servlet

I'm writing a Java servlet that needs to read some site-specific configuration data; I would like it to be easily accessible/modifiable by the sysadmins at deployment time. There is no sensible default, so the data has to be provided by the site…
Riccardo Murri
  • 1,045
  • 1
  • 11
  • 19
12
votes
5 answers

Invalid content was found starting with element 'display-name' in web.xml

I am using Eclipse Helios Release. Eclipse xml validator doesn't like the display-name element under in my web.xml. Here's the relevant part:
juny fan
  • 121
  • 1
  • 1
  • 3
9
votes
3 answers

Dynamically add a servlet to the servletConfig

I have a Java web application that uses a plugin architecture. I would like to know if anyone has a solution where by one could add a servlet, with serlvet mapping to the servletconfig while the web app is running? The idea being that a class could…
BigBadOwl
  • 669
  • 2
  • 9
  • 22
8
votes
6 answers

Can I dynamically load additional Spring configuration files into an existing WebApplicationContext?

Upon starting my webapp within Tomcat 6.0.18, I bootstrap Spring with only what is necessary to initialize the system -- namely, for now, database migrations. I do not want any part of the system to load until the migrations have successfully…
Elliot
  • 1,286
  • 2
  • 12
  • 22
6
votes
1 answer

getServletContext().getRealPath() in Tomcat 8 returns wrong path

I am attempting to run a Java web project under Tomcat 8 that traditionally runs under WebSphere. One servlet makes the following call: xslFilePath = config.getServletContext().getRealPath(System.getProperty("file.separator") + "xsl"); config is…
MichaelB
  • 571
  • 4
  • 13
6
votes
1 answer

Servlet 3.0 annotations

Is it possible to set welcome-file tag from standard web.xml file by servlet 3.0 annotation ? PageName.html
kislo_metal
  • 446
  • 10
  • 27
3
votes
1 answer

Why should I use setInitParameter() instead of setAttribute() for ServletContext?

If I had to define a context-visib parameter at runtime, I wouldn't use ServletContext.setInitParameter() because init parameters are defined in the deployment descriptor once for all, and I suppose that ServletContext().setAttribute() would be more…
Luigi Cortese
  • 10,841
  • 6
  • 37
  • 48
3
votes
2 answers

getServletConfig() / getServletContext() returning null value

I want to get servletContext in a Java class to read a file from WEB-INF directory. I extended my class with HttpServlet and tried to get the context as in the below code, but the servlet config is returned as null. I don't use any jsp or…
display4
  • 71
  • 1
  • 1
  • 7
2
votes
1 answer

Unable to get servletcontext path in jsf

I have written a liferay richfaces portlet. But iam not able to get the css path or images in the web-inf folder. My portlet config is testLR6_PB3_RF4 true
Vivek Shankar
  • 691
  • 3
  • 14
  • 48
2
votes
1 answer

How to access ServletConfig in JSF Managed bean

At the moment, I am try to integrate Confident CAPTCHA into my JSF project. The constructor of the class ConfidentCaptchaClient is as following: public ConfidentCaptchaClient(String settingsXmlFilePath, HttpServletRequest request,…
Mr.J4mes
  • 9,168
  • 9
  • 48
  • 90
1
vote
0 answers

Interceptor is not get invoked if get beans created in servlet-context in spring-config. in Spring Framework

I added code in servlet context instead of spring-web.xml, that time interceptor not got invoked, but when I added in spring-web.xml it invoked.. Not getting reason. Is any one can tell the reason. Web.xml
Vivek Nerle
  • 304
  • 2
  • 14
1
vote
1 answer

java.lang.IllegalStateException: ServletConfig has not been initialized

I am trying to create an UI component that allow the user to customize the timeout of sessions. So I created a servlet as below: public class SessionTimeoutServlet extends AbstractBaseServlet { private static final long serialVersionUID =…
user2133558
  • 524
  • 2
  • 10
  • 29
1
vote
2 answers

Simple Servlet Question on ServletConfig instantiation

Apparently the following is generating a loop(the GenericServlet class is calling the subclass's init()) public void init() throws ServletException { ServletConfig c = this.getServletConfig(); super.init(c); } I'm probably just doing this…
user398371
  • 857
  • 2
  • 10
  • 15
1
vote
1 answer

Programmatically get error-page from web.xml

I often have redirects like r.sendRedirect("error.jsp"); Anyway the web.xml already defines error-pages. javax.servlet.ServletException /error.jsp How can I…
Grim
  • 1,938
  • 10
  • 56
  • 123
1
2 3