Re: Add an actionListener ActionEvent in jsp



Newbie,

I understand that you're a newbie, as you have missed an important
difference between JSP and "plain" applications.

Im trying to add an actionListener ActionEvent to a submit button in
jsp and don't know how to go about it.

JSP renders HTML-pages to be sent to the browser on the client side, and
responds to requests done to the server. This makes it impossible to add any
meaningful Java-code to be executed on the client-side.

What you usually do, is simply to respond to the submitted request. This
could e.g. be another page, or the same page:

<form method="post" action="somePage.jsp">

....and then in somePage.jsp, handle any parameters you've recieved.

String what = request.getParameter( "literal string of field name");

if ( what.equals("something") ) {

// Do whatever...
}


// Bjorn A



-------------
Get FREE newsgroup access from http://www.cheap56k.com

.


Quantcast