Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Applet parameter contains back slash.

When i define either one of the parameters below in a html page which starts the applet:

<param name=testParam value=test\\test> 
<param name=testParam value='test\\test'>

applet.getParameter("testParam") method returns value as "test\\test". In my logic it should return "test\test".(for value=test\test then method returns "test\test") How is this possible? is it something relating to the encoding or something that java handles when it gets output.

like image 694
e13420xx Avatar asked Aug 20 '26 19:08

e13420xx


1 Answers

Java requires back-slashes to be escaped. HTML does not.

E.G.

/* <applet
    code='TestParam'
    width='200'
    height='30'>
<param name='path' value='test\test'>
</applet> */
import javax.swing.*;

public class TestParam extends JApplet {

    public void init() {
        JTextField output = new JTextField(getParameter("path"), 20);
        add(output);
        validate();
    }
}

Result

Applet showing string

like image 75
Andrew Thompson Avatar answered Aug 23 '26 08:08

Andrew Thompson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!