Hello,
I am new to
Java development, In my project I am creating a profile for the user when they log-in to the system.
I get the general information like name, e-mail and browse (Picture), when they save the profile the detils are saved in the oracle table. But the picture is saved in the server file.
I have written a
Servlet to retive the picture from the file system, I have no idea where should I written the code in the controller to retive the picture.
Here the controller code
if ("viewProfile".equals(mapping.getParameter()))
{
try
{
//
// Get Single user profile details
String pofileshotname = new String(request.getParameter("shotname"));
BVDirectoryDAO bvDirectoryDAO = new BVDirectoryDAO();
Profile bvDirectoryUserInfo = bvDirectoryDAO.getBVDirectoryUserInfo(pofileshotname);
if (bvDirectoryUserInfo != null)
request.setAttribute(Constants.BVDIRECTORY_USERINFO, bvDirectoryUserInfo);
else
return (mapping.findForward("SystemError"));
ProfileDAO virtualAcademyDAO = new ProfileDAO();
Profile virtualAcademy = virtualAcademyDAO.getVAUserProfileInfo(pofileshotname);
request.setAttribute(Constants.CURRENT_VIRTUALACADEMY_USERPROFILE, virtualAcademy);
}
catch (DAOException daoe)
{
System.err.println("Error in retriving Virtual Academy List");
daoe.printStackTrace(System.err);
return (mapping.findForward("SystemError"));
}
//
// Done
return (mapping.findForward("success"));
}
----------------------------------------------
Servelt code
public class RetrieveProfileImage extends HttpServlet
{
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
// Get the absolute path of the image
String pofileshotname = new String(request.getParameter("shotname"));
[ October 27, 2005: Message edited by: Giridhar Gajula ]