struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Miguel Almeida <>
Subject Can you use type conversion with JSONInterceptor?
Date Thu, 01 Dec 2016 19:07:33 GMT
Imagine SearchAction{

private List<Record> evaluatedRecords;

Record is an interface so to get auto-wiring to work you'd usually
set-up a

I now want to create an Ajax post on this action. I tried the following:

                            var evaluatedRecords = [
	                                     {"id": "10672"}
	             var json_parameters = {evaluatedRecords:

	            	  url: 'SearchmarkSelectedArticlesJSON.action',
	            	  cache: false,
	            	  contentType: 'application/json',
	            	  data: JSON.stringify(json_parameters),
	            	  type: "POST"

I believe I need to set-up the JSON interceptor on my action, so I
<action name="SearchmarkSelectedArticlesJSON" class="searchAction"
	<interceptor-ref name="json"/>

The problem is that this interceptor doesn't seem to be using the, so it throws an error when it tries to
instantiate the Record class:

java.lang.InstantiationException: com.bibliovigilance.model.Record
	at java.lang.Class.newInstance(

I also tried removing the Record type in the List ( List
evaluatedRecords). But in this case the JSON deserialization of the
above mentioned ajax call will create a List evaluatedRecords with 1
element, but that element is a Map (I didn't investigate, but I suppose
it'll have id in the key and 10672 in the value).

How would we configure this correctly? Is it possible for the JSON
interceptor to be aware of the If not, what
alternatives do you envision?



  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message