Dyna Image cann't use ViewScoped managedBean

UI Components for JSF
Post Reply
zsuiqiang
Posts: 146
Joined: 13 Sep 2010, 03:52

24 Sep 2011, 04:32

I tried the show case "Dyna Image" .but i found that it cann't use ViewScoped managedBean.
primefaces:jakarta:12.0.0.jar,
primefaces-ext:jakarta:12.0.0.jar,
JSF Mojarra 3.0
glassfish-6.2.5,
netbeans 14
IDEA 2022.2.2
Browser: Edge

zsuiqiang
Posts: 146
Joined: 13 Sep 2010, 03:52

25 Sep 2011, 05:12

I tried sessionScope and requestScope,it work! why didn't it work with viewscoped bean?
primefaces:jakarta:12.0.0.jar,
primefaces-ext:jakarta:12.0.0.jar,
JSF Mojarra 3.0
glassfish-6.2.5,
netbeans 14
IDEA 2022.2.2
Browser: Edge

zsuiqiang
Posts: 146
Joined: 13 Sep 2010, 03:52

27 Sep 2011, 09:49

In my page i use fileupload commponent to upload a image,and use p:graphicImage show the uploaded image by ajax.so my code like this:

Code: Select all

<p:graphicImage id="devPic" value="#{deviceBean.pic}" style="width: 100%"/>
<p:fileUpload fileUploadListener="#{deviceBean.handleFileUpload}" mode="advanced"
                                      update="devPic" sizeLimit="1000000" allowTypes="/(\.|\/)(gif|jpe?g|png)$/"/>	
beanCode like this:

Code: Select all

................
@ViewScoped
public class DeviceBean implements java.io.Serializable
{
      ................
     private StreamedContent  pic;
................
    public StreamedContent getPic()
    {
		if(device.getPic()==null)
		{
			return null;
		}
		pic =new DefaultStreamedContent(new ByteArrayInputStream(device.getPic()));
    }
................
}
But if deviceBean if viewscoped it doesn't works!
primefaces:jakarta:12.0.0.jar,
primefaces-ext:jakarta:12.0.0.jar,
JSF Mojarra 3.0
glassfish-6.2.5,
netbeans 14
IDEA 2022.2.2
Browser: Edge

zsuiqiang
Posts: 146
Joined: 13 Sep 2010, 03:52

21 Oct 2011, 05:05

Shuld i post an issue ?
primefaces:jakarta:12.0.0.jar,
primefaces-ext:jakarta:12.0.0.jar,
JSF Mojarra 3.0
glassfish-6.2.5,
netbeans 14
IDEA 2022.2.2
Browser: Edge

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

21 Oct 2011, 08:15

Just search the forum to see why.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 33 guests