开发者

Java Swt Browser and apostrophe

开发者 https://www.devze.com 2023-01-21 17:04 出处:网络
browser.execute(\"Function(\'\"+ parameter + \"\')\"); I use swt to call a function like above. Using newlines crashed the java.I just found out using apostrophe crashes the browser.
browser.execute("Function('"    + parameter + "')");

I use swt to call a function like above.

Using newlines crashed the java. I just found out using apostrophe crashes the browser.

Is there a better way to do this? So I don't have to worry about handling these characters?

For开发者_StackOverflow社区 example:

browser.executeFunction("Function", parameter);

What other characters might I have to worry about?


What do you mean by crash the java? Do you have a stacktrace?

Did you try by escaping the apostrophe:

browser.execute("Function(\'"    + parameter + "\')");
0

精彩评论

暂无评论...
验证码 换一张
取 消