I think you confused with the concept "null" and "" at this point. return null or
not, depends if you have a field with that particular name ( if doesn't care if the
field filled with something or not, as far as you have the named field when you do
summit on a form). So of course, do summit or not, make a diffrent--it has nothing
to do with if it filled with something or just "". You just test if there is a
field named that name, not what value is has.
Brian Slezak wrote:
> > Okay, let's set stage here to make sure we talk about the same thing. What
> > I responded to earlier was what the JSP spec says about calling bean access
> > methods automatically when <jsp:setProperty name="foo" property="*"> is used.
> > This is what I referred to, from section 2.13.2.1:
> >
> > If you set propertyName to * then the tag will iterate over the current
> > ServletRequest parameters, matching parameter names and value type(s) to
> > property names and setter method type(s), setting each matched property to
> > the value of the matching parameter. If a parameter has a value of "", the
> > corresponding property is not modified.
> >
> > If you're talking about something else, such as using request.getParameter()
> > in a scriptlet to manually set a bean property value, then the rules are
> > different. If you call the bean's access method like this, the property will
> > of course be initialized to "". Same thing if you use a <jsp:setProperty>
> > action like this:
> >
> > <jsp:setProperty name="foo" property="bar"
> > value="<%= request.getParameter(\"bar\") %>" />
> >
> > Hans
> > --
> > Hans Bergsten [EMAIL PROTECTED]
> > Gefion Software http://www.gefionsoftware.com
>
> Ok. Well I have tried using the setProperty tag with property="*", but it
> had no effect whether left out or not. What I'm talking about is say you have a
> form, and just hit submit without entering any information in any fields. Take
> this example (assuming you have an accompanying Bean to go with it):
>
> <html>
> <head>
> <title> Test Page </title>
> <jsp:useBean id="bean" scope="session" class="nameBean" > </jsp:useBean>
> <body>
> <p>The property name is null = <%= ( request.getParameter("name") == null ) %>
> </p>
> <form method="get">
> <p>Name:<input type="text" name="name" size="20" value=" <jsp:getProperty
> name="bean" property="name" /> "></p>
> <p><input type="submit" value="Submit" name="submitBtn"><input type="reset"
> value="Reset" name="ResetBtn"></p>
> </form>
> </body>
> </html>
>
> When this page is initially loaded, it will tell you that "The property name
> is null = true". After hitting the submit button with NOTHING in the field, it
> will tell you "The property name is null = false".
>
> Sorry about the confusion. I really need to sit down and read the specs I
> suppose, because I'm curious of when the Bean is created and why I'm having
> trouble initializing Bean properties when it is created. :)
>
> Thanks for you help though,
> Brian
>
> ===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
--
Best Regards,
Yi Liu
Java Programmer
--
Invisible.Ink Corporation
1400 Old Country Road Suite 408
Westbury, NY 11590
Phone: (516) 338 - 5283 Ext.148
Fax: (516) 876 - 8032
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets