I am doing a Java Web Application using Stripes framework where I have a link button which, when clicked, will fetch an image from an object and display it in a new tab. I wish to make it to pop up a window instead of open in new tab. The following is my example code in my JSP:
<s:link beanclass="com.cv.ibs.web.ib.action.payment.BillPaymentAction" event="showSampleBill" >
<fmt:message key ="bp.SampleBill"/>
</s:link>
And the following is my Action file code:
public Resolution showSampleBill() throws Exception {
payeeBO = super.getBO();
if ( payeeBO.getSampleBill( ) != null ) {
return new StreamingResolution( "image/jpg" ) {
public void stream(HttpServletResponse response)
throws Exception {
response.getOutputStream( ).write( payeeBO.getSampleBill( ) );
}
};
} else {
return null;
}
}
I have googled it quite a long time but still can't get a proper solution - maybe I asked wrong question.
My Solution here :
In jsp
file :
Create a img
field with hidden to store the image first, after that, when click on link, it will pull the image.
<s:url event="showSampleBill" beanclass="com.cv.ibs.web.ib.action.payment.BillPaymentAction" var="fUrl">
</s:url>
<img src="${fUrl}" id="sampleBillImage" hidden="true"/>