yes evans i tried what you told i got an error
like java.lang.IllegalStateException: OutputStream already obtained
this is my code
public ActionForward edit(ActionMapping mapping,ActionForm form,
HttpServletRequest req,HttpServletResponse res)throws IOException
{
String toolName=req.getParameter("name");
req.setAttribute("toolName",toolName);
BaseDynaValidatorForm myform =(BaseDynaValidatorForm)form;
CourseTool courseTool1=(CourseTool)courseToolService.edit(toolName);
getActivityState(req).setValue("courseTool",courseTool1);
this.printImage(mapping,form,req,res);
ArrayList groupList = new ArrayList();
groupList.add(new LabelValueBean("public","PUBLIC"));
groupList.add(new LabelValueBean("techingassintant","TEACHING_ASSISTANT"));
groupList.add(new LabelValueBean("proffessor","PROFFESSOR"));
myform.set("courseTool",courseTool1);
myform.set("groupList",groupList);
return mapping.findForward("edittoolform");
}
public ActionForward printImage(ActionMapping mapping,ActionForm form,
HttpServletRequest req,HttpServletResponse res)throws IOException
{
res.setContentType("image/jpg");
String toolName =(String)req.getAttribute("toolName");
HashMap nameImageMap =(HashMap)getActivityState(req).getValue("nameImageMap");
DocumentContent dc=(DocumentContent)nameImageMap.get(toolName);
byte a[]=dc.getContent();
OutputStream os=res.getOutputStream();
os.write(a);
return null;
}
edittoolform in edit method is going to render my image you can see their
i have used a seperate method printImage to print image. apart from that
i dodnt no how to map the <img src= ? > in the jsp in which i have to
display the image .wether i that i have to give my action path
like <img src="coursetool"/>
<action path="/coursetool" type="org.springframework.web.struts.DelegatingActionProxy" name="coursetoolform" scope="request" parameter="method" validate="false">
<forward name="showcoursetoolform" path="coursetoolform"/>
<forward name="edittoolform" path="edittoolform" />
</action>
iam looking for your replies
regards
amir