Call a method from JSP without scriplets

Using plain JSP, is there a way to pass inputted values as arguments of a method (of perhaps a bean or utility class) and send it off? Or is this only something that can be done with JSF's backing beans or Struts or some other framework?

An example is a login page that accepts a username and password. How could you actually send those values off somewhere to be checked whether they are correct without having scriplets in the page?

Perhaps tag handlers could do the trick? But is there a way to put something in the "action" attribute of the form element, like in JSF/Struts?

Thanks.

[612 byte] By [lightbulb4321a] at [2007-10-3 11:05:35]
# 1

If you have a JavaBean that looked like this:

package my.pack;

public class UserLogin implement Serializable {

private String name, password;

public UserName() { }

public void setName(String n) { name = n; }

public void setPassword(String p) { password = p; }

public String getName() { return name; }

public String getPassword() { return password; }

}

Then you could use that bean in JSP:

<jsp:useBean id="login" class="my.pack.UserLogin" scope="request">

<jsp:setProperty name="login" property="name" value="My Name"/>

<jsp:setProperty name="login" property="password" value="My Password"/>

</jsp:useBean>

JSTL can do the same thing as the jsp:setProperty tag using the c:set tags. They modify the Bean using the setXXX method, such that setName becomes property="name". You can only pass one parameter to a setXXX method at a time (as per JavaBean standards).

stevejlukea at 2007-7-15 13:28:13 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...