The simplest way to do is to have a hidden field, textbox, on the page and assign the text value of it in jscript.
You can then use tht value in jsp or even in a servlet on form submission.
Bear Bibeault wrote:Then how do you plan to submit the form?
Well there's no submit form, I'm making some operations in a javascript function by clicking on a link. From there I need to parse the result to a jsp page, thats why I needed a textarea.
I hope you understand what I mean
Poor is the man whose pleasures depend on the permission of another.
I agree, i'm new to JSP. I was reading that article just now.
I have only one JSP file, all the operations are made via JavaScript.
This is the core of my JSP page:
Before that core I have put an invisible textarea which will have the result from some calculations. I need to check with JSP if the textarea is empty, if not to write/send that content somewhere. Hope this clears a bit things up.
Thanks.
Poor is the man whose pleasures depend on the permission of another.
Read the article. What you are trying to do is impossible.
The JSP code executes on the server in order to a format an HTML page to send to the client. By the time the HTML is interpreted and the JavaScript executes, the JSP has long since done its job.
I just finished reading the JSP article and now I understand my problem. I guess I'm stuck, I needed to write that result on my server, since JavaScript doesn't allow it. Any sugestions?
Poor is the man whose pleasures depend on the permission of another.
To get data from the client to the server requires an HTTP request. Whether that's a form submission, a link traversal or an Ajax request depends upon the nature of the page and what you want to happen.
If you want it to happen quietly, behind the scenes with no disruption to the page and under JavaScript control, that's what Ajax is for.
Or you might just want to back up a bit and re-evaluate the whole design of the page. Are you doing things the best way, or just trying to hodge-podge? You haven't given us enough context to evaluate.