How to control jsp through javascript function


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: How to control jsp through javascript function

  1. #1
    Join Date
    Apr 2008
    Posts
    1

    Post How to control jsp through javascript function

    i am writing code like this

    function show(i)
    {

    frm.elements[0].value=i;
    alert(frm.elements[0].value);
    <%
    String id1=request.getParameter("h1");

    SetIdentity.setId(ss);
    ss="again";
    %>
    alert("after jsp");
    }


    but the jsp inside <% ...%> is not running when this function show is called. its only running one time
    with the program flow.
    How to do so. that this code only runs when i call show function
    Last edited by shruti; 04-17-2008 at 07:54 AM.

  2. #2
    Join Date
    Mar 2007
    Location
    Bangalore, India
    Posts
    247
    Hi Shruti,

    JSP runs server side. JavaScript runs on client side, after the response has been sent from JSP. If you view the source form the browser, you will see that the JSP tag will have gone. You will have to use other methods (like Ajax) to get data dynamically from the server.

Similar Threads

  1. Replies: 26
    Last Post: 12-01-2012, 05:12 AM
  2. please help me
    By idea2 in forum .NET
    Replies: 7
    Last Post: 02-22-2007, 08:40 PM
  3. Web User Control and javascript
    By s in forum ASP.NET
    Replies: 0
    Last Post: 03-26-2003, 03:17 PM
  4. JavaScript function within XSL
    By Igor in forum XML
    Replies: 1
    Last Post: 01-08-2002, 03:48 PM
  5. Sample Sites.
    By Murray Foxcroft in forum Web
    Replies: 5
    Last Post: 11-02-2000, 03:42 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center