Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how to usejsp function in javascript  RSS feed

 
arulraj michaelraj
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all:
> Can anyone please tell me that how I can invoke a Jsp file within the
>body
>of a JavaScript function AND pass an argument to the Jsp file? such as
>
>function(file_obj) {
> Window.location="MyFile.jsp";
>}
>
>I would like the MyFile.jsp to see the variable file_obj, and use it. But I
>don't know how to make this happen.
 
Frederic Filiatrault
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi !
Same thing as your other thread. You cannot mix Server-side (JSP) and client-side (JAVASCRIPT).

For a JavaScript to call JSP, it will only be a regular HTTP request (maybe a new window broswer, like a popup).

To pass a parameter to an other JSP file, you can use the queryString (as long it doesn`t exceed 255 caracters, URL included, then use a POST maybe with input type=hidden to store the info but again, only text in both ways) or stock it in the server side (session, DB,ServletContext) and get it back in you other file. In this case, maybe use a value as a key to fetch a collection of information, it depends.

Can you give more detail on what you want to do ? There`s a lot of possibilities...
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!