In your JSP, use request.getRemoteAddr(). This returns the IP address of the agent that sent the request as a String.
Also, request.getRemoteHost() will attempt to get the fully qualified host name. If it can't resolve the name however, the IP address will be returned as in getRemoteAddr().
you can use the following code to uplad image or photo :
You can set the image path as a session attribute once you have uploaded and inserted the path to the database:
session.setAttribute("imagePath", imagePath);
<HTML>
<BODY>
<img src="<%= session.getAttribute("imagePath") %>" />
</BODY>
</HTML>
OR use the following code :
Why you do not try to use session.setAttribute("myImage", image)?
Fetch the client ip address by using the code :
request.getHeader("VIA") --> Gateway
request.getHeader("X-FORWARDED-FOR")--> IPaddress
If forward command not working properly means, try to find out the errors what you have did . after fixing it, you can use forward command .
if you want to get your external ip address by using code , use http://www.ip-details.com/ .