Find your content:

Search form

You are here

Simple issue...Need a new line


from the first VF page

string address = address1 + ',' +address2 + ',' +address3;

in the second vf page I'm calling this values as

address = apexpages.currentpage().getparameters().get('address');

Hwncw my values in the URL looks like,test2,test3...But in my vfpage need to display them as

 address   test1

IF I use \n in between the address (say string address = address1 + '\n' +address2) It is taking only the test1 value in the url....Hope this clear..

Attribution to: Eagerin Sf

Possible Suggestion/Solution #1

See what this one does for you:

String multiLineaddress = apexpages.currentpage().getparameters().get('address').replaceAll(',', '\r\n');

You can also experiment with <br/> instead of \n (probably the outputText you have in there will need escape="false" because it will encode this tag).

Or wrapping your output in <pre>...</pre> block.

Attribution to: eyescream

Possible Suggestion/Solution #2

You will need to create a list in your VF Page extension that gets filled by Splitting the parameter you just passed (take a look at String.Split) then in your page you will need to use <apex:repeat> on the list you just created where you can simply use a <br /> in each repeat so that your addresses get displayed on a different line

Attribution to: pjcarly
This content is remixed from stackoverflow or stackexchange. Please visit

My Block Status

My Block Content