You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by BugRat Mail System <to...@cortexity.com> on 2000/12/31 11:59:43 UTC

BugRat Report #411 - jsp:setProperty doesn't call set methods in beans if params have no value

Report #411 Details

Project: Tomcat
Category: Bug Report
SubCategory: New Bug Report
Class: swbug
State: closed
Priority: medium
Severity: serious
Confidence: public
Environment: 
   Release: Tomcat latest as of Nov 17 (stab
   JVM Release: 1.2
   Operating System: Linux
   OS Release: Suse 7.0
   Platform: ?

Synopsis: 
jsp:setProperty doesn't call set methods in beans if params have no value

Description:
If I have a url like so:

http://localhost:8080/foobar/LoginSubmit.jsp?username=&password=

and then in LoginSubmit.jsp

<jsp:useBean id="loginForm" class="some.class.LoginForm" />
<jsp:setProperty name="loginForm" property="*" />

the setUsername() and setPassword() methods are not called.
If I move the setProperty into the useBean tag, it doesn't help.
Furthermore, if I do
<jsp:setProperty name="loginForm" property="username" value="" />

The set method STILL isn't called.

I can think of no reason for this, but I can think of a good reason to always call it.
Namely, it's nice to know if your bean was initialized fresh or just had a bunch of setProp with empty string values.
Bean implementors can freely ignore empty string if they want to.