I like the ease of using @Resource annotation to get a DataSource, but as far as I know, it's not possible to use it in a regular JavaBean. Would it be considered a bad practice if I pass the DataSource object from a servlet to a bean along with the other data to avoid having that lookup code in the bean?
...
Hi, I'm developing a servlet that gets a name of a web service and could be forward the request to an external web service, for example: http://www.webservice.com/...
I have build a response wrapper that intercept response output but I can't forward request to an external web service, it works only if I redirect the request to a servlet...
I'm attempting to use deftype (from the bleeding-edge clojure 1.2 branch) to create a java class that implements the java Servlet interface. I would expect the code below to compile (even though it's not very useful).
(ns foo [:import [javax.servlet Servlet ServletRequest ServletResponse]])
(deftype servlet []
javax.servlet.Servle...
I have a Java web app that I develop on a Windows machine and will deploy on a Unix machine.
There are some file path settings and permissions details that differ on the two (and there is nothing I can do to change this). Is there some way of detecting which machine the app is sitting on (it's only one of two), either by detecting the o...
I want to upload a zip file in a jsp page and the user is sent to another jsp page after he selects and uploads the file.
In this second page I want to
1.)extract the uploaded zip file.
2.)read some content from the extracted file(s) and allow the user to change/edit them
3.)save the user changes in the files.
4.)zip the files aga...
Hey All,
I'm new to JSF and am trying to make a content controller. Basically whenever someone makes a request to www.myapp.com/external/** I'd like to forward to a controller that pulls external content into a page template and spits it out to the user.
For example /external/test/test.html might pull in content from a location XXYYZZ...
I want to know how can I create new account using servlets in post method?
I'm currently following MVC design pattern, and I want to know if I pass the required data to register new account from JSP page, then how can I get that data in post method? As request.getParameter() method returning me null. How can I know that post method is c...
Does a servlet knows the encoding of the sent form that specified using http-equiv?
When I specify an encoding of a POSTed form using http-equiv like that:
<HTML>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=gb2312'/>
</head>
<BODY >
<form name="form" method="post" >
<input type="text" name="v_rcvname" value="...
I've a dynamic web app in Eclipse that is using tomcat s a runtime environment.
I cannot add javadoc path tomcat Servlet API
as appears, the edit button is always disabled!
...
Hi,
I am using Tomcat from Eclipse. When i try to start the server I am getting the following error in the console:
java.lang.ClassNotFoundException: net.jawr.web.servlet.JawrServlet
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1516)
When i deploy the war file in the Tomcat server outside of eclips...
For each servlet request I get, I pass, perhaps, 10 methods before I am at where I need to check something in the session and I need the HttpSession.
The only way I can get the HttpSession is from the HttpServletRequest, correct?
How do I keep track of the session for each servlet request? Unfortuantly I cannot simple make a singleton ...
How to specify more than one named Servlet to be wrapped by a filter?
...
How do I mimic an HTTPServletRequest and HTTPServletResponse object. The reason is I want to test the behaviour of some servlets.
I know JUnit probably provides this functionality but I don't know how to use it (I will learn soon) and need to do this reasonably quickly.
HTTPServletRequest and HTTPServletResponse are both interfaces so ...
What would happen if someone writes System.exit() in a servlet would the server or the application crash?
...
Hi
i tried to implement a servlet with servlet (in tomcat 6) which act as as a proxy (for browser), it takes the parsed url, use apache httpclient to get the result & push it back to the client (browser), with http it works well, doesnt work with https , seems the problem concerns unsupported CONNECT method in servlet-api & servlet even ...
I'm serving up images from my servlet. The response content type is image/jpeg. I find that images requested from my servlet are not cached. How do I get them to be cached like file image requests normally are? I tried setting Cache-Control: public but to no avail.
...
Hey , I am new to servlet and jboss, I just deploy my servlet on jboss 4.2 .jboss console shows me it is deployed successfully
my web.xml contain
<display-name>Notification_Auth_server_simulator</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</we...
The following code accesses a servlet's name: servletConfig.getServletName().
Can I access a servlet's URL pattern in a similar way?
An excerpt from web.xml:
<servlet-mapping>
<servlet-name>This is the servlet's name</servlet-name>
<url-pattern>/this-is-its-url-pattern/*</url-pattern>
</servlet-mapping>
...
Hi,
I've a JSP/Servlet Web App that consist of more than one servlet (and some JSPs)
I need to create an new HttpSession whenever the users access servlet A, knowing that, servlet A is the home page (i.e. he access it as the first servlet/page in the application)
so far so good, I can write the following code at the start of the servl...
I have a very strange issue with some of my servlets. Below is my configuration:
Folder A has X number of servlets deployed in Tomcat directory
Folder B has Y number of servlets deployed in Tomcat directory
After certain amount of time or hits to any of the servlets in Folder B, it stops working properly, whereas at same time all se...