|
Home > Archive > WebSphere Portal Server > January 2004 > Problem: Portlet to show images stored in database
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Problem: Portlet to show images stored in database
|
|
|
| Hi all,
I have some problem in developing portlet which show photo + some information about it,
also portlet let have update photo. I took problems listed below:
1. portlet can't show images.
I try use actionURI with parameters to get information, but when I wrote in view jsp:
-------- J S P ---------->
<%
PortletURI uri = viewBean.getPhotoURI(); // photoURI it's actionURI
uri.addParameter("photoNumber","1");
%>
<img src='<%=uri.toString()%>
<------- J S P -----
-------- P O R T L E T ---------->
in doView(){
if ( request.getParameter("photoNumber") != null )
{
showPhoto(request,response);
// in showPhoto I set content-type 'image/png' for response and
// divert fetched photo inputStream from database to response outputStream
return;
}
...
}
<-------- P O R T L E T ----------
But I get some exception like "illegal portlet state".
2. Now I try use servlet
I have create servlet, and simply try to show "Hello world", by
clicking on ling published in JSP.
-------- J S P ---------->
<a href='<%=response.encodeURL("/myPhotoServlet")%>'>click to servlet test</a>
<------- J S P -----
But a have 404 error, file not founed.
May be I miss some configuration steps when I had creating servlet?
How can I deal portlet and servlet in one web application? I don'n need invoke servlet in doState or
something else, I simply try to find method which help me show images in portlet with some text... ?
In my work I use WebSphere Studio Site Developer + Test Inviroment of Portal 5.0 for local debug.
If somebody know how to help me, please tell it...
May be I choice wrong method for photo presentertion, how other solve that problem?
P.S. Sorry for my english, it's not my native language...
| |
| Michael Harris 2004-01-19, 3:02 pm |
| Search this newsgroup for posts with the subject:
"Setting content type on PortletResponse object"
Also, when computing the URL to the servlet, don't include the leading "/".
Use this:
response.encodeURL("myPhotoServlet")
|
|
|
|
|