I've gotten as far as this:
private Properties logoUrls = new Properties();
logoUrls.load(new FileInputStream("channelLogos.properties"));
where channelLogos.properties is in the same directory as my JSP. I get a FileNotFound exception. Where does my app actually think I mean by "channelLogos.properties", if not the same directory as ...
I wrote some code to read a file in my Java Servlet class. (I'm using Netbeans on Windows along with Tomcat server). However, my servlet cannot find the file!
After much digging, I found that I had to place the file I wanted to read in Tomcat/bin folder. That's very surprising. How can I get the path to my Webapps/ folder? Let's assume ...
Hi,
could anyone please clarify the meaning of class libraries on the classpath in the case of Tomcat in the following line:
Actually all classes used by the web-app(unless they're part of the class libraries on the classpath) must follow the same rules as servlet classes-inside WEB-INF/classes, in a directory structure matching the pa...
The JavaEE API comes with the HttpServletResponseWrapper which, to quote the javadoc, "provides a convenient implementation of the HttpServletResponse interface that can be subclassed by developers wishing to adapt the response from a Servlet." Without subclassing, this class just passes all calls through to the wrapped response object. ...
I currently have to generate an image that displays the text of a string, i need to make this image on a Servlet and then somehow pass the image to a JSP page so that it can display it. I'm trying to avoid saving the image, and instead somehow stream the image to the JSP.
I haven't found a way of generating the image since i started wit...
Hi, I've writen a servlet that builds an html page showing the content of a database. The code is:
Statement st = (Statement) conexion.createStatement();
ResultSet rs = st.executeQuery("select * from audiolist" );
while (rs.next())
{
contador++;
out.println("<tr>");
String k = rs.getString("Tittle");
...
I couldn't find an authoritative answer to this with some Googling. In Java servlets, one can access the response body via response.getOutputStream() or response.getWriter(). Should one call .close() on this stream after it has been written to?
On the one hand, there is the Blochian exhortation to always close output streams. On the oth...
I have implemented the two classes shown at http://tomcat.apache.org/tomcat-6.0-doc/aio.html which gives a messenger application using Tomcat's comet implementation.
How do I connect this to a web interface and get something to display.
I am thinking these are the basic steps (I don't know the details).
I should create some tradition...
I am trying to test a servlet I wrote that processes a payapal IPN notification (my servlet is very similar to this example) - thing is even after enabling all the settings in the test account I am using the IPN notification is not firing at all.
I then found out that apparently in the sandbox the only way to test IPN is through the IPN...
I am wondering how I can use google protocol buffers to accept a request and send a response back to a client? I am thinking about writing a servlet which will take a request.
Is the following trail of thought the correct way to implement this:
1. Have a .proto file which is the message definition for the incoming request.
2. Write a ser...
I have implemented the Comets tutorial at http://www.ibm.com/developerworks/web/library/wa-cometjava/#N100CC
It seems like I am getting data returned from the server using the Comets technique - i.e. being pushed to the browser. However I am getting the .jsp page that I use to trigger the Comet event returned, rather than the weather da...
Why aren't cookies able to be referenced from a servlet filter? It just seems beyond me that J2EE wouldn't allow you to sanitize cookie values:
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain)
throws ServletException, IOException {
r...
Is there an equivalent to:
<jsp:setProperty name="beanName" property="*"/>
for servlets?
Something that will auto-populate the bean from inside a servlet using the request parameters? I'm refactoring a JSP-only application and would like to move some of the code to servlets. For a bunch of tragic reasons, we are not able (right n...
Hi,
I've developed a web application using servlet and tomcat. When I try to use this application from the server everything is rigth (i.e. http://localhost:8080/app_name/init.html).
However I'm having a hard time trying to access to this application from another PC. The server PC and client PC are connected using a router, there are n...
Hi!
I have a design question :)
I want to have multiple servlets but I dont want to configure a new servlet with a new name each time and extend the HttpServlet. I was thinking of having a generic servlet which dispatches different parameters to different specific classes that are actually handling the request.
Ex: theese two calls w...
I'm completely stumped. I'll give the background for the sake of
completeness but I'm not sure if it will help or not. I'm running a Lift project on a standard Jetty set-up running one Lift instance. Mac OS X.
I have a snippet which transforms the XML input, renders an image, saves it to disc under the webroot/images/ directory with a f...
What (if any) is the difference between storing a variable in the ServletContext and just having it as a public static member of one of the classes?
Instead of writing:
// simplified (!)
int counter = (Integer)getServletContext().getAttribute("counter");
counter++;
this.getServletContext().setAttribute("counter", counter);
Why not ju...
without using any big web framework (just servlets), do you know a ready to use small library that can populate my bean properties from the params of an http request?
...
Suppose we have some project with next structure:
web
articles
main.jsp
sidearts.jsp
central.jsp
forum
main.jsp
css
js
WEB-INF
web.xml
Note that we don't have front controller at this point yet.
After deploying with some facet (let it be 'asdf') we can access our pages using next URLs:
http://localho...
I know this might sound crazy...but i am integrating with some third party api's and unfortunately they have a utility class which only takes a pageContext object..I did some peeking around and found that they are doing a lot of stuff with pageContext... Is there a way to get to or create a pageContext from HttpServeletRequest.
...