Announcement Announcement Module
Collapse
No announcement yet.
Converter exists but is not invoked Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Converter exists but is not invoked

    I have a form on which users pick the Journal they wish to submit an article to via a <select>. The value is the journal id (a string) which the JournalIdConverter is supposed to convert to a Journal object.Unfortunately the converter does not get invoked even though the ConversionService reports it can convert from String to Journal.

    In a controller I have a request mapping:

    @RequestMapping(value = "/newsubmission", method = RequestMethod.POST)
    public ModelAndView newSubmission( @ModelAttribute("submission") Submission submission, BindingResult result) throws Exception {...

    if (conversionService.canConvert(String.class,Journal .class)) {
    logger.debug("Converter exists");
    }

    }

    If I set a breakpoint in the converter it is not triggered. This is the error I see in the results object:

    [Field error in object 'submission' on field 'journal': rejected value [ijo];
    codes [typeMismatch.submission.journal,typeMismatch.journ al,typeMismatch.com.sp.journalweb.entity.Journal,t ypeMismatch];
    arguments [org.springframework.context.support.DefaultMessage SourceResolvable:
    codes [submission.journal,journal]; arguments []; default message [journal]];
    default message [Failed to convert property value of type 'java.lang.String' to required type 'com.sp.journalweb.entity.Journal' for property 'journal';
    nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type [com.sp.journalweb.entity.Journal] for property 'journal': no matching editors or conversion strategy found]]

    Any idea where I am going wrong?


    Gerry
Working...
X