If you're trying to separate logic from view, it'll be better to use a Servlet with JSP dispatch:
http://www.brics.dk/~amoeller/WWW/jsp/jspservlets.html You set your variables you need in your JSP via the Request Content (request.getAttribute(), request.setAttribute()). You can fetch these in the JSP. It'll be easier for you to set and get cookies in the servlet than the JSP - code in JSPs is generally regarded as bad style and should be avoided when possible. <http://www.brics.dk/~amoeller/WWW/jsp/jspservlets.html> On Fri, May 14, 2010 at 12:55 AM, Mark <[email protected]> wrote: > Hi, > > I'd like to add a cookie to a client request. I have a jsp page I'm > serving from app engine. Is this correct?: > > // index.jsp: > <%@ page import="com.me.myproject.server.Util" %> > > Util.addCookie(response); > > > > // Util.java > import javax.servlet.http.Cookie; > import javax.servlet.http.HttpServletResponse; > > public class Util { > > public static void addCookie(HttpServletResponse response) { > Cookie cookie1 = new Cookie("param1", 123); > Cookie cookie2 = new Cookie("param2", 456); > response.addCookie(cookie1); > response.addCookie(cookie2); > } > } > > mostly confused about 'response' just being globally available in my > jsp (I think this is just how jsps works) and if it is in fact of type > "HttpServletResponse"? I think then that it's ok to just pass it to my > java file from the jsp page? > > Thanks > > -- > You received this message because you are subscribed to the Google Groups > "Google App Engine for Java" group. > To post to this group, send email to > [email protected]. > To unsubscribe from this group, send email to > [email protected]<google-appengine-java%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/google-appengine-java?hl=en. > > -- Ikai Lan Developer Relations, Google App Engine Twitter: http://twitter.com/ikai Delicious: http://delicious.com/ikailan ---------------- Google App Engine links: Blog: http://googleappengine.blogspot.com Twitter: http://twitter.com/app_engine Reddit: http://www.reddit.com/r/appengine -- You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
