i need application context path in controller, tried below code throwing nullpointer exception.
httpservletrequest request;
string path = request.getcontextpath();
please me
thanks
variable
request
declared, not initialized. no wondernullpointerexception
.look @ documentation access different request related data.
after read that, , sure want tie code native servlet api, try this:
@controller class mycontroller { @requestmapping public void handleme(httpservletrequest request) { string path = request.getcontextpath(); } }
Comments
Post a Comment