servlets

jsp useBean with hashmap

How do I use jsp:useBean with collections like Lists and Maps correctly? I can get Lists by using type="List<MyObject>" but I cannot get the List to instantiate if nothing is passed. class="ArrayList<MyObject>" And the above attribute gives an error: The value for the useBean class attribute ArrayList`<MyObject`> is inval...

cant display text after displaying image in servlet?

hi i wrote a servlet which takes the name of a image from the client and displays it to client by converting it to byte array.after displaying the image now when i am trying to print some text i m not able to do so.it simply doesnt print the text even after using PrintWriter. i am using jboss application server to deploy it. here is th...

servlet, jsp and user feedback from form

Hi there, I have been straggling as to how to implement the following scenario. Any guidance would be much appreciated. I have a form that the user fills in. Using jquery it is validated as much as possible before sending to the server. When the submit button is click the form is send to a servlet. The servlet will then check the db a...

How to achieve interrupt-driven communication from server to client with servlets?

Hello, we wrote in C++ a screen sharing application based on sending screenshots. It works by establishing a TCP connection btw the server and client, where the server forwards every new screenshot received for a user through the connection, and this is popped-up by the client. Now, we are trying to host this on google app engine, and...

want to make web site using Java, should i implement struts ?

I want to make discussion form kind of website using java, should i just make it using JSP- Servlet - Java code or should i use some framework like struts ... I am new to Java, but i have sufficient exposure of programming ...

Using hash symbol in forward URL with RequestDispatcher

I'm trying to forward a request to another URL which includes the hash symbol ('#'): request.getRequestDispatcher("/some/path.jsp#somehash").forward(request, response); Tomcat, however, tells me that "the requested resource is not available". If I remove the hash from the URL, everything works fine. Are hashes not allowed or am I not ...

HttpServletRequest - setCharacterEncoding seems to do nothing

I am trying to read UTF-8 info from the request. I used "request.setCharacterEncoding("UTF-8");", but it seems to do nothing - the info read is non UTF-8. What am i doing wrong? ...

How to imitate slow connection with servlet

How I can configure servlet to response with some delay for GET or POST, without using Thread.sleep()? ...

Is it possible to precompile jsp into eclipse ?

The title is pretty straightforward. I would like to know if there is any possibility of seeing the compiled jsp (the servlet generated) directly into eclipse. Without deploying onto any server. ...

Java : How to accomodate special characters in the filename while uploading and downloading the file ?

Background: I have a file which I upload, during this process the link of the file is stored in the database and not the actual file, acutal file is stored in the File System, currently am storing it in my local machine. Goal: My goal is to upload a file and download a file properly which has special characters in it - #,$,%,@ etc. ...

EJB or Servlet - how to add a 'kill switch' to force a process/thread to stop

Hey all, Kind of an open question that I run into once in a while -- if you have an EJB stateful or stateless bean, or possibly a direct servlet process, that may with the wrong parameters start running long on a production system, how could you effectively add in a manual 'kill switch' for an administrator/person to specifically kill th...

Get virtual path of the invoked servlet inside the servlet code

If I've something like this: <servlet> <display-name>Step</display-name> <servlet-name>Step</servlet-name> <servlet-class>com.foo.AServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>Step</servlet-name> <url-pattern>/aservlet/*</url-pattern> </servlet-mapping> and the servlet is invoked by a request ...

Populating collection from request via Spring?

I've got a page where a purchase can be entered, along with all of the foos bought. I've got three elements in a html document that are parsed into a comma-separated format. function submitStuff() { //grab each cells value from dynamically built table based on user entries //appending comma document.form.ids.value=Ids; docume...

What is the difference between servlet and jsp?

Possible Duplicates: What is the difference between JSF, Servlet and JSP? JSP Servlet and Web Programming When it comes to the open-source Java Platform, Enterprise Edition (Java EE) application server, how would you characterize the difference between: JSP Servlet While both are able to generate dynamic Web content, I a...

load-on-startup Tomcat

How can i load a class on at startup in Tomcat ? I saw "load-on-startup" tag for web.xml file, but can i use it and how should I write my class ? EDIT: ok, but how can i implements this class and xml is it right ? < servlet-name>??< /servlet-name> < servlet-class>??< /servlet-class> < load-on-startup>10< /load-on-startup> ...

How does a Struts2 action compare to a Servlet?

How do Struts2 actions compare to Servlets? Can an action act as a servlet? ...

connect OutputStream with an InputStream

I'm experimenting with a little web framework and stumbled across an issue with streams. There are handler methods like Response get(HttpServletRequest). From the frameworks perspective the response should offer an input stream for the response body. The framework reads this streams and writes the data to the underlying OutputStream of t...

How to know what image type user submitted in form?

Hi, I allow my users to upload avatar images (google app engine, java). I don't know what image type it is when they upload. I'm just storing whatever they give me in their submission form. I'm following the example here: http://code.google.com/appengine/docs/python/images/usingimages.html Is there a way to check what image type it is...

RequestDispatcher to a JSP in the same package

If I have a servlet I am able to forward to a jsp in the WebContent folder with no issues: request.getRequestDispatcher("page.jsp").forward(request, response); request being an HttpServletRequest and response being an HttpServletResponse. Now for the question: What if I want to use package by feature? That is, move page.jsp into the ...

Explicit directory for JSF template files

Hi everybody, I'm just getting into Seam/JSF development and looking for a way to lookup the XHTML template files from a different location. When configuring the JSF application like this: <servlet> <servlet-name>Faces Servlet</servlet-name> <servlet-class>javax.faces.webapp.FacesServlet</servlet-class> </servlet> <servlet-mapping...