custom view:
public class MyView extends AbstractView {
.... awesome stuff ...
}
controller:
@RequestMapping(value="mylocation")
public ModelAndView dosomething() {
...
modelAndView.setView( new MyView() );
return modelAndView;
}
For some reason this doesn't work... The only view resolver I have is the following:
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"
p:prefix="/WEB-INF/jsp/"
p:suffix=".jsp" >
<property name="exposedContextBeanNames">
<list>
<value>spEnv</value>
</list>
</property>
</bean>
this code doesn't work because it's trying to create some JSP view based on... I'm not sure, the path of my form submission; and there obviously is no JSP view for it, I'm expecting JSON to be returned actually, but for some reason this isn't working, it's just trying to forward me to some JSP, so I'm guessing that I need to specify how to handle this in my XML... but I've seen about 1000 different ways that people return JSON, and all of them are very confusing to me, I'm just looking for the simplest way, so I can take it from there
edit: I added an answer which is a good start, but it allows you to type ".json" after any URL and it will do some really bad things if as the controller I'm not expecting it, so I need to somehow have this view resolver only apply to secured URLs