• infowelders_ns
  • NEWBIE
  • 0 Points
  • Member since 2009

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 3
    Replies
I was thinking along the lines of usage logs, like page hits per hour, what pages were visited, and what operating system, browser, screen resolution, etc.  Is it possible?
Message Edited by infowelders_ns on 10-27-2009 02:26 PM

I am trying to use an Apex Class to dynanamically construct HTML in my company's web page.  The example below makes a good simplified example:

 

 

Apex Class:

public with sharing class web_controller_test {

 

  public String myString = '<a href="http://www.google.com/">Google</a>';

 

public String getNavString() {

return myString;
}

}

 

Force.com Page:

 

<apex:page controller="web_controller_test" standardStyleSheets="false" sidebar="false" showHeader="false" title="Test Page">

<apex:outputPanel id="subnav">
<apex:repeat value="{!NavString}" var="navstring">
{!navstring}
</apex:repeat>
</apex:outputPanel>

</apex:page>

 

The Apex Class has one function that is supposed to return a link to Google.  The SF Sites page calls that function, and the link is supposed to be brought into page code.

 

Except it doesn't.  Instead of returning HTML, it returns the incorrect safe-encoded version:

 

 

Output - What the code spits out:

<body>
&lt;a href="http://www.google.com/"&gt;Google&lt;/a&gt;
</body>

 

 

This is what it's supposed to look like:

 

 

What it should REALLY look like:

<body>
<a href="http://www.google.com/">Google</a>
</body>

 

Does anyone know how to display the actual string, and not the escaped version?

 

~ Nick

I have a very simple web controller that I need to write test code for:

 

 

public class web_controller_testimonial_list {

public list<Testimonial__c> listResults = new list<Testimonial__c>();

public list<Testimonial__c> getTestimonials() {
listResults = [SELECT quote__c, contact_name__c, contact_title__c, account_name__c FROM Testimonial__c WHERE Status__c = 'Published' ORDER BY Quote_Date__c desc];
return listResults;
}

public list<Testimonial__c> fetchTestimonials() {
getTestimonials();
return null;
}

}

 

 

 And really, I suppose it could be scaled down to something a little more simple, for the sake of this post:

 

 

public class web_controller_testimonial_list {

public list<Testimonial__c> getTestimonials() {
listResults = [SELECT quote__c, contact_name__c, contact_title__c, account_name__c FROM Testimonial__c WHERE Status__c = 'Published' ORDER BY Quote_Date__c desc];
return listResults;
}

}

 

 ... actually, I don't even know where to start.  I've been learning as I go, and I'm stumped.  How would I write a test case for something like this?

Thank you,

 

~ Nick

 

Message Edited by infowelders_ns on 09-21-2009 02:28 PM

I am trying to return a string with Apex tags, but the pointy brackets (<, > ) are being encoded to &lt; and &gt;.


    Example:
    public String getNavString() {
        return '<apex: outputLink value="http://www.google.com/">Google</apex: outputLink>';
    }


    Resulting HTML:
    &lt;apex: outputLink value="http://www.google.com/"&gt;Google&lt;/apex: outputLink&gt;

    Expected HTML:
    <apex: outputLink value="http://www.google.com/">Google</apex: outputLink>


  

Is there a way to make sure that the tag characters are not encoded?

Thank you!

~ Nick

Message Edited by infowelders_ns on 08-27-2009 12:23 PM

I have a very simple web controller that I need to write test code for:

 

 

public class web_controller_testimonial_list {

public list<Testimonial__c> listResults = new list<Testimonial__c>();

public list<Testimonial__c> getTestimonials() {
listResults = [SELECT quote__c, contact_name__c, contact_title__c, account_name__c FROM Testimonial__c WHERE Status__c = 'Published' ORDER BY Quote_Date__c desc];
return listResults;
}

public list<Testimonial__c> fetchTestimonials() {
getTestimonials();
return null;
}

}

 

 

 And really, I suppose it could be scaled down to something a little more simple, for the sake of this post:

 

 

public class web_controller_testimonial_list {

public list<Testimonial__c> getTestimonials() {
listResults = [SELECT quote__c, contact_name__c, contact_title__c, account_name__c FROM Testimonial__c WHERE Status__c = 'Published' ORDER BY Quote_Date__c desc];
return listResults;
}

}

 

 ... actually, I don't even know where to start.  I've been learning as I go, and I'm stumped.  How would I write a test case for something like this?

Thank you,

 

~ Nick

 

Message Edited by infowelders_ns on 09-21-2009 02:28 PM

I am trying to return a string with Apex tags, but the pointy brackets (<, > ) are being encoded to &lt; and &gt;.


    Example:
    public String getNavString() {
        return '<apex: outputLink value="http://www.google.com/">Google</apex: outputLink>';
    }


    Resulting HTML:
    &lt;apex: outputLink value="http://www.google.com/"&gt;Google&lt;/apex: outputLink&gt;

    Expected HTML:
    <apex: outputLink value="http://www.google.com/">Google</apex: outputLink>


  

Is there a way to make sure that the tag characters are not encoded?

Thank you!

~ Nick

Message Edited by infowelders_ns on 08-27-2009 12:23 PM