It seem that there is a Jrun bug on the <jsp:setProperty name="cookies"
property="request2" value=<%=(request) %> /> syntax.

Here is the result of my experimentation for those interested (sorry for the
others)

JSP Page:
<jsp:useBean id="cookies" class="org.planetfinance.common.CookieJSPBean"
scope="request">
</jsp:useBean>

< here the "setProperty" code change, see each try below Test 1, Test2 >

Your cookie named jrunsessionid has the value:
<jsp:getProperty name="cookies" property="jrunsessionid" />


CookieJSPBean:
...
  /**
   * Transfer a cookie from a request to this bean
   * @param request current request
   */
  public void setRequest(Object _request) {
    HttpServletRequest request=(HttpServletRequest)_request;
    Cookie _cookies[] = request.getCookies();

    for( int i=0 ; i<_cookies.length ; i++ )
            cookies.put(_cookies[i].getName(),_cookies[i]);
 }

Test1. Add the following line in the above code
<jsp:setProperty name="cookies" property="request2" value=<%=(request) %> />

Result1: This as no effect (noop), no error, no result the setRequest method
is not invoked
JSP page show:
"Your cookie named jrunsessionid has the value:"

*****
Test2: Whitout stopping Jrun or the Browser, change (1) in the JSP page by
the following line and hit reload
<jsp:setProperty name="cookies" property="request2" value=<%=((object)
request) %> />

Result2: This works!
JSP page shows:
"Your cookie named jrunsessionid has the value:936110661502102304"

*****
Test3: Shut Down the **browser (IE or Nes)**, return to the jsp page
Result3: It stop working!!!
The JSP page shows
"com.livesoftware.jsp.JSPServlet:javax.servlet.ServletException: Could not
execute bean setter method 'setRequest'."



This is happenning with Jrun 2.3.2 (+ build 153) = Jrun 2.3.3 under NT 4.0
with Netscape 4.07 or IE 4.01 Sp1

While send this to Allaire.

If anyone has other insight, or successful experiment on this under Jrun,
please email me.

-----Original Message-----
From: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Cc: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Date: mardi 31 ao�t 1999 15:27
Subject: Re: JSP 1.0 & Cookies


>> C�dric Janssens:
>
>> >  <jsp:setProperty name="cookies" property="request" value="<%= request
>> %>"/>
>>
>> But this last statement is not working, the setRequest of CookieBean is
not
>> called, maybe because the value is not a String.
>>
>> My JSP engine is Jrun 2.3.3 under NT.
>>
>> I don't known if this syntax is JSP 1.0 - compliant?
>
>It is, section 2.13.2 of the spec states:
>
>   Properties in a Bean can be set from one or more parameters in the
>   request object, from a String constant, or from a computed
>   request-time expression.
>
>> Larne, with wich servlet engine did you have it worked?
>
>It works under Sun's JSWDK 1.0.
>
>I don't know Jrun, but the early access release of the JSWDK had a bug
>that prevented set methods from working if the parameter was an
>interface.  If this is what is causing your problem, it can be fixed
>by changing setRequest() to:
>
>
>public void setRequest(Object req) {
>   HttpServletRequest request = (HttpServletRequest) req;
>   Cookie _cookies[]          = request.getCookies();
>
>   for(int i=0;i<_cookies.length;i++) {
>     cookies.put(_cookies[i].getName(),_cookies[i]);
>  }
>}
>
>
>                                                  - Larne

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html

Reply via email to