How to pass JSP implicit objects like (request, response) in Java. I want to access JSP Implicit Objects in Java code. Please suggest how to achieve this?
My Jav
You can pass objects to the bean using
public class SomeBean {
String punchOutRes = null;
HttpServletResponse response;
HttpServletRequest request;
public HttpServletResponse getResponse() {
return response;
}
public void setResponse(HttpServletResponse response) {
this.response = response;
try {
response.getWriter().println("Some Output");
} catch (IOException e) {
e.printStackTrace();
}
}
public HttpServletRequest getRequest() {
return request;
}
public void setRequest(HttpServletRequest request) {
this.request = request;
}
public String getPunchOutRes() {
response.setContentType("text/xml");
return "testing";
}
}
then use in the JSP