I'm pretty sure that the encode is encoding the '%'. My situation is a list 
page with edit links to a detail form. The edit link with the position that has 
a key that contains the '%' worked. But followups from the detail form back to 
the list page didn't.

On further investigation,  GotoEvent::processEvent is decoding the position. On 
the edit link, the position has not been decoded before the processEvent, so 
that works as is. But on a followup, the position coming from DbFormsTag has 
already been decoded before it is passed to the constructor of GotoEvent. So as 
a patch I encoded it in the constructor. 

Also had to encode the new position in InsertEvent after a new record is 
created.

GotoEvent.java:

   /**
    * This constructor is not called by the controller but, actually, BY THE
    * VIEW for example if the FormTag "gotoPrefix" attribute is set an a
    * GotoEvent needs to be instanciated.
    *
    * @param table the input table
    * @param request request the request object
    * @param config the config object
    * @param position the position string
    */
   public GotoEvent(Table table, HttpServletRequest request,
      DbFormsConfig config, String position) {
      super(table, request, config);
      this.position = 
table.getKeyPositionString(table.getFieldValues(position));

      // CAPIO - encode the position string, cause processing it will decode it.
      try {
         this.position = Util.encode(this.position, 
getRequest().getCharacterEncoding());
          } catch (UnsupportedEncodingException e) {
                 logCat.error(e);
          }
   }

And added into InsertEvent.java 

        // Show the last record inserted
         String firstPosition = getTable().getPositionString(fieldValues);

         // CAPIO - must encode the position as it gets decoded when read.
         try {
                firstPosition = Util.encode(firstPosition, 
getRequest().getCharacterEncoding());
                 } catch (UnsupportedEncodingException ex) {
                    logCat.error(ex);
                        throw new SQLException(ex.getMessage());
                 }

         logCat.debug("pos-> " + firstPosition);
         getRequest().setAttribute("firstpos_" + getTable().getId(),
            firstPosition);

I'm not sure where else in the code that there might be a mismatch between 
encoding/decoding, but other functions that we use work ok with these keys.

Steve

---- Henner Kollmann <[EMAIL PROTECTED]> wrote: 
>  
> 
That's a real problem. Encoding of html strings uses the % sign as encoding
> 
letter. 
> 
Could you try to change the Util.decode / Util.encode methods to change the
> 
% to an double %%?
> 

> 
Maybe this helps....
> 

> 
Thanks,
> 
Henner
> 

> 
> -----UrsprÃngliche Nachricht-----
> 
> Von: Steven Law [mailto:[EMAIL PROTECTED] 
> 
> Gesendet: Freitag, 13. Mai 2005 09:06
> 
> An: jdbforms-interest
> 
> Betreff: [dbforms] Position not encoded after update or insert
> 
> 
> 
> I have a record that has a key with a value that ends with a 
> 
> percent character. When this record is updated I get a 
> 
> java.lang.StringIndexOutOfBoundsException when the list page 
> 
> tries to display the record because firstposition and 
> 
> lastposition have not been encoded.
> 
> 
> 
> I can't find the code where these values are being set for 
> 
> the followup after the update event. Also happens if I insert 
> 
> a similar record.
> 
> 
> 
> 
> 
> -------------------------------------------------------
> 
> This SF.Net email is sponsored by Oracle Space Sweepstakes 
> 
> Want to be the first software developer in space?
> 
> Enter now for the Oracle Space Sweepstakes!
> 
> http://ads.osdn.com/?ad_id=7393&alloc_id=16281&op=click
> 
> _______________________________________________
> 
> DbForms Mailing List
> 
> 
> 
> http://www.wap-force.net/dbforms
> 
> 
> 

> 

> 




-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_idt12&alloc_id344&op=click
_______________________________________________
DbForms Mailing List

http://www.wap-force.net/dbforms

Reply via email to