Solved

invoking one line of jsp from javascript

Posted on 2006-11-13
6
254 Views
Last Modified: 2010-04-01

Hi all,

Im trying to call a piece of jsp code from within a javascript function like so:

function reset()
{
alert("change made");
<%
session.removeAttribute("value");
%>
}

<html:select property="process" onchange="reset()">

The alert gets called when its supposed to, in that every time I make a change the alert gets displayed. But everytime the user visits the page the line:
session.removeAttribute("value");
gets called when it should be just called when the function reset in invoked.

Any help is greatly appreciated.

Thanks


0
Comment
Question by:ip_packet
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
6 Comments
 
LVL 16

Expert Comment

by:Peter Kwan
ID: 17929401
You cannot do that, since the scriptlet are evaluated on serverside before the page is presented to the client side.
0
 
LVL 16

Accepted Solution

by:
Peter Kwan earned 138 total points
ID: 17929408
One way is to submit a form to the server side and process your statement and then return back to the input page.
0
 

Author Comment

by:ip_packet
ID: 17930180


>>process your statement and then return back to the input page

Do you mean use javascript to re-direct to a jsp page and then do the processing on that page?
0
 
LVL 11

Assisted Solution

by:Manish
Manish earned 137 total points
ID: 17930318
You are not using any servlet ? just submit the form to that servlet or jsp (if you are using jsp) ,remove whatever value you want to remove from session , come back to same page..with values.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A couple of months ago we ran into an issue that necessitated re-creating our Edge Subscriptions. However, when we attempted to execute the command: New-EdgeSubscription -filename C:\NewEdgeSub_01.xml we received an error indicating that the LDAP se…
What do responsible coders do? They don't take detrimental shortcuts. They do take reasonable security precautions, create important automation, implement sufficient logging, fix things they break, and care about users.
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question