File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes Jsp & Javascript Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Jsp & Javascript" Watch "Jsp & Javascript" New topic
Author

Jsp & Javascript

Sarah Gaikwad
Ranch Hand

Joined: Feb 26, 2004
Posts: 35
I am aware of the fact that a jsp scriptlet can be used with a javascrpt function. for example:
function somename(){
somevariable=<%=jspvariable%>
}
works absolutely fine.
My question is can one assign a javascript value to a jsp variable
could someone help me with an example
Sharun
Nicholas Cheung
Ranch Hand

Joined: Nov 07, 2003
Posts: 4982
Hi Sharun,

My question is can one assign a javascript value to a jsp variable

I dont think JS variables can be assigned to JSP.
JSP variables can assign to JS because, the JS in fact is generated in the server side. And thus, the server side can assign server side variable value to the JS before sending it to the client.
However, the reverse is not true.
At the server side, JS variable contains NO value of the client. (Becos the client does not receive the page yet)
The only way to do this is, you can pass the JS variable as a request, and then send to the JSP as a request parameter, and then assign that value to the JSP variable.
Hope this help.
Nick.


SCJP 1.2, OCP 9i DBA, SCWCD 1.3, SCJP 1.4 (SAI), SCJD 1.4, SCWCD 1.4 (Beta), ICED (IBM 287, IBM 484, IBM 486), SCMAD 1.0 (Beta), SCBCD 1.3, ICSD (IBM 288), ICDBA (IBM 700, IBM 701), SCDJWS, ICSD (IBM 348), OCP 10g DBA (Beta), SCJP 5.0 (Beta), SCJA 1.0 (Beta), MCP(70-270), SCBCD 5.0 (Beta), SCJP 6.0, SCEA for JEE5 (in progress)
 
wood burning stoves
 
subject: Jsp & Javascript
 
Similar Threads
Popup window from action class
jsp and javascript
Call a javascript function from a JSP
parameter from jsp to javascript function?
Can I call a javascript method from JSP