Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

dynamically output a image via struts insted of servlet

843836May 8 2005 — edited May 10 2005
Hello,

I want to know how to dynamically output a image via struts insted of servlet;

I can work it fine with the serverlet, this how i get it to work via serverlet:

java class:

public class ImageServlet extends HttpServlet {


public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
..
..

}
}
in web.xml :

<servlet>
<servlet-name>ImageServlet</servlet-name>
<servlet-class>com.admin.transferform.ImageServlet</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>ImageServlet</servlet-name>
<url-pattern>/ImgServlet</url-pattern>
</servlet-mapping>


and access the pic in[b] jsp :


<img src="/ImgServlet"></img>
<br>
I just want to know, how do i access via struct?


i change the java class to :
public class ImageServlet extends Action {
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
..
..
}
}


and in struts-config.xml :

<action
path="/image"
type="com.admin.transferform.ImageServlet">
</action>

and i have tryed both these in jsp but none did work:

in JSP :
<img src="/image"></img>
or
<html:image src="/image" />

can some one tell me, where did i went wrong pleaseee :)
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 7 2005
Added on May 8 2005
12 comments
351 views