java - pass arithmetic operation with http get request -
i required pass arithmetic operation 2+8 restful back-end , receive result. know simple operation can handled in frontend using javascript, want follow requirement.
i send operations following uri:
http://localhost:8080/?question=2+5 and in back-end have:
@requestmapping("/") public string getanswer(@requestparam("question") string question){ system.out.println("recieved question is: "+question); return botservice.evaluator(question); } when print question 2 3 there no operation there. , component complains with:
javax.script.scriptexception: <eval>:1:2 expected ; found 5 2 5 ^ in <eval> @ line number 1 @ column number 2 so, why the + is missing? , how can fix it?
use urlencoder class make sure special characters encoded safely transport.
Comments
Post a Comment