Hi every one,
in order to separate java code and html code and be more faithful to MVC framework i am coding like that;
in the servlet i put the following:
net.sf.hibernate.Session s = null;
net.sf.hibernate.Transaction tx;
try {
s= HibernateUtil.currentSession();
tx=s.beginTransaction();
Query query =...
I cannot see this behavior in JBoss 4.2.3. If I try to call addCookie() on HttpServletResponse and my cookie value has accented characters in it (ex. ç) I get this exception:
java.lang.IllegalArgumentException: Control character in cookie value, consider BASE64 encoding your value
Does anyone know what change in JBoss 5.1.0 could be ca...
I occasionally get an IOException from a Servlet I have that writes a byte array to the outputstream in order to provide a file download capability.
This download servlet has a reasonable amount of traffic (100k hits a month) and this exception occurs rarely, around 1-2 times a month.
I have tried recreating the exception by using the ...
Hi,
I want to pass parameters betweeen applet and jsf components
So when a value of a input textbox changed, its binding backing bean makes connection to a servlet. The servlet create an attribute and save to HttpSession using (request.getSession(true)).setAttribute(name, value);
Then at some event, applet will access another servlet. ...
hi everyone,
In my servlet I construct the query like the following:
net.sf.hibernate.Session s = null;
net.sf.hibernate.Transaction tx;
try {
s= HibernateUtil.currentSession();
tx=s.beginTransaction();
Query query = s.createQuery("select opcemployees.Nom,opcemployees.Prenom,dailytimesheet.TrackingD...
Hi,
How do you stop a JSP from executing?
I have JSPs which kick the user off a page by means of a "forward".
public boolean kickIfNotLoggedIn(
HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException {
//code to check if user is logged in
req.getRequestDispatcher(
...
What is the difference between a servlet and filter? What do you recommend to use authorization to pages?
...
I'm trying to work with the below code:
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import javax.mail.*;
import javax.mail.internet.*; // important
import javax.mail.event.*; // important
import java.net.*;
import java.util.*;
public class servletmail extends HttpServlet {
public void doPost(HttpSe...
Hello guys,
I'm making a service that among other has the "photo albums" feature that serve photos to users. User has to be "allowed" to see the photo from the album. So sending the direct link to other person shouldn't allow to view photo.
Photos are stored in the folder outside of the context.
What I need to do is to perform some c...
Let's say I have this in my web.xml:
<servlet>
<description></description>
<display-name>MainServ</display-name>
<servlet-name>MainServ</servlet-name>
<servlet-class>MainServ</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>MainServ</servlet-name>
<url-pattern>/MainServ</url-pattern>
</servlet-mapping>...
Hi,
I need to give my user a web interface to change the session timeout interval. So, different installations of the web application would be able to have different timeouts for their sessions, but their web.xml cannot be different.
Is there a way to set the session timeout programatically, so that I could use, say, ServletContextList...
How can I detect that the client side of a tomcat servlet request has disconnected? I've read that I should do a response.getOutputStream().print(), then a response.getOutputStream().flush() and catch an IOException, but is there a way I can detect this without writing any data?
EDIT:
The servlet sends out a data stream that doesn't ne...
Just wondering what the easiest way to connect 2 jsp pages together, I have one page and I need to have it link to another page when a customer clicks something. Now can I create a link like in html or do I need to make a button or something?
...
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import javax.mail.*;
import javax.mail.internet.*;
import javax.mail.event.*;
import java.net.*;
import java.util.*;
public class servletmail extends HttpServlet
{
public void doPost(HttpServletRequest request,HttpServletResponse response)throws ServletException,IOExc...
Lets say my form called a servlet. I would do some processing in it. In the servlet i want to print something on the page. for that i used
PrintWriter out=response.getWriter();
out.println("some text here");
then further in the servlet i did some more form processing which works fine and after that i want the servlet to be forwarded ...
I'm using persistence API and want to load jdbc URL from web.xml. URL should be a context parameter of servlet. I can't find how to construct EntityManagerFactory not using persistence.xml. May be I should create PersistenceUnit in servlet and set some parameters? Can you give me some short example?
Thank you
...
I submit a (jsp) form to a Servlet A. Then I handle some logic which would make the submission either a success or a failure. I use jquery's ajaxForm() function to re-direct the user to a different jsp after the Servlet logic is executed. But before this redirection happens I need to show a javascript notification showing whether the sub...
Hi!
Where can I find the source code for isUserInRole? All I find are only interfaces or calling to super.isUserInRole
...
Hi,
I'm new and just developing on J2EE.
I am modifying an existing application (an OpenSource project).
I need to save an image on a client sent by the server, but I do not know how.
This activity must be done in a transparent manner without affecting the existing operation of the application.
From the tests done I get this error:
java...
Hi,
I write, because I can not solve the following problem.
I have a servlet that processes some information.
In response I put both text and binary content.
How do I get two response, then two html page, starting from the same request?
is a thing possible?
The first response should continue to do what he does now, while the second would...