I've to display many groups and many products under each group. For displying them I'm using JSTL to iterate the list of products from the list of groups.
User can select one product from each group by clicking on the radio. To enable this i've added the id of the group with the radio name, so that user can select multiple radios.
Ho...
I have set up UrlRewriterFilter (Tuckey) with many rules and it is working very good for my servlet. But I want to use the same config to rewrite urls outside servlet - in code that generates e-mails with urls.
So, I need to somehow start UrlRewriter (or some kind of wrapper) to process outgoing url i.e. rewrite them with my outbound-ru...
I am trying to get the Display name (Context Root) from web.xml file to avoid hardcoding a context root.
Any help would be appreciated.
...
Hi,
I need to load log4j.xml config file in my web to initialize logging. log4j.xml is in package
com.test.config.
when in j2se java app code
InputStream input = ClassLoader.getSystemClassLoader().getResourceAsStream("com/test/config/log4j.xml");
resturns input stream but when I execute this in servlet it returns null.
servlet is ja...
Hi,
I have a java servlet which accepts an image a user uploads to my web app.
I have another server (running php) which will host all the images. How can I get an image from my jsp server to my php server? The flow would be something like:
public class ServletImgUpload extends HttpServlet
{
public void doPost(HttpServletReque...
Hi all,
This may be a relatively straight-forward question that I just haven't been searching for correctly, but I'm trying to use the Spring IoC container to configure my servlets. I have some additional handlers (that are private data members) and such that I would like to be configured at runtime. Is it possible to do this?
Right ...
I created a servlet that takes a request, figures it out, does some processing, and at the very end of that processing, it sends a response.. Pretty basic stuff.
I test this using HTTP Client and sometimes, a weird thing happens..
I send the request from the client, and the response received (too quickly) is "200 Ok", but it has no con...
I want to download csv file from servlet.Data comes from Object[] obj=search.getSearch();
I have data the object[], i need to write into csv and download.
Could you help me how to do in servlet class?
...
Is calling
HttpServletResponse.addCookie();
(from servlet-api-2.5) multiple times using a cookie with the same name safe?
Safe in the sense of that there is a deterministic behavior, e.g. the subsequent calls will be ignored (the first wins) or the subsequent calls will always replace the cookie or something like that?
Example:
H...
Is it ok to have more than 1 DispatcherServlet in web.xml to handle different URL ?
What's the downside?
<servlet>
<servlet-name>servlet1</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet>
<servlet-name>servlet2</servl...
Hi,
I have a servlet which serves an image file which was stored in a blob. If the requested image can't be found, I'd like to server a static image I have included in my war directory. How do we do this? This is how I'm serving the blob images from the datastore:
public class ServletImg extends HttpServlet {
public void doGet(HttpSe...
I'm developing a Servlet that should act listing all the files that are on the directory C:\UploadedFiles\CompanyWork on the page and put the link for the files on each one, like this example(using Test.doc as test):
<a href="C:\UploadedFiles\CompanyWork\Test.doc">Test.doc</a>
But I don't know how to do this, I only know how to get th...
Hi,
I'm saving an image as a blob using the following, but I'm not sure how to carry a message through the final redirect to display to the user:
JSP file:
<%
BlobstoreService blobstoreService = BlobstoreServiceFactory.getBlobstoreService();
String action = blobstoreService.createUploadUrl("/servletimg");
%>
<form method="POST" actio...
There are many, many examples in books, and on the internet about how to use Servlets as JSPs. But I would like to know what the best way to go about using them, with a mind to good architecture.
Should there be a one-to-one relation of Servlets to JSPs? Acting like ASP.NET "Code-Behind" pages?
Or more like ASP.NET MVC, with a single S...
I've compiled the source into the class Files, then putted at the folder:
Tomcat 5.5\WEB-INF\ROOT\classes\Files.class
And added this to the web.xml file:
<servlet>
<servlet-name>Files</servlet-name>
<servlet-class>Files</servlet-class>
</servlet>
But when I tried to access the URL http://localhost:8080/Files, I got this err...
Hi,
I've made a twitter-like web app. Users can follow one another when viewing eachother's pages. Here's a high-level description of what's happening:
UserA views their own page at www.mysite.com/UserA, which renders a list of users they're following.
UserA navigates to UserB's page at www.mysite.com/UserB.
UserA follows UserB (via a...
Our application logs off after 30 min and gets redirected to login page,i am specifying session timeout in web.xml and using a requestProcessor for redirecting.I want to show to the user a message saying your session got expired once the session expires,how can i do that.Auto log off ?
I wuold like to prompt the error message on the page...
I have this code here:
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
/**
*
* @author Nathan Campos
*/
public class Files extends HttpServlet {
PrintWriter out = null; // moved outside doGet() for use in ls()
@Override
public void doGet(HttpServletRequest request,
...
Hi,
I am developing a simple chat programme in Android that allows a user to load his freind list and chat with users. I have to implement this using HTTP. Does any one have any suggestions as to how to do this. I mean how to implement chat using a simple a request response mechanism. Any working example would be good.
Kind Regards,
Mu...
Hey,
I've written a very simple server that accepts socket connections on a specific port
and communicates with clients over that socket.
Now I have a client lib which works perfectly fine in J2SE apps.
However, if I try to use that lib in a Servlet (the Servlet being the client) to communicate with the server it doesn't work.
Unfortun...