Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

My controller code is as follows -

       for(String resStr : responseArray){
            if(resStr.indexOf('r_error_str') != -1){
                responseString += resStr.substring(resStr.indexOf('=') + 1); 
                responseString += '\n';
            }
        }

but when i display this 'responseString ' String using 'apex:outputLabel or apex:outputText or as Exception message '\n' is not converting in new line. Whole String is coming in one line.

Can anyone explain why is this happining

share|improve this question
add comment

3 Answers 3

up vote 2 down vote accepted

just use <br/> in controller and escape="false" in visualforce text.

share|improve this answer
3  
This does work of course, but if you're looking to publish on the AppExchange the use of escape="false" will be heavily frowned upon (from experience). –  LaceySnr Dec 23 '12 at 0:26
    
It is not working if i set message in user define exception object as message and rending that at visual force page. It is showing <br/> at visual force error message. –  Pramod Kumar Dec 23 '12 at 15:13
add comment

The simple answer is using '\n' will not work in HTML elements as it is just basically white space, google your problem and you'll get lots of results.

Could you possibly 'repeat' in your VF on the responseArray?

share|improve this answer
add comment
  currentAddress = currentStreet;
        currentAddress += '\r\n';
        currentAddress += currentCity + + ' ' + currentState  + ' ' + currentZIP ;
        currentAddress += '\r\n';
        currentAddress += currentCountry;

using the '\r\n' works with outputtext .Please try same

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.