Return-Path: Delivered-To: apmail-jakarta-tomcat-user-archive@jakarta.apache.org Received: (qmail 68438 invoked by uid 500); 2 Oct 2001 14:45:03 -0000 Mailing-List: contact tomcat-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk Reply-To: tomcat-user@jakarta.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list tomcat-user@jakarta.apache.org Received: (qmail 68353 invoked from network); 2 Oct 2001 14:45:01 -0000 From: Marcel May Date: Tue, 2 Oct 2001 16:39:56 +0200 To: tomcat-user@jakarta.apache.org, "aheritier@sopra.com" Cc: "'struts-user@jakarta.apache.org'" Subject: Re: Can't use Cookies in tag libraries ????? Message-ID: <20011002163956.A17962@consol.de> Mail-Followup-To: tomcat-user@jakarta.apache.org, "aheritier@sopra.com" , "'struts-user@jakarta.apache.org'" References: <200110021440.QAA17285@dns1.sopra.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="5vNYLRcllDrimb99" Content-Disposition: inline In-Reply-To: <200110021440.QAA17285@dns1.sopra.com> User-Agent: Mutt/1.3.22i X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N --5vNYLRcllDrimb99 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Store your information in a bean with e.g. session scope? Is much simpler ...=20 On Tue, Oct 02, 2001 at 04:40:05PM +0200, Arnaud H?ritier wrote: > After studying the problem, I'm agree with you Fernando. > It's not a good idea to access to the header components from a taglibrary. > I found a bypass to my problem substituting a tag which flu= sh=20 > the content by a <@ include> which doesn't. > It works in this case but it's very bad and it reduces enormously the reu= se=20 > of my taglibrary. > I thinks that this problem is very annoying. I wouldn't do a very=20 > complicated thing. I developped a page by page iterator, and I wanted to= =20 > store from the taglibrary in a cookie the number of lines selected by the= =20 > user, in order to be transparent in the jsp page. > what a shame that cookies are transfered in the header :-( >=20 > too bad for me >=20 > arno >=20 >=20 > > -----Message d'origine----- > > De: Fernando_Salazar@lotus.com [SMTP:Fernando_Salazar@lotus.com] > > Date: mardi 2 octobre 2001 16:16 > > ?: struts-user@jakarta.apache.org > > Cc: Tomcat-User (Adresse de messagerie) > > Objet: RE: Can't use Cookies in tag libraries ????? > > > > > > I would say its not good practice for a taglib to write any HTTP header= =20 > -- > > of course, that includes cookies. > > Since tag extensions are designed to make scripted markup more=20 > expressive, > > compact, etc., they have to > > be allowed anywhere that markup is allowed. If possibly Struts is=20 > causing > > headers to be committed sooner > > that you are used to, even if Struts did nothing, you could still never > > insure that your tag would be successfully > > be able to write a cookie in all instances -- there's nothing to stop= =20 > your > > tag from being included at the bottom > > of a 50K JSP page. Unless the servlet container had a large buffer, the > > headers would already be committed. > > > > In apps I've worked on, we've always had a usage of putting any=20 > statements > > that write headers -- those controlling page > > caching, for example -- at the top of our JSP's, before any markup is > > transmitted. The mechanism is not > > foolproof, in that it relies on developers to understand and employ the > > usage, but then again this is no more > > burdensome that the 100 other things you need to know to make this stuff > > operate correctly. > > > > - Fernando > > > > > > > >=20 > =20 > > Arnaud=20 > =20 > > H?ritier To: "Tomcat-User (Adresse = de=20 > messagerie)" > > messagerie)" , (bcc: Fernando > > ra.com> Salazar/CAM/Lotus)=20 > =20 > > Subject: RE: Can't use=20 > Cookies in tag libraries ????? > > 10/02/2001=20 > =20 > > 07:42 AM=20 > =20 > > Please respond=20 > =20 > > to struts-user=20 > =20 > >=20 > =20 > >=20 > =20 > > > > > > > > > > Same think if I try to add a Cookie in the response from a JSP page :-( > > > > Sniffff > > > > I found that the response is already commited when I'm in the JSP Page. > > I don't undestand why !!! > > I use a servlet (Action Servlet from Struts Framework) which forward,= =20 > after > > an action, to my JSP page. > > > > Can I bypass the commit of the response ??? > > > > > > > > > > > -----Message d'origine----- > > > De: Arnaud H?ritier [SMTP:aheritier@sopra.com] > > > Date: mardi 2 octobre 2001 12:13 > > > ?: Tomcat-User (Adresse de messagerie) > > > Objet: RE: Can't use Cookies in tag libraries ????? > > > > > > I just try to test with tomcat 4.0 standalone and I have the same=20 > problem > > :-( > > > > > > Craig, an idea ???? > > > > > > > -----Message d'origine----- > > > > De: Arnaud H?ritier [SMTP:aheritier@sopra.com] > > > > Date: mardi 2 octobre 2001 12:03 > > > > ?: Tomcat-User (Adresse de messagerie) > > > > Objet: Can't use Cookies in tag libraries ????? > > > > > > > > Hi all !! > > > > > > > > I face up to a problem concerning the use of cookies in a tag=20 > library. > > > > > > > > In my tag library I would like to store a cookie on the client. > > > > I wrote this in the doStartTag method of my tag : > > > > > > > > HttpServletResponse httpResponse > > =3D (HttpServletResponse)pageContext.getResponse(); > > > > Cookie cookie =3D new Cookie("myCookie","cookie"); > > > > httpResponse.addCookie(cookie); > > > > > > > > but when later I retreive the list of cookies, this one is lacking. > > > > > > > > I tried to create cookies in my servlet and it works fine. > > > > > > > > I don't understand what it can happen !!! > > > > > > > > Can't we use cookies from tag libraries ???? > > > > > > > > my configuration is : > > > > Tomcat 3.2.3 > > > > AJP1.2 > > > > Apache 1.3.20 > > > > IE5.5 > > > > > > > > > > > > Have you any ideas ??? > > > > > > > > thanks > > > > > > > > > > > > Arnaud HERITIER > > > > Ing?nieur d'?tudes > > > > SOPRA. Group > > > > EAI Consulting > > > > Tel : +33-1-53-33-44-74 > > > > Email : aheritier@sopra.com > > > > > > > > > > > > --=20 Marcel May Development ConSol* GmbH --5vNYLRcllDrimb99 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) iD8DBQE7udG8sMSa0wDYjIcRAqPkAKDFhnY8MSQeWtbZ8LFHS5mHUQLligCglTPt eINcfNCSX2IQKUtvNtAT0cQ= =waNX -----END PGP SIGNATURE----- --5vNYLRcllDrimb99--