function readOnly(count){ }
Don't have an account?
Search for an answer or ask a question of the zone or Customer Support.
You need to sign in to do that
Sign in to start searching questions
Signup for a Developer Edition
Sign in to start a discussion
can anyone explain why this erroe pop'sup
And in your case :
Replace this line of code:
ImageUrl=String.valueOf(socialnetwork);
with this :
ImageUrl=String.valueOf(socialnetwork.name);
May be the problem is due to spelling mistake of Entity Name or if it is a custom object and you are not appending __c to it.
As earlier, I too got this error due to some typing mistake.
public class XmlStreamReaderDemo1 {
public String image1 { get; set; }
public class Image { String name; }
Image[] parsesocialnetwork(XmlStreamReader reader) {
Image[] socialnetwork= new Image[1];
while(reader.hasNext()) {
if (reader.getEventType() == XmlTag.START_ELEMENT) {
if ('Image' == reader.getLocalName()) {
Image image1= parseImages(reader);
socialnetwork.add(image1);
}
reader.next();
return socialnetwork;
Image parseImages(XmlStreamReader reader) {
Image image1= new Image();
if (reader.getEventType() == XmlTag.END_ELEMENT) {
break;
else if (reader.getEventType() == XmlTag.CHARACTERS) {
image1.name = reader.getText();
return image1;
public string ImageUrl{get;set;}
public void action()
{
XmlStreamReaderDemo1 demo = new XmlStreamReaderDemo1();
String str = '<socialnetwork><Image>https://encrypted-tbn2.google.com/images?q=tbn:ANd9GcR6N8xoTIVjKPjpdpvLZjzwrDEAIodzZTpD1ybS-XHZskxE1F0e</Image><socialnetwork>'; XmlStreamReader reader2 = new XmlStreamReader(str);
Image socialnetwork = demo.parseImages(reader2);
System.debug(socialnetwork);
ImageUrl=string.valueof(socialnetwork);
and my VF page is
<apex:page controller="XmlStreamReaderDemo1">
<Apex:form >
<apex:pageBlock >
<apex:commandButton value="Action" action="{!action}" reRender="ImageDisplay"/>
<apex:pageBlockSection >
<apex:outputPanel id="ImageDisplay">
<apex:outputtext value="{!ImageUrl}" />
</apex:outputPanel>
</apex:pageBlockSection>
</apex:pageBlock>
</Apex:form>
</apex:page>
This is my code.....Whenever I call the action command output is
Image:[name=https://encrypted-tbn2.google.com/images?q=tbn:ANd9GcR6N8xoTIVjKPjpdpvLZjzwrDEAIodzZTpD1ybS-XHZskxE1F0e]
So in this my problem is that I dnt want system to get Image and Name values.......Any idea of getting out of this would be very helpful
If you simply want to display an Image on Button click then here is the solution :
In Apex Page :
Replace this
with this
<apex:image value="{!ImageUrl}" />
And in Apex Class :
Assign the URL directly to variable ImageUrl like this :
ImageUrl='https://encrypted-tbn2.google.com/images?q=tbn:ANd9GcR6N8xoTIVjKPjpdpvLZjzwrDEAIodzZTpD1ybS-XHZskxE1F0e';
THANKS A LOT ADITI.......It worked very well.....U helped me alot. thank you sooooooooo much
Thanks Aditi ..
And in your case :
Replace this line of code:
ImageUrl=String.valueOf(socialnetwork);
with this :
ImageUrl=String.valueOf(socialnetwork.name);
All Answers
May be the problem is due to spelling mistake of Entity Name or if it is a custom object and you are not appending __c to it.
As earlier, I too got this error due to some typing mistake.
public class XmlStreamReaderDemo1 {
public String image1 { get; set; }
public class Image { String name; }
Image[] parsesocialnetwork(XmlStreamReader reader) {
Image[] socialnetwork= new Image[1];
while(reader.hasNext()) {
if (reader.getEventType() == XmlTag.START_ELEMENT) {
if ('Image' == reader.getLocalName()) {
Image image1= parseImages(reader);
socialnetwork.add(image1);
}
}
reader.next();
}
return socialnetwork;
}
Image parseImages(XmlStreamReader reader) {
Image image1= new Image();
while(reader.hasNext()) {
if (reader.getEventType() == XmlTag.END_ELEMENT) {
break;
}
else if (reader.getEventType() == XmlTag.CHARACTERS) {
image1.name = reader.getText();
}
reader.next();
}
return image1;
}
public string ImageUrl{get;set;}
public void action()
{
XmlStreamReaderDemo1 demo = new XmlStreamReaderDemo1();
String str = '<socialnetwork><Image>https://encrypted-tbn2.google.com/images?q=tbn:ANd9GcR6N8xoTIVjKPjpdpvLZjzwrDEAIodzZTpD1ybS-XHZskxE1F0e</Image><socialnetwork>'; XmlStreamReader reader2 = new XmlStreamReader(str);
Image socialnetwork = demo.parseImages(reader2);
System.debug(socialnetwork);
ImageUrl=string.valueof(socialnetwork);
}
}
and my VF page is
<apex:page controller="XmlStreamReaderDemo1">
<Apex:form >
<apex:pageBlock >
<apex:commandButton value="Action" action="{!action}" reRender="ImageDisplay"/>
<apex:pageBlockSection >
<apex:outputPanel id="ImageDisplay">
<apex:outputtext value="{!ImageUrl}" />
</apex:outputPanel>
</apex:pageBlockSection>
</apex:pageBlock>
</Apex:form>
</apex:page>
This is my code.....Whenever I call the action command output is
Image:[name=https://encrypted-tbn2.google.com/images?q=tbn:ANd9GcR6N8xoTIVjKPjpdpvLZjzwrDEAIodzZTpD1ybS-XHZskxE1F0e]
So in this my problem is that I dnt want system to get Image and Name values.......Any idea of getting out of this would be very helpful
If you simply want to display an Image on Button click then here is the solution :
In Apex Page :
Replace this
<apex:outputtext value="{!ImageUrl}" />
with this
<apex:image value="{!ImageUrl}" />
And in Apex Class :
Assign the URL directly to variable ImageUrl like this :
ImageUrl='https://encrypted-tbn2.google.com/images?q=tbn:ANd9GcR6N8xoTIVjKPjpdpvLZjzwrDEAIodzZTpD1ybS-XHZskxE1F0e';
And in your case :
Replace this line of code:
ImageUrl=String.valueOf(socialnetwork);
with this :
ImageUrl=String.valueOf(socialnetwork.name);
THANKS A LOT ADITI.......It worked very well.....U helped me alot. thank you sooooooooo much
Thanks Aditi ..