Ron McLeod wrote:Since you are specifying that the content is URL-encoded, you should encode it before POSTing it to your servlet with something like ..
llamadaAjax.send('codigo=' + encodeURIComponent(codigo));
Ron McLeod wrote:Right -- I didn't see that in the code - sorry.
I just tried your code with:and I got a result message of SUCCESS and a test.class file created.
I did need to change diagnostic.getMessage(new Locale(null)) to diagnostic.getMessage(null) though to avoid having an exception thrown.
My guess was that you were using some other character which looked exactly the same as a + character. But what you posted was a + character... but maybe you didn't copy and paste the code with the problem? Anyway the next thing I would have tried was some other operator, like for example a - character.
Actually, my guess after that was that some failure in URL-encoding was happening and that the + character was being URL-decoded to a space. Did you try debugging the code and seeing what was actually there? (And why do you need to call toString() on the result of request.getParameter()? Isn't that already a String?)