This hasn't been done anywhere, as far as I know... If this works, then
go for it, and if you can make it generic, let us know and we'll look at
putting it in.

> -----Original Message-----
> From: Jeremy Rayner [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, January 20, 2004 7:39 AM
> To: [EMAIL PROTECTED]
> Subject: [OS-webwork] xwork: MonoParametersInterceptor ( a 
> key without a value )
> 
> 
> Hi all, 
>   Quick question. We are using WW2beta2, and are just
> debating the best way round this issue:
> 
> When you have a webpage with 
>       <input type="image" src="edam.jpg" name="cheese"
> value="edam">
> 
> this will yield the parameters
> 
> http://example.com/delicatessen/Shop.action?cheese.x=56&cheese.y=15
> 
> i.e. the value "edam" is not sent by the browser.
> 
> Hence the issue revolves around only having the name
> available to the ParameterInterceptor,
> 
> 
> Question...
> 
> a) Should I, create a new interceptor that will set a
> value using a joined together version of the
> OGNL and the value, i.e.
> 
>       <input type="image" src="edam.jpg"
> name="cheese--edam">
> 
> which could have another style of ParameterInterceptor
> with the guts of...
> 
> ...
>                     String delimiter = "--";
>                     for (Iterator iterator = 
> parameters.entrySet().iterator();
>                             iterator.hasNext();) {
>                         Map.Entry entry = (Map.Entry) iterator.next();
> 
>                         String key =
> entry.getKey().toString();
>                         if (key != null &&
> key.length() > 0) {
>                             int monoBreak = 
> key.lastIndexOf(delimiter);
>                             if (monoBreak > 0) {  //
> "--" is found within key of "foo--bar"
>                                 String actualKey = 
> key.substring(0,monoBreak); // actualKey = "foo"
>                                 String value = 
> key.substring(monoBreak + delimiter.length()); // value = "bar"
>                                
> stack.setValue(actualKey, value);
>                             }
>                         }
>                     }
> ...
> 
> This has the benefit calling set methods on the
> actions, but not stepping on the toes of the main 
> ParameterInterceptor, i.e. there is no 
> ShopAction.setCheese--Edam() method, but there is a 
> ShopAction.setCheese(String type) method.
> 
> This works well with both input type="image" and
> submit buttons where you want to have a nice name on
> the button
> but a different value set on the action
> ( e.g <input type="submit" name="login--true"
> value="Login">  will call BlahAction.setLogin(true)
> etc...)
> 
> OR
> 
> b) stop being so silly, cos this has already been done 
> elsewhere in xwork/webwork2/OGNL ...?
> 
> 
> thx for your advice
> 
> jez.  (
> http://web1.2020media.com/j/jez/javanicuscom/blog2 )
> 
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes 
> http://hotjobs.sweepstakes.yahoo.com/signingbo> nus
> 
> 
> 
> 
> -------------------------------------------------------
> The SF.Net email is sponsored by EclipseCon 2004
> Premiere Conference on Open Tools Development and Integration 
> See the breadth of Eclipse activity. February 3-5 in Anaheim, 
> CA. http://www.eclipsecon.org/osdn 
> _______________________________________________
> Opensymphony-webwork mailing list 
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork
> 


-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
Opensymphony-webwork mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork

Reply via email to