Home > Net >  How to pass/append url parameter to all hrefs (links)
How to pass/append url parameter to all hrefs (links)

Time:06-24

I came across this post and hoping you can help as its similar to what I want to do.

Here is my code.

buffer.append("\n\nBe sure to activate your account, if you have not yet done so, by clicking on the "); 

a href= \buffer.append(url).append("activateAccount.do?clientId=").append(client.getId()).append("&activationCode=").append(client.getActivationCode());


if(mobileApplicationType != null)>"here"

I would like to have a link "click here" instead of showing the full url.

Hope you can help.

Thanks

CodePudding user response:

Instead of:

buffer.append(url);

You can do as below:

buffer.append("<a href="\" url  "\" ">Click Here</a>");

CodePudding user response:

buffer.append("\n\nBe sure to activate your account, 
               if you have not yet done so, by clicking on the ");
buffer.append("<a href='"   url   "activateAccount.do?clientId="  client.getId());
buffer.append("&activationCode="   client.getActivationCode()   "'>");
if (mobileApplicationType != null) {
  buffer.append("\"here\"");
}
buffer.append("</a>");

The browsers allows single quote signs for values of attributes so you won't run into conflicts with quotation signs.

  • Related