Hello Burton (and user list).

I have tried to replicate the issue Burton reported, but so far no luck.

A test using a basic action in Struts 2.5.22 with tags of a form similar to what Burton reported ("item.create" has a single {0} parameter):

<s:hidden id="getTextTest" name="getTextTest" value="%{getText('item.create',{getTextTest != null ? getTextTest * 100 : ''})}" />
  and
<s:hidden id="getTextTest" name="getTextTest" value="%{getText('item.create',{getTextTest != null ? {getTextTest * 100} : ''})}" />

seems to work normally when getTextTest is a Double (no custom type converter involved).  The page source displayed the expected result for both a null and non-null value for getTextTest.

Another test with a basic custom type / custom type converter configured seemed to also produce the expected result.  I'm not very familiar with custom type converters and don't know the flow of Burton's application so there's probably some other factor involved.

Burton, is there any chance you could provide some additional details on the action->result flow involved as well as the custom type converter you are using ?  If you can make a small app (1 action, custom type converter, result page) that reproduces the issue and attach it to a JIRA ticket that would help troubleshooting.

If anyone else can reproduce the same behaviour Burton reported (even better if they have a small reproducer app), please advise the struts-user mailing list.

Thanks,

James.


On Mon, 6 Jan 2020 6:41 PM J C <j...@yahoo.ca.INVALID>

wrote:

> Hello Burton.
>
> From your last update it seems you have found a workaround by re-ordering
> where the null check was being performed in the getText() expression (being
> passed to your custom StrutsTypeConverter).  It's good to hear that a
> workaround seems to work in your case.
>
> The expression with new ordering that works with Struts 2.5.22 seems to
> avoid calling getText() when xaction.splitAssistant is null, but with the old
> expression ordering (with 2.5.20) it seems the custom StrutsTypeConverter
> would have received some value (possibly a null or an empty string "")
> when the expression was evaluated.
>
> As Łukasz mentioned, would it be possible for you to open a Struts JIRA
> ticket for this issue ?
>
> If you could create a very small reproducer application (one that recreates
> the issue using a stripped-down custom StrutsTypeConverter based on the
> one you use and a basic action with one JSP) and attach it to the JIRA that
> would also help track down why the behaviour has changed with Struts
> 2.5.22.
>
> Alternatively, would it be possible for you to try the old expression again > running with Struts 2.5.22, but turn on "debug" level logging and look for
> DEBUG statements containing "Unable to convert value using type
> converter ..." ?  Updating this thread with the output from one or two of
> those statements (if they appear in the logs) might help narrow down a
> possible cause for the behaviour in 2.5.22.
>
> Regards,
>
> James.
>
>
> On Sun, Dec 29, 2019 at 1:38 PM Burton Rhodes <bu...@gmail.com>
> wrote:
>>
>> It appears I needed to change my tag to the following (removing the null
>> check from within the getText() method):
>>
>> <s:hidden name=" xaction.splitAssistant" id="xactionSplitAssistant"
>> value="%{xaction.splitAssistant != null
>> ? getText('format.percent',{xaction.splitAssistant * 100}) : ''}" />
>>
>> On Sun, Dec 29, 2019 at 1:02 PM Burton Rhodes <bu...@gmail.com>
>> wrote:
>>>
>>> So I think it may have to do with my actual jsp page.
>>>
>>> # Defined in package properties
>>> format.percent = {0,number,##0.00'%'}
>>>
>>> <!-- JSP -->
>>> <s:hidden name=" xaction.splitAssistant" id="xactionSplitAssistant"
>>> value="%{getText('format.percent',{xaction.splitAssistant != null ?
>>> xaction.splitAssistant * 100 :''})}" />
>>>
>>> the tag above prints:
>>> <input type="hidden" name="xaction.splitAssistant"
>>> value="ognl.NoConversionPossible" id="xactionSplitAssistant">
>>>
>>> I assume OGNL has changed it's getText code logic. Any guess as to how I
>>> can change the tag above to play nicely with newer version of OGNL?
>>>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to