You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Nicolas GENSOLLEN <ng...@seii.fr> on 2005/10/03 11:41:43 UTC
Re: Blob and JSF
Thank you very much Mike, but i don't understand where i should place this :
<sandbox:graphicImageDynamic id="imageDisplay"
rendered="#{viewContentDataPage.isImageContentType}"
getContentTypeMethod="#{viewContentDataPage.content.getContentType}"
getBytesMethod="#{viewContentDataPage.content.contentData.getData}"/>
<h:panelGroup id="textPlainDisplayPanel"
rendered="#{viewContentDataPage.isTextPlainContentType}">
<pre>
<h:outputText id="textPlainDisplay"
value="#{viewContentDataPage.content.contentData.text}"/>
</pre>
</h:panelGroup>
<h:outputText id="htmlPlainDisplay"
rendered="#{viewContentDataPage.isTextHtmlContentType}"
escape="#{false}"
value="#{viewContentDataPage.content.contentData.text}"/>
<h:outputText id="unknownDisplay"
rendered="#{viewContentDataPage.isUnknownContentType}"
value="[Unable to display unknown content type]"/>
In the same page ? In a new page, but where is it called ?
Thank you
----- Original Message -----
From: "Mike Kienenberger" <mk...@gmail.com>
To: "Nicolas GENSOLLEN" <ng...@seii.fr>
Cc: "MyFaces Discussion" <us...@myfaces.apache.org>
Sent: Friday, September 30, 2005 6:30 PM
Subject: Re: Blob and JSF
Ok. That's pretty much what I'm doing too.
I'll post some code snippets.
Here's two ways to pop up a new window. I haven't gotten the
jenia4Faces PopupFrame component working to my satisfaction yet, but
the command link works fine. I'm using something other than _blank
because I want it to always reuse the window rather than recreating a
new one each time.
<h:commandLink id="contentViewButton"
immediate="#{true}"
value="View In New Window"
action="#{editAnnouncementsPage.showContentData}"
target="View Content Data"
/>
<jp:popupFrame id="contentPopupFrame"
immediate="#{true}"
height="450px" width="550px"
center="true"
actionOpen="#{editAnnouncementsPage.showContentData}">
<h:outputText value="View Popup"/>
</jp:popupFrame>
showContentData() looks as follows. viewContentDataPage is a
request-scoped backing bean that will be used by the newly displayed
page. showContentData initializes it with my content to display.
public String showContentData()
{
Content selectedContent =
(Content)this.announcementContentDataList.getRowData();
ValueBinding binding =
FacesContext.getCurrentInstance().getApplication().createValueBinding("#{viewContentDataPage}");
ViewContentData viewContentDataPage =
(ViewContentData)binding.getValue(FacesContext.getCurrentInstance());
viewContentDataPage.setContent(selectedContent);
return "showSelectedContentData";
}
Because viewContentDataPage is request-scoped, I use t:saveState to
preserve the "content" attribute of the viewContentDataPage. This
tag exists on both of my pages. It doesn't matter where you place it.
<t:saveState id="savedSelectedAnnouncementContent"
value="#{viewContentDataPage.content}"/>
Here's the more interesting content types I display now. It's unclear
to me how you'd display some of the more exotic data types (like pdfs)
inline. Instead, you'd probably provide the ability to download the
data.
<sandbox:graphicImageDynamic id="imageDisplay"
rendered="#{viewContentDataPage.isImageContentType}"
getContentTypeMethod="#{viewContentDataPage.content.getContentType}"
getBytesMethod="#{viewContentDataPage.content.contentData.getData}"/>
<h:panelGroup id="textPlainDisplayPanel"
rendered="#{viewContentDataPage.isTextPlainContentType}">
<pre>
<h:outputText id="textPlainDisplay"
value="#{viewContentDataPage.content.contentData.text}"/>
</pre>
</h:panelGroup>
<h:outputText id="htmlPlainDisplay"
rendered="#{viewContentDataPage.isTextHtmlContentType}"
escape="#{false}"
value="#{viewContentDataPage.content.contentData.text}"/>
<h:outputText id="unknownDisplay"
rendered="#{viewContentDataPage.isUnknownContentType}"
value="[Unable to display unknown content type]"/>
On 9/30/05, Nicolas GENSOLLEN <ng...@seii.fr> wrote:
> Mike you are my hero !!!! :))
>
> I want to display a link on a jsf page, by clicking on this link my document
> display in a new page.
>
> I tried using a commandLink component with a target="_blank" but the result
> is not good.
>
> My blog may be an image, a pdf or anyelse other file ....
>
> Thank you for your help !
>
>
> ----- Original Message -----
> From: "Mike Kienenberger" <mk...@gmail.com>
> To: "MyFaces Discussion" <us...@myfaces.apache.org>
> Sent: Friday, September 30, 2005 5:59 PM
> Subject: Re: Blob and JSF
>
>
> I've just finished doing this during the last week, so it can be done.
>
> You'll have to provide more details of what you're trying to do,
> though. There are many different ways to do it.
>
> I use Cayenne to pull the data from the database, and the new sandbox
> graphicImageDynamic component to display image data, and standard
> h:outputText components to display my plain-text and html-text data.
>
> On 9/30/05, Nicolas GENSOLLEN <ng...@seii.fr> wrote:
> >
> > Hello everybody,
> >
> > I've a problem to display a blob in a jsf page, i don't find any way to do
> > it,
> > and I would know if someone succeed doing this ?
> >
> > Thank you !
> >
> > Nicolas Gensollen
> >
>
>
Re: Blob and JSF
Posted by Mike Kienenberger <mk...@gmail.com>.
Place these in your new _blank page.
The commandLink (repeated below) should return a navigation case page
that sends you to this new page. (I changed the target to _blank to
make it more obvious)
<h:commandLink id="contentViewButton"
immediate="#{true}"
value="View In New Window"
action="#{editAnnouncementsPage.showContentData}"
target="_blank" />
On 10/3/05, Nicolas GENSOLLEN <ng...@seii.fr> wrote:
>
> Thank you very much Mike, but i don't understand where i should place this :
>
> <sandbox:graphicImageDynamic id="imageDisplay"
> rendered="#{viewContentDataPage.isImageContentType}"
>
> getContentTypeMethod="#{viewContentDataPage.content.getContentType}"
>
> getBytesMethod="#{viewContentDataPage.content.contentData.getData}"/>
>
> <h:panelGroup id="textPlainDisplayPanel"
> rendered="#{viewContentDataPage.isTextPlainContentType}">
> <pre>
> <h:outputText id="textPlainDisplay"
>
> value="#{viewContentDataPage.content.contentData.text}"/>
> </pre>
> </h:panelGroup>
>
> <h:outputText id="htmlPlainDisplay"
> rendered="#{viewContentDataPage.isTextHtmlContentType}"
> escape="#{false}"
>
> value="#{viewContentDataPage.content.contentData.text}"/>
>
> <h:outputText id="unknownDisplay"
> rendered="#{viewContentDataPage.isUnknownContentType}"
> value="[Unable to display unknown content type]"/>
>
> In the same page ? In a new page, but where is it called ?
>
> Thank you
>
>
> ----- Original Message -----
> From: "Mike Kienenberger" <mk...@gmail.com>
>
> To: "Nicolas GENSOLLEN" <ng...@seii.fr>
> Cc: "MyFaces Discussion" <us...@myfaces.apache.org>
> Sent: Friday, September 30, 2005 6:30 PM
> Subject: Re: Blob and JSF
>
>
> Ok. That's pretty much what I'm doing too.
>
> I'll post some code snippets.
>
> Here's two ways to pop up a new window. I haven't gotten the
> jenia4Faces PopupFrame component working to my satisfaction yet, but
> the command link works fine. I'm using something other than _blank
> because I want it to always reuse the window rather than recreating a
> new one each time.
>
> <h:commandLink id="contentViewButton"
> immediate="#{true}"
> value="View In New Window"
> action="#{editAnnouncementsPage.showContentData}"
> target="View Content Data"
> />
>
> <jp:popupFrame id="contentPopupFrame"
> immediate="#{true}"
> height="450px" width="550px"
> center="true"
> actionOpen="#{editAnnouncementsPage.showContentData}">
> <h:outputText value="View Popup"/>
> </jp:popupFrame>
>
> showContentData() looks as follows. viewContentDataPage is a
> request-scoped backing bean that will be used by the newly displayed
> page. showContentData initializes it with my content to display.
>
> public String showContentData()
> {
> Content selectedContent =
> (Content)this.announcementContentDataList.getRowData();
>
> ValueBinding binding =
> FacesContext.getCurrentInstance().getApplication().createValueBinding("#{viewContentDataPage}");
> ViewContentData viewContentDataPage =
> (ViewContentData)binding.getValue(FacesContext.getCurrentInstance());
> viewContentDataPage.setContent(selectedContent);
>
> return "showSelectedContentData";
> }
>
> Because viewContentDataPage is request-scoped, I use t:saveState to
> preserve the "content" attribute of the viewContentDataPage. This
> tag exists on both of my pages. It doesn't matter where you place it.
>
> <t:saveState id="savedSelectedAnnouncementContent"
> value="#{viewContentDataPage.content}"/>
>
> Here's the more interesting content types I display now. It's unclear
> to me how you'd display some of the more exotic data types (like pdfs)
> inline. Instead, you'd probably provide the ability to download the
> data.
>
> <sandbox:graphicImageDynamic id="imageDisplay"
> rendered="#{viewContentDataPage.isImageContentType}"
>
> getContentTypeMethod="#{viewContentDataPage.content.getContentType}"
>
> getBytesMethod="#{viewContentDataPage.content.contentData.getData}"/>
>
> <h:panelGroup id="textPlainDisplayPanel"
> rendered="#{viewContentDataPage.isTextPlainContentType}">
> <pre>
> <h:outputText id="textPlainDisplay"
>
> value="#{viewContentDataPage.content.contentData.text}"/>
> </pre>
> </h:panelGroup>
>
> <h:outputText id="htmlPlainDisplay"
> rendered="#{viewContentDataPage.isTextHtmlContentType}"
> escape="#{false}"
>
> value="#{viewContentDataPage.content.contentData.text}"/>
>
> <h:outputText id="unknownDisplay"
> rendered="#{viewContentDataPage.isUnknownContentType}"
> value="[Unable to display unknown content type]"/>
>
>
> On 9/30/05, Nicolas GENSOLLEN <ng...@seii.fr> wrote:
> > Mike you are my hero !!!! :))
> >
> > I want to display a link on a jsf page, by clicking on this link my
> document
> > display in a new page.
> >
> > I tried using a commandLink component with a target="_blank" but the
> result
> > is not good.
> >
> > My blog may be an image, a pdf or anyelse other file ....
> >
> > Thank you for your help !
> >
> >
> > ----- Original Message -----
> > From: "Mike Kienenberger" <mk...@gmail.com>
> > To: "MyFaces Discussion" <us...@myfaces.apache.org>
> > Sent: Friday, September 30, 2005 5:59 PM
> > Subject: Re: Blob and JSF
> >
> >
> > I've just finished doing this during the last week, so it can be done.
> >
> > You'll have to provide more details of what you're trying to do,
> > though. There are many different ways to do it.
> >
> > I use Cayenne to pull the data from the database, and the new sandbox
> > graphicImageDynamic component to display image data, and standard
> > h:outputText components to display my plain-text and html-text data.
> >
> > On 9/30/05, Nicolas GENSOLLEN <ng...@seii.fr> wrote:
> > >
> > > Hello everybody,
> > >
> > > I've a problem to display a blob in a jsf page, i don't find any way to
> do
> > > it,
> > > and I would know if someone succeed doing this ?
> > >
> > > Thank you !
> > >
> > > Nicolas Gensollen
> > >
> >
> >