Servlet is a Java application programming interface (API) running on the server machine which can intercept on the requests made by the client and can generate/send a response accordingly.
7
votes
2answers
445 views
Servlet file uploader
I think this code looks ugly, especially with the multiple try-catch blocks, but I don't know how to rewrite it:
...
6
votes
1answer
50 views
Creating an in-memory ViewCounter that commits to database every 10 minutes
This singleton is responsible for counting every pageview (called Routes in our case) we get by id, until the timer runs out and commits the results to the database in one query. Then the counter gets ...
1
vote
1answer
47 views
Web application for recording blog comments
I am working on some coursework for a simple Java EE web application that records blog comments. On the add comment page there are two fields: name and ...
8
votes
3answers
305 views
Sending a file in servlet response, using a class inside a method
I am processing file inside my method - basically preparing it for the download.
But I decided to split actions for setting headers and reading bytes.
As Java does not support method declaration ...
3
votes
1answer
136 views
Filter to block duplicate POST submission on server side
I am working on a JSF 1.1 webapp. Lots of POST request take some time and users have the bad habit of clicking again when it takes too long. I am planning to target all the long running processes and ...
3
votes
1answer
182 views
Servlet responses to upload/download requests
My task is to write a program to store files in object store. One of the subtasks requires to send json or xml format response to the file uploader/downloader as requested by client.
The following ...
2
votes
0answers
320 views
Authorization token from servlet filter stores user name
I'm having some difficulty with servlet and filter lifecycles. The intention here is to use the front controller pattern with a simple login; authentication is accomplished with the filter.
Am I ...
2
votes
1answer
120 views
Open source Pastebin tool made in JSP and servlet
I'm a student and still studying. I just made my own Pastebin tool to generate source code. I've also contributed this project as an open source. You could see this project from here.
If you wish to ...
3
votes
0answers
185 views
Exception logger for servlets and JSPs
I hate using unnecessary catch blocks and I like to see my code look beautiful. In most of the cases in my project, which is a web application, I can't declare many ...
6
votes
1answer
98 views
Entering information about a business and finding matches
I'm writing a Java Servlet application where the users must enter information about a business. I'd like to prevent as many duplicate entries in the MySQL database as possible and I'd appreciate ...
0
votes
2answers
1k views
Elegant way to handle errors with JSP and Servlets (Model 2)
I have a form that submits to a registration Servlet, which inserts a new user to the database when they sign up to the web application. Depending on the erroneous user input, the Servlet will ...
4
votes
1answer
410 views
Error Handling in Servlets and JSPs
I have an HTML login form that is processed by a servlet, which then redirects the user to a result page.
login.jsp:
...
5
votes
3answers
2k views
Catching NullPointerException in Servlets
I have a servlet that processes user registration to a website. It takes inputs from an HTML form like username, password, email, etc.
MySQL Table:
...
2
votes
1answer
60 views
Servlet WebClient: How do I best solve for multiple servlet requests?
This is working code presently visible here. Basically, this is still a work in process, but I do not want to go much further down the road without peer review. I've limited the source to the servlet. ...
4
votes
3answers
2k views
Unit testing a servlet in a meaningful way
I have to write a unit test for the method processRequest in the servlet below and I'm wondering if:
It just shouldn't be done.
The class should be rewritten / ...
5
votes
1answer
2k views
Single Sign On - SAML Response generation
I am trying to implement a IDP initiated Single Sign On Solution (service similar to onelogin's) to Cloud based Service providers such as Google Apps, Salesforce etc.
The project is a Maven eclipse ...
2
votes
1answer
312 views
Mutualising multi-threaded calls to EJB from Servlet
I have a Servlet that makes an EJB call to a backing server which takes about a second to return some data that changes reasonably regularly.
I can't cache the data on the servlet-side, so I have ...
10
votes
2answers
1k views
Simple servlet code to sum digits
This servlet takes an input from the user and
Stores the number inside the bean but with spaces in between each digit then stores the bean in the request scope.
If the last digit is even, sums the ...
8
votes
2answers
590 views
6
votes
2answers
2k views
Implement HTTP Server with persistent connection
I am trying to implement a HTTP Server in Java, I want the server to use a persistent connection per thread for request and response. After some research on Google, this is how my program looks like. ...
8
votes
2answers
484 views
Servlet for querying database on some high-loaded system
What should the code do: Process client HTML requests, query database and return the answer in XML. Working with a high load.
I need to know how can it be optimized.
Is something terribly wrong with ...
-1
votes
1answer
478 views
Please check my example about jquery autocomple with servlet [closed]
Please check my code, did i get some things wrong
I'm a newbie in jquery and ajax, please check and show me how to fix this
In jsp page :
...
-2
votes
1answer
3k views
file downloading using jsp but not readable [closed]
I am trying to download files using jsp but then downloaded files are not readable.
Suppose if i download pdf files then it can not opened,if i download jpg files then it can not opened and similarily ...
1
vote
1answer
227 views
How can I tidy up this servlet parameter check code?
One of the servlet in my web app takes parameters in the form www.service.com/servletname/parameter1/parameter2.
The first parameter is required and the second ...
2
votes
1answer
449 views
Am I using appropriate methods in this login system?
I have had to do a crash course in JSP, Servlets, and JDBC. I decided to attempt a Login System. I'm unsure if my use of try/catch is appropriate and if I am closing database connections correctly. ...
1
vote
2answers
1k views
Correct implementation for background task execution in web application?
I have a simple servlet which merely serves some cached data back to the user. I also have a background thread which runs at fixed intervals to refresh the cached data. Is this a reasonable ...
2
votes
1answer
798 views
Tomcat/JSP/servlets web-project
This is a simple sort of array. The array (in fact I used ArrayList) is stored in default_list.txt file on server, all changes ...
1
vote
2answers
298 views
Is there a more efficient way of loading views within my java app?
I'm building a web application in Java. I'm new to Java, so before I get too far into this... I'm hoping to take advantage of all the experience here and learn the problems with this setup.
My ...
6
votes
2answers
220 views
Handling optional parameters in a servlet
I have a form that submits to a servlet that has optional parameters. If they are empty they are just ignored. This is the template I am using:
...