You can subscribe to this list here.
| 2003 |
Jan
|
Feb
(55) |
Mar
(100) |
Apr
(203) |
May
(330) |
Jun
(190) |
Jul
(302) |
Aug
(323) |
Sep
(197) |
Oct
(245) |
Nov
(490) |
Dec
(330) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
(194) |
Feb
(400) |
Mar
(416) |
Apr
(415) |
May
(359) |
Jun
(381) |
Jul
(491) |
Aug
(311) |
Sep
(291) |
Oct
(273) |
Nov
(355) |
Dec
(266) |
| 2005 |
Jan
(306) |
Feb
(303) |
Mar
(520) |
Apr
(346) |
May
(255) |
Jun
(221) |
Jul
(171) |
Aug
(247) |
Sep
(147) |
Oct
(125) |
Nov
(165) |
Dec
(65) |
| 2006 |
Jan
(90) |
Feb
(53) |
Mar
(121) |
Apr
(103) |
May
(113) |
Jun
(103) |
Jul
(104) |
Aug
(67) |
Sep
(78) |
Oct
(82) |
Nov
(78) |
Dec
(70) |
| 2007 |
Jan
(77) |
Feb
(76) |
Mar
(63) |
Apr
(30) |
May
(47) |
Jun
(41) |
Jul
(44) |
Aug
(44) |
Sep
(49) |
Oct
(33) |
Nov
(25) |
Dec
(21) |
| 2008 |
Jan
(45) |
Feb
(13) |
Mar
(15) |
Apr
(12) |
May
(9) |
Jun
(33) |
Jul
(30) |
Aug
(7) |
Sep
(20) |
Oct
(17) |
Nov
(20) |
Dec
(10) |
| 2009 |
Jan
(8) |
Feb
(5) |
Mar
(12) |
Apr
(17) |
May
(19) |
Jun
(97) |
Jul
(77) |
Aug
(33) |
Sep
(24) |
Oct
(41) |
Nov
(16) |
Dec
(32) |
| 2010 |
Jan
(24) |
Feb
(14) |
Mar
(50) |
Apr
(71) |
May
(70) |
Jun
(64) |
Jul
(45) |
Aug
(62) |
Sep
(32) |
Oct
(4) |
Nov
(12) |
Dec
(2) |
| 2011 |
Jan
(1) |
Feb
(3) |
Mar
(4) |
Apr
(3) |
May
(6) |
Jun
(1) |
Jul
(4) |
Aug
(3) |
Sep
(4) |
Oct
(6) |
Nov
(3) |
Dec
(3) |
| 2012 |
Jan
(4) |
Feb
(8) |
Mar
(6) |
Apr
(10) |
May
(2) |
Jun
(3) |
Jul
(11) |
Aug
(10) |
Sep
(4) |
Oct
|
Nov
(1) |
Dec
(1) |
| 2013 |
Jan
(4) |
Feb
(1) |
Mar
(9) |
Apr
(1) |
May
(8) |
Jun
(2) |
Jul
(5) |
Aug
(2) |
Sep
|
Oct
(3) |
Nov
(10) |
Dec
(8) |
| 2014 |
Jan
(3) |
Feb
(12) |
Mar
(9) |
Apr
(12) |
May
(2) |
Jun
|
Jul
(3) |
Aug
(1) |
Sep
(1) |
Oct
(4) |
Nov
|
Dec
(2) |
| 2015 |
Jan
(1) |
Feb
(3) |
Mar
(4) |
Apr
(9) |
May
(2) |
Jun
(2) |
Jul
|
Aug
(2) |
Sep
(7) |
Oct
(9) |
Nov
(7) |
Dec
(9) |
| 2016 |
Jan
(7) |
Feb
(5) |
Mar
(5) |
Apr
(5) |
May
(8) |
Jun
(4) |
Jul
(5) |
Aug
(4) |
Sep
(6) |
Oct
(7) |
Nov
(2) |
Dec
(3) |
| 2017 |
Jan
(7) |
Feb
(8) |
Mar
(7) |
Apr
(3) |
May
(4) |
Jun
(3) |
Jul
(5) |
Aug
(8) |
Sep
(4) |
Oct
(2) |
Nov
(3) |
Dec
|
| 2018 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
| 2019 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
| 2021 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2022 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
| 2024 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
| 2025 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
(2) |
Aug
(5) |
Sep
(2) |
Oct
|
Nov
|
Dec
(1) |
| 2026 |
Jan
(1) |
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Colin S. <col...@ex...> - 2006-07-29 00:35:55
|
We need to maintain the same semantics as Hibernate here. It would introduce massive confusion if it behaved differently. And indeed, if the object is marked as lazy (to be proxied), load() from Hibernate will happily return a prox for an object which doesn't exist, throwing an exception only when you try to use the object. This was actually an unbelievably bad design decision on their part, as it makes the "throws exception on non-existence" part completely unreliable if you think somebody is going to turn on proxying for the objects, but anyway... On 7/26/2006 4:18 AM, Colin Yates wrote: > Actually, althought the javadoc doesn't explicitly mention it (and is > quite badly worded actually) load won't hit the database if your class > is proxied. This is mentioned in the reference documentation (section > 10.3) and is encapsulated in the > org.hibernate.event.def.DefaultLoadEventListener. > > Given these semantics are defined by Hibernate I am not really sure > that Spring should change the behaviour as it would quite unintuitive. > > To our original question, I believe even if the class *is* lazy > loaded, load would still hit the database to confirm identity but that > is an assumption and I haven't traced it through to verify that > behaviour. The Javadocs do make it clear that load should only be > used for known persistent objects, if in doubt, use get. > > Col > > P.S. I think I will write a couple of tests to verify this behaviour > and will get back to you. > > On 26/07/06, *Colin Yates* < col...@gm... > <mailto:col...@gm...>> wrote: > > Hi Bill, > > Hibernate3 only makes relationships lazy by default, not the > class. This is sensible (in my opinion) because most of the time > there is no real reason to load the class in seperate chunks (aka > field groups). I believe that they actually mention in their > documentation that they only support lazy loading of the class in > order to "tick a box" :) > > Also, checking out the hibernate document for the hibernate > Session ( > http://hibernate.org/hib_docs/v3/api/org/hibernate/Session.html#load(java.lang.Class,%20java.io.Serializable) > <http://hibernate.org/hib_docs/v3/api/org/hibernate/Session.html#load%28java.lang.Class,%20java.io.Serializable%29>) > indicates that the load methods *do* check that the object > exists. So hibernate will throw its HibernateException and Spring > will then convert this into one of its own DataAccessException. > > HTH. > > On 26/07/06, *Bill Six* <bil...@ya... > <mailto:bil...@ya...>> wrote: > Hi, > > I have a question about the load() methods on > hibernate3's HibernateTemplate. > > Spring's javadoc for load() say that an exception will > be thrown if the object is not found. However, from > what I understand, Hibernate 3 changed its default > behavior to lazy load all classes. This means that if > you try to load an object with an ID that does not > exist, a Hibernate error is not thrown because you get > a proxy to the object that does not exist. It is only > upon the first method call to that proxy that > Hibernate's ObjectNotFoundException is thrown. I > would think that in Spring's load() methods should > force initilization of that object so that trying to > load an object that does not exist immediately throws > the correct Spring exception. > > I have attached a patch that should do the trick. I > have never made a patch before, nor have I ever looked > through the source of spring or hibernate, so please > excuse any stupid mistakes :-) > > Thanks for a great product, > > Bill Six > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to > share your > opinions on IT & business topics through brief surveys -- and earn > cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > <http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV> > > _______________________________________________ > Springframework-developer mailing list > Spr...@li... > <mailto:Spr...@li...> > https://lists.sourceforge.net/lists/listinfo/springframework-developer > <https://lists.sourceforge.net/lists/listinfo/springframework-developer> > > > > > >------------------------------------------------------------------------ > >------------------------------------------------------------------------- >Take Surveys. Earn Cash. Influence the Future of IT >Join SourceForge.net's Techsay panel and you'll get the chance to share your >opinions on IT & business topics through brief surveys -- and earn cash >http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > >------------------------------------------------------------------------ > >_______________________________________________ >Springframework-developer mailing list >Spr...@li... >https://lists.sourceforge.net/lists/listinfo/springframework-developer > > |
|
From: Colin Y. <col...@gm...> - 2006-07-28 22:06:24
|
Hi Bill, Hibernate3 only makes relationships lazy by default, not the class. This is sensible (in my opinion) because most of the time there is no real reason to load the class in seperate chunks (aka field groups). I believe that they actually mention in their documentation that they only support lazy loading of the class in order to "tick a box" :) Also, checking out the hibernate document for the hibernate Session ( http://hibernate.org/hib_docs/v3/api/org/hibernate/Session.html#load(java.lang.Class,%20java.io.Serializable)) indicates that the load methods *do* check that the object exists. So hibernate will throw its HibernateException and Spring will then convert this into one of its own DataAccessException. HTH. On 26/07/06, Bill Six <bil...@ya...> wrote: > > Hi, > > I have a question about the load() methods on > hibernate3's HibernateTemplate. > > Spring's javadoc for load() say that an exception will > be thrown if the object is not found. However, from > what I understand, Hibernate 3 changed its default > behavior to lazy load all classes. This means that if > you try to load an object with an ID that does not > exist, a Hibernate error is not thrown because you get > a proxy to the object that does not exist. It is only > upon the first method call to that proxy that > Hibernate's ObjectNotFoundException is thrown. I > would think that in Spring's load() methods should > force initilization of that object so that trying to > load an object that does not exist immediately throws > the correct Spring exception. > > I have attached a patch that should do the trick. I > have never made a patch before, nor have I ever looked > through the source of spring or hibernate, so please > excuse any stupid mistakes :-) > > Thanks for a great product, > > Bill Six > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share > your > opinions on IT & business topics through brief surveys -- and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > > _______________________________________________ > Springframework-developer mailing list > Spr...@li... > https://lists.sourceforge.net/lists/listinfo/springframework-developer > > > > |
|
From: Rob H. <ro...@in...> - 2006-07-28 21:34:00
|
I can always add the ability to use the form tags for this if you'd
like :)
I just think the plain HTML works pretty nicely here as well.
Rob
On 26 Jul 2006, at 03:58, Thomas Risberg wrote:
> Colin,
>
> Right, once I actually started thinking about what was happening
> behind the scenes it became obvious that my first approach was
> broken. I have used the ${status.expression} in the past but after
> using the new <form> tags I got spoiled by just specifying the
> path. I like really like the new tags, they are much cleaner in my
> opinion. For my use for a hidden field with a static value there
> is no need to use a tag library as long as I match the name to the
> property.
>
> Thanks,
> Thomas
>
>
>
> On Jul 25, 2006, at 4:39 PM, Colin Yates wrote:
>
>> The spring bind tags are only ever used when rendering the view,
>> not when submitting the data. Basically the spring bind tags just
>> result in HTML which is what the browser resubmits.
>>
>> That being said, if you are using the spring:bind tag then there
>> is a very useful status object which you can use to get the
>> correct name and value:
>>
>> <spring:bind path="command.step">
>> <input type="hidden" name="${status.expression}" value="$
>> {status.value}"/>
>> </spring:bind>
>>
>>
>> On 25/07/06, tho...@tr... <tho...@tr...>
>> wrote:
>> Brendan,
>>
>> Thanks for your help - I think I figured it out.
>>
>> If you look at my original example I had
>>
>> <spring:bind path="command.step">
>> <input type="hidden" name="_step" value="STEP1"/>
>> </spring:bind>
>>
>> The name="_step" did not match the property name so it did not get
>> bound
>> even though the path explicitly names the property. It seemed to
>> me that
>> the path should rule here, but maybe that's not how it's supposed
>> to work.
>>
>> Once I changed it to
>>
>> <spring:bind path="command.step">
>> <input type="hidden" name="step" value="STEP1"/>
>> </spring:bind>
>>
>> it works fine and so does
>>
>> <input type="hidden" name="step" value="STEP1" />
>>
>> They both get bound properly.
>>
>> Thanks,
>> Thomas
>>
>>
>> > Thomas,
>> >
>> > Can you please try this and let us know what the result is:
>> >
>> > <input type="hidden" name="step" value="STEP1" />
>> >
>> > We do this sort of thing all over the place and it works fine. I'm
>> > assuming
>> > here that step is a property on your command object of course.
>> >
>> > Also, you did import the spring tags right? (Just asking as
>> that's the
>> > sort
>> > of thing I forget to do all the time ;-)
>> >
>> > Thanks
>> > Brendan
>> >
>> > On 7/25/06, Matt Sgarlata < mat...@sp...>
>> wrote:
>> >>
>> >> I think you can also do
>> >>
>> >> <input type="hidden" name="command.step " value="<c:out
>> >> value='${command.step}'/>"/>
>> >>
>> >> tho...@tr... wrote:
>> >> > Brendan,
>> >> >
>> >> > That's what I thought too, but the command.step property ends
>> up being
>> >> > null when accessed from the validation code.
>> >> >
>> >> > Thomas
>> >> >
>> >> >> Hi Thomas,
>> >> >>
>> >> >> I don't see why:
>> >> >>
>> >> >> <spring:bind path="command.step">
>> >> >> <input type="hidden" name="${ status.expression}"
>> value="STEP1"/>
>> >> >> </spring:bind>
>> >> >>
>> >> >> wouldn't work or am I misunderstanding your question?
>> >> >>
>> >> >> Brendan
>> >> >>
>> >> >> On 7/25/06, tho...@tr... <tho...@tr...>
>> >> wrote:
>> >> >>> Is there a convenient way to assign a fixed value from a
>> hidden form
>> >> >>> element and have it bound to the command object? I'm using
>> the new
>> >> >>> <form>
>> >> >>> tags.
>> >> >>>
>> >> >>> the <form:hidden> tag does not have a value attribute.
>> >> >>>
>> >> >>> Tried to mix in a <spring:bind> tag but this resulted in the
>> >> preperty
>> >> >>> being set to null on the command object even though it
>> originally
>> >> had
>> >> a
>> >> >>> value pre-assigned when the command object was created.
>> >> >>>
>> >> >>> Can we mix and match <form:> and <spring:bind> tags?
>> >> >>>
>> >> >>> Here is a simplified version of what I'm using:
>> >> >>>
>> >> >>> <h4>New Login Account</h4>
>> >> >>>
>> >> >>> <form:form commandName="command" action="new_user.htm">
>> >> >>> <table>
>> >> >>> <tr>
>> >> >>> <td class="prompt">Login ID:</td><td class="value">
>> >> >>> <form:input path=" user.userName"/>
>> >> >>> </td>
>> >> >>> </tr>
>> >> >>> <tr class="even">
>> >> >>> <td class="prompt">Password:</td><td class="value">
>> >> >>> <form:password path="user.password"/>
>> >> >>> </td>
>> >> >>> <td>Retype Password:</td><td class="value">
>> >> >>> <form:password path="user.retypePassword"/>
>> >> >>> </td>
>> >> >>> </tr>
>> >> >>> </table>
>> >> >>>
>> >> >>> <table>
>> >> >>> <tr>
>> >> >>> <td class="submit"><input name="_eventId_submit"
>> >> type="submit"
>> >> >>> value="NEXT"/></td>
>> >> >>> </tr>
>> >> >>> </table>
>> >> >>>
>> >> >>> <spring:bind path=" command.step">
>> >> >>> <input type="hidden" name="_step" value="STEP1"/>
>> >> >>> </spring:bind>
>> >> >>> <input type="hidden" name="_flowExecutionKey"
>> >> >>> value="${flowExecutionKey}"/>
>> >> >>>
>> >> >>> </form:form>
>> >> >>>
>> >> >>> The "command.step" is the property that I want to be able
>> to set to
>> >> a
>> >> >>> fixed value from the form, like STEP1 in the example.
>> >> >>>
>> >> >>> Thomas
>> >> >>>
>> >> >>>
>> >> >>>
>> >>
>> ---------------------------------------------------------------------
>> ----
>> >> >>> Take Surveys. Earn Cash. Influence the Future of IT
>> >> >>> Join SourceForge.net's Techsay panel and you'll get the
>> chance to
>> >> share
>> >> >>> your
>> >> >>> opinions on IT & business topics through brief surveys --
>> and earn
>> >> cash
>> >> >>>
>> >> http://www.techsay.com/default.php?
>> page=join.php&p=sourceforge&CID=DEVDEV
>> >> >>> _______________________________________________
>> >> >>> Springframework-developer mailing list
>> >> >>> Spr...@li...
>> >> >>> https://lists.sourceforge.net/lists/listinfo/
>> springframework-developer
>> >> >>>
>> >> >>
>> >>
>> ---------------------------------------------------------------------
>> ----
>> >> >> Take Surveys. Earn Cash. Influence the Future of IT
>> >> >> Join SourceForge.net's Techsay panel and you'll get the
>> chance to
>> >> share
>> >> >> your
>> >> >> opinions on IT & business topics through brief surveys --
>> and earn
>> >> cash
>> >> >>
>> >> http://www.techsay.com/default.php?
>> page=join.php&p=sourceforge&CID=DEVDEV_______________________________
>> ________________
>> >> >> Springframework-developer mailing list
>> >> >> Spr...@li...
>> >> >> https://lists.sourceforge.net/lists/listinfo/springframework-
>> developer
>> >> >>
>> >> >
>> >> >
>> >> >
>> >>
>> ---------------------------------------------------------------------
>> ----
>> >> > Take Surveys. Earn Cash. Influence the Future of IT
>> >> > Join SourceForge.net's Techsay panel and you'll get the
>> chance to
>> >> share
>> >> your
>> >> > opinions on IT & business topics through brief surveys -- and
>> earn
>> >> cash
>> >> >
>> >> http://www.techsay.com/default.php?
>> page=join.php&p=sourceforge&CID=DEVDEV
>> >>
>> >>
>> >>
>> ---------------------------------------------------------------------
>> ----
>> >> Take Surveys. Earn Cash. Influence the Future of IT
>> >> Join SourceForge.net's Techsay panel and you'll get the chance
>> to share
>> >> your
>> >> opinions on IT & business topics through brief surveys -- and
>> earn cash
>> >> http://www.techsay.com/default.php?
>> page=join.php&p=sourceforge&CID=DEVDEV
>> >> _______________________________________________
>> >> Springframework-developer mailing list
>> >> Spr...@li...
>> >> https://lists.sourceforge.net/lists/listinfo/springframework-
>> developer
>> >>
>> >
>> ---------------------------------------------------------------------
>> ----
>> > Take Surveys. Earn Cash. Influence the Future of IT
>> > Join SourceForge.net's Techsay panel and you'll get the chance
>> to share
>> > your
>> > opinions on IT & business topics through brief surveys -- and
>> earn cash
>> > http://www.techsay.com/default.php?
>> page=join.php&p=sourceforge&CID=DEVDEV_______________________________
>> ________________
>> > Springframework-developer mailing list
>> > Spr...@li...
>> > https://lists.sourceforge.net/lists/listinfo/springframework-
>> developer
>> >
>>
>>
>> ---------------------------------------------------------------------
>> ----
>> Take Surveys. Earn Cash. Influence the Future of IT
>> Join SourceForge.net's Techsay panel and you'll get the chance to
>> share your
>> opinions on IT & business topics through brief surveys -- and earn
>> cash
>> http://www.techsay.com/default.php?
>> page=join.php&p=sourceforge&CID=DEVDEV
>> _______________________________________________
>> Springframework-developer mailing list
>> Spr...@li...
>> https://lists.sourceforge.net/lists/listinfo/springframework-
>> developer
>>
>> ---------------------------------------------------------------------
>> ----
>> Take Surveys. Earn Cash. Influence the Future of IT
>> Join SourceForge.net's Techsay panel and you'll get the chance to
>> share your
>> opinions on IT & business topics through brief surveys -- and earn
>> cash
>> http://www.techsay.com/default.php?
>> page=join.php&p=sourceforge&CID=DEVDEV_______________________________
>> ________________
>> Springframework-developer mailing list
>> Spr...@li...
>> https://lists.sourceforge.net/lists/listinfo/springframework-
>> developer
>
> ----------------------------------------------------------------------
> ---
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to
> share your
> opinions on IT & business topics through brief surveys -- and earn
> cash
> http://www.techsay.com/default.php?
> page=join.php&p=sourceforge&CID=DEVDEV________________________________
> _______________
> Springframework-developer mailing list
> Spr...@li...
> https://lists.sourceforge.net/lists/listinfo/springframework-developer
--
Rob Harrop
VP, Technology Strategy
Interface21 - Spring Services from the Source
http://www.springframework.com
|
|
From: Juergen H. <ju...@in...> - 2006-07-28 21:25:30
|
This is indeed a bug - we need to catch IllegalArgumentExceptions and wrap
them in TypeMismatchExceptions there as well. Thanks for pointing this out!
It's fixed in CVS HEAD now; should be available in the next nightly
snapshot.
Juergen
-----Original Message-----
From: spr...@li...
[mailto:spr...@li...] On Behalf
Of Justin Fowler
Sent: Friday, July 14, 2006 9:21 AM
To: spr...@li...
Subject: [Springframework-developer] Possible bug in BeanWrapperImpl
Hi All,
I am using a Map as my form backing object. I am registering a
CustomNumberEditor (see below).
protected void initBinder( HttpServletRequest request,
ServletRequestDataBinder binder ) throws Exception
{
super.initBinder( request, binder ); //To change body of
overridden methods use File | Settings | File Templates.
binder.registerCustomEditor( Long.class, "criteriaMap [justin]",
new CustomNumberEditor( Long.class, true ) );
}
This works fine. If i enter a long value into the field, it gets converted
to a long and stored against the property 'justin' in the map. However if
the data entered into the field is invalid. I get the stack tracked
displayed in my browser as apposed to the nice bind errors I would expect to
see.
After some investigation I found the following. (Code taken from the
BeanWrapperImpl:setPropertyValue(....))
If the propVal is of type list. Then the 'convertIfNecessary' method call
is wrapped in a try/catch block. But for a Map it is not.
Just wondering if this is a bug? If so. How would I go about proving a
patch to fix this problem?
Thanks for your help
Justin Fowler
Hyro Servcies Limited
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job
easier Download IBM WebSphere Application Server v.1.0.1 based on Apache
Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Springframework-developer mailing list
Spr...@li...
https://lists.sourceforge.net/lists/listinfo/springframework-developer
|
|
From: Juergen H. <ju...@in...> - 2006-07-28 21:20:47
|
Interesting suggestion... We usually stick to Hibernate semantics for those methods, that is, do exactly what the Hibernate Session does - just with different exceptions thrown. So in this case, it's recommended to turn Hibernate3's lazy loading off to get an actual loaded object back there. Still, we could consider enforcing initialization ourselves there... Juergen -----Original Message----- From: spr...@li... [mailto:spr...@li...] On Behalf Of Bill Six Sent: Wednesday, July 26, 2006 4:08 AM To: spr...@li... Subject: [Springframework-developer] Question/ potential patch fororg.springframework.orm.hibernate3.HibernateTemplate Hi, I have a question about the load() methods on hibernate3's HibernateTemplate. Spring's javadoc for load() say that an exception will be thrown if the object is not found. However, from what I understand, Hibernate 3 changed its default behavior to lazy load all classes. This means that if you try to load an object with an ID that does not exist, a Hibernate error is not thrown because you get a proxy to the object that does not exist. It is only upon the first method call to that proxy that Hibernate's ObjectNotFoundException is thrown. I would think that in Spring's load() methods should force initilization of that object so that trying to load an object that does not exist immediately throws the correct Spring exception. I have attached a patch that should do the trick. I have never made a patch before, nor have I ever looked through the source of spring or hibernate, so please excuse any stupid mistakes :-) Thanks for a great product, Bill Six __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com |
|
From: Colin Y. <col...@gm...> - 2006-07-28 21:20:26
|
OK, so I learned something today :) Calling session.load (and hibernateTemplate.load) for a single non-final, non-proxied class does *not* hit the database even though the javadocs imply it will, so the loading of the class is (as you original stated) lazy. Marking the class as lazy=false forces hibernate to check that the row exists, but by default it doesn't. If I understand this right, the only time and exception is thrown on session.load is if the class is not lazy..... I still think Spring is doing the right thing in being consistent with Hibernate's behaviour. I learn something new every day :) Sorry for the noise. Col On 26/07/06, Colin Yates <col...@gm...> wrote: > > Actually, althought the javadoc doesn't explicitly mention it (and is > quite badly worded actually) load won't hit the database if your class is > proxied. This is mentioned in the reference documentation (section 10.3) > and is encapsulated in the > org.hibernate.event.def.DefaultLoadEventListener. > > Given these semantics are defined by Hibernate I am not really sure that > Spring should change the behaviour as it would quite unintuitive. > > To our original question, I believe even if the class *is* lazy loaded, > load would still hit the database to confirm identity but that is an > assumption and I haven't traced it through to verify that behaviour. The > Javadocs do make it clear that load should only be used for known persistent > objects, if in doubt, use get. > > Col > > P.S. I think I will write a couple of tests to verify this behaviour and > will get back to you. > > > On 26/07/06, Colin Yates < col...@gm...> wrote: > > > > Hi Bill, > > > > Hibernate3 only makes relationships lazy by default, not the class. > > This is sensible (in my opinion) because most of the time there is no real > > reason to load the class in seperate chunks (aka field groups). I > > believe that they actually mention in their documentation that they only > > support lazy loading of the class in order to "tick a box" :) > > > > Also, checking out the hibernate document for the hibernate Session ( http://hibernate.org/hib_docs/v3/api/org/hibernate/Session.html#load(java.lang.Class,%20java.io.Serializable) > > > > <http://hibernate.org/hib_docs/v3/api/org/hibernate/Session.html#load%28java.lang.Class,%20java.io.Serializable%29>) > > indicates that the load methods *do* check that the object exists. So > > hibernate will throw its HibernateException and Spring will then convert > > this into one of its own DataAccessException. > > > > HTH. > > > > On 26/07/06, Bill Six <bil...@ya...> wrote: > > > > > Hi, > > > > I have a question about the load() methods on > > hibernate3's HibernateTemplate. > > > > Spring's javadoc for load() say that an exception will > > be thrown if the object is not found. However, from > > what I understand, Hibernate 3 changed its default > > behavior to lazy load all classes. This means that if > > you try to load an object with an ID that does not > > exist, a Hibernate error is not thrown because you get > > a proxy to the object that does not exist. It is only > > upon the first method call to that proxy that > > Hibernate's ObjectNotFoundException is thrown. I > > would think that in Spring's load() methods should > > force initilization of that object so that trying to > > load an object that does not exist immediately throws > > the correct Spring exception. > > > > I have attached a patch that should do the trick. I > > have never made a patch before, nor have I ever looked > > through the source of spring or hibernate, so please > > excuse any stupid mistakes :-) > > > > Thanks for a great product, > > > > Bill Six > > > > __________________________________________________ > > Do You Yahoo!? > > Tired of spam? Yahoo! Mail has the best spam protection around > > http://mail.yahoo.com > > > > > > ------------------------------------------------------------------------- > > Take Surveys. Earn Cash. Influence the Future of IT > > Join SourceForge.net's Techsay panel and you'll get the chance to share > > your > > opinions on IT & business topics through brief surveys -- and earn cash > > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > > > > > > _______________________________________________ > > Springframework-developer mailing list > > Spr...@li... > > https://lists.sourceforge.net/lists/listinfo/springframework-developer > > > > > > > > > > > |
|
From: <bu...@in...> - 2006-07-28 21:05:57
|
Snapshot has been uploaded to http://www.springframework.org/snaphots The list of modifications for this build can be found in the build log (http://static.springframework.org/spring/build/index.html). |
|
From: Colin Y. <col...@gm...> - 2006-07-28 20:17:52
|
> Ok cool, thanks for your help - I appreciate it. No need to thank me....I learned something along the way, so thank you ;) I can send you my code that gave me this error if > you'd like. Please. Can you zip up all the files (without the hibernate/spring dependencies) and put them somewhere I/we can download? Thanks, Col > Col > > > > P.S. I think I will write a couple of tests to > > verify this behaviour and > > will get back to you. > > That'd be great. > > Thanks again, > > Bill > > > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share > your > opinions on IT & business topics through brief surveys -- and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Springframework-developer mailing list > Spr...@li... > https://lists.sourceforge.net/lists/listinfo/springframework-developer > |
|
From: <bu...@in...> - 2006-07-28 19:30:28
|
Snapshot has been uploaded to http://www.springframework.org/snaphots The list of modifications for this build can be found in the build log (http://static.springframework.org/spring/build/index.html). |
|
From: Bill S. <bil...@ya...> - 2006-07-28 04:36:36
|
Comments inline: --- Colin Yates <col...@gm...> wrote: > Actually, althought the javadoc doesn't explicitly > mention it (and is quite > badly worded actually) load won't hit the database > if your class is proxied. > This is mentioned in the reference documentation > (section 10.3) and is > encapsulated in the > org.hibernate.event.def.DefaultLoadEventListener. > > Given these semantics are defined by Hibernate I am > not really sure that > Spring should change the behaviour as it would quite > unintuitive. > > To our original question, I believe even if the > class *is* lazy loaded, load > would still hit the database to confirm identity but > that is an assumption > and I haven't traced it through to verify that > behaviour. The Javadocs do > make it clear that load should only be used for > known persistent objects, if > in doubt, use get. > Ok cool, thanks for your help - I appreciate it. I can send you my code that gave me this error if you'd like. > Col > > P.S. I think I will write a couple of tests to > verify this behaviour and > will get back to you. That'd be great. Thanks again, Bill __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com |
|
From: <bu...@in...> - 2006-07-28 00:57:08
|
Snapshot has been uploaded to http://www.springframework.org/snaphots The list of modifications for this build can be found in the build log (http://static.springframework.org/spring/build/index.html). |
|
From: <bu...@in...> - 2006-07-27 17:34:53
|
Snapshot has been uploaded to http://www.springframework.org/snaphots The list of modifications for this build can be found in the build log (http://static.springframework.org/spring/build/index.html). |
|
From: Colin Y. <col...@gm...> - 2006-07-27 17:15:16
|
Actually, althought the javadoc doesn't explicitly mention it (and is quite badly worded actually) load won't hit the database if your class is proxied. This is mentioned in the reference documentation (section 10.3) and is encapsulated in the org.hibernate.event.def.DefaultLoadEventListener. Given these semantics are defined by Hibernate I am not really sure that Spring should change the behaviour as it would quite unintuitive. To our original question, I believe even if the class *is* lazy loaded, load would still hit the database to confirm identity but that is an assumption and I haven't traced it through to verify that behaviour. The Javadocs do make it clear that load should only be used for known persistent objects, if in doubt, use get. Col P.S. I think I will write a couple of tests to verify this behaviour and will get back to you. On 26/07/06, Colin Yates <col...@gm...> wrote: > > Hi Bill, > > Hibernate3 only makes relationships lazy by default, not the class. This > is sensible (in my opinion) because most of the time there is no real reason > to load the class in seperate chunks (aka field groups). I believe that > they actually mention in their documentation that they only support lazy > loading of the class in order to "tick a box" :) > > Also, checking out the hibernate document for the hibernate Session ( http://hibernate.org/hib_docs/v3/api/org/hibernate/Session.html#load(java.lang.Class,%20java.io.Serializable) > > <http://hibernate.org/hib_docs/v3/api/org/hibernate/Session.html#load%28java.lang.Class,%20java.io.Serializable%29>) > indicates that the load methods *do* check that the object exists. So > hibernate will throw its HibernateException and Spring will then convert > this into one of its own DataAccessException. > > HTH. > > On 26/07/06, Bill Six <bil...@ya...> wrote: > > > Hi, > > I have a question about the load() methods on > hibernate3's HibernateTemplate. > > Spring's javadoc for load() say that an exception will > be thrown if the object is not found. However, from > what I understand, Hibernate 3 changed its default > behavior to lazy load all classes. This means that if > you try to load an object with an ID that does not > exist, a Hibernate error is not thrown because you get > a proxy to the object that does not exist. It is only > upon the first method call to that proxy that > Hibernate's ObjectNotFoundException is thrown. I > would think that in Spring's load() methods should > force initilization of that object so that trying to > load an object that does not exist immediately throws > the correct Spring exception. > > I have attached a patch that should do the trick. I > have never made a patch before, nor have I ever looked > through the source of spring or hibernate, so please > excuse any stupid mistakes :-) > > Thanks for a great product, > > Bill Six > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share > your > opinions on IT & business topics through brief surveys -- and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > > _______________________________________________ > Springframework-developer mailing list > Spr...@li... > https://lists.sourceforge.net/lists/listinfo/springframework-developer > > > > > |
|
From: Bill S. <bil...@ya...> - 2006-07-26 04:05:53
|
Hi, I have a question about the load() methods on hibernate3's HibernateTemplate. Spring's javadoc for load() say that an exception will be thrown if the object is not found. However, from what I understand, Hibernate 3 changed its default behavior to lazy load all classes. This means that if you try to load an object with an ID that does not exist, a Hibernate error is not thrown because you get a proxy to the object that does not exist. It is only upon the first method call to that proxy that Hibernate's ObjectNotFoundException is thrown. I would think that in Spring's load() methods should force initilization of that object so that trying to load an object that does not exist immediately throws the correct Spring exception. I have attached a patch that should do the trick. I have never made a patch before, nor have I ever looked through the source of spring or hibernate, so please excuse any stupid mistakes :-) Thanks for a great product, Bill Six __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com |
|
From: Thomas R. <tho...@tr...> - 2006-07-26 03:44:59
|
Colin,
Right, once I actually started thinking about what was happening
behind the scenes it became obvious that my first approach was
broken. I have used the ${status.expression} in the past but after
using the new <form> tags I got spoiled by just specifying the
path. I like really like the new tags, they are much cleaner in my
opinion. For my use for a hidden field with a static value there is
no need to use a tag library as long as I match the name to the
property.
Thanks,
Thomas
On Jul 25, 2006, at 4:39 PM, Colin Yates wrote:
> The spring bind tags are only ever used when rendering the view,
> not when submitting the data. Basically the spring bind tags just
> result in HTML which is what the browser resubmits.
>
> That being said, if you are using the spring:bind tag then there is
> a very useful status object which you can use to get the correct
> name and value:
>
> <spring:bind path="command.step">
> <input type="hidden" name="${status.expression}" value="$
> {status.value}"/>
> </spring:bind>
>
>
> On 25/07/06, tho...@tr... <tho...@tr...>
> wrote:
> Brendan,
>
> Thanks for your help - I think I figured it out.
>
> If you look at my original example I had
>
> <spring:bind path="command.step">
> <input type="hidden" name="_step" value="STEP1"/>
> </spring:bind>
>
> The name="_step" did not match the property name so it did not get
> bound
> even though the path explicitly names the property. It seemed to
> me that
> the path should rule here, but maybe that's not how it's supposed
> to work.
>
> Once I changed it to
>
> <spring:bind path="command.step">
> <input type="hidden" name="step" value="STEP1"/>
> </spring:bind>
>
> it works fine and so does
>
> <input type="hidden" name="step" value="STEP1" />
>
> They both get bound properly.
>
> Thanks,
> Thomas
>
>
> > Thomas,
> >
> > Can you please try this and let us know what the result is:
> >
> > <input type="hidden" name="step" value="STEP1" />
> >
> > We do this sort of thing all over the place and it works fine. I'm
> > assuming
> > here that step is a property on your command object of course.
> >
> > Also, you did import the spring tags right? (Just asking as
> that's the
> > sort
> > of thing I forget to do all the time ;-)
> >
> > Thanks
> > Brendan
> >
> > On 7/25/06, Matt Sgarlata < mat...@sp...>
> wrote:
> >>
> >> I think you can also do
> >>
> >> <input type="hidden" name="command.step " value="<c:out
> >> value='${command.step}'/>"/>
> >>
> >> tho...@tr... wrote:
> >> > Brendan,
> >> >
> >> > That's what I thought too, but the command.step property ends
> up being
> >> > null when accessed from the validation code.
> >> >
> >> > Thomas
> >> >
> >> >> Hi Thomas,
> >> >>
> >> >> I don't see why:
> >> >>
> >> >> <spring:bind path="command.step">
> >> >> <input type="hidden" name="${ status.expression}"
> value="STEP1"/>
> >> >> </spring:bind>
> >> >>
> >> >> wouldn't work or am I misunderstanding your question?
> >> >>
> >> >> Brendan
> >> >>
> >> >> On 7/25/06, tho...@tr... <tho...@tr...>
> >> wrote:
> >> >>> Is there a convenient way to assign a fixed value from a
> hidden form
> >> >>> element and have it bound to the command object? I'm using
> the new
> >> >>> <form>
> >> >>> tags.
> >> >>>
> >> >>> the <form:hidden> tag does not have a value attribute.
> >> >>>
> >> >>> Tried to mix in a <spring:bind> tag but this resulted in the
> >> preperty
> >> >>> being set to null on the command object even though it
> originally
> >> had
> >> a
> >> >>> value pre-assigned when the command object was created.
> >> >>>
> >> >>> Can we mix and match <form:> and <spring:bind> tags?
> >> >>>
> >> >>> Here is a simplified version of what I'm using:
> >> >>>
> >> >>> <h4>New Login Account</h4>
> >> >>>
> >> >>> <form:form commandName="command" action="new_user.htm">
> >> >>> <table>
> >> >>> <tr>
> >> >>> <td class="prompt">Login ID:</td><td class="value">
> >> >>> <form:input path=" user.userName"/>
> >> >>> </td>
> >> >>> </tr>
> >> >>> <tr class="even">
> >> >>> <td class="prompt">Password:</td><td class="value">
> >> >>> <form:password path="user.password"/>
> >> >>> </td>
> >> >>> <td>Retype Password:</td><td class="value">
> >> >>> <form:password path="user.retypePassword"/>
> >> >>> </td>
> >> >>> </tr>
> >> >>> </table>
> >> >>>
> >> >>> <table>
> >> >>> <tr>
> >> >>> <td class="submit"><input name="_eventId_submit"
> >> type="submit"
> >> >>> value="NEXT"/></td>
> >> >>> </tr>
> >> >>> </table>
> >> >>>
> >> >>> <spring:bind path=" command.step">
> >> >>> <input type="hidden" name="_step" value="STEP1"/>
> >> >>> </spring:bind>
> >> >>> <input type="hidden" name="_flowExecutionKey"
> >> >>> value="${flowExecutionKey}"/>
> >> >>>
> >> >>> </form:form>
> >> >>>
> >> >>> The "command.step" is the property that I want to be able to
> set to
> >> a
> >> >>> fixed value from the form, like STEP1 in the example.
> >> >>>
> >> >>> Thomas
> >> >>>
> >> >>>
> >> >>>
> >>
> ----------------------------------------------------------------------
> ---
> >> >>> Take Surveys. Earn Cash. Influence the Future of IT
> >> >>> Join SourceForge.net's Techsay panel and you'll get the
> chance to
> >> share
> >> >>> your
> >> >>> opinions on IT & business topics through brief surveys --
> and earn
> >> cash
> >> >>>
> >> http://www.techsay.com/default.php?
> page=join.php&p=sourceforge&CID=DEVDEV
> >> >>> _______________________________________________
> >> >>> Springframework-developer mailing list
> >> >>> Spr...@li...
> >> >>> https://lists.sourceforge.net/lists/listinfo/springframework-
> developer
> >> >>>
> >> >>
> >>
> ----------------------------------------------------------------------
> ---
> >> >> Take Surveys. Earn Cash. Influence the Future of IT
> >> >> Join SourceForge.net's Techsay panel and you'll get the
> chance to
> >> share
> >> >> your
> >> >> opinions on IT & business topics through brief surveys -- and
> earn
> >> cash
> >> >>
> >> http://www.techsay.com/default.php?
> page=join.php&p=sourceforge&CID=DEVDEV________________________________
> _______________
> >> >> Springframework-developer mailing list
> >> >> Spr...@li...
> >> >> https://lists.sourceforge.net/lists/listinfo/springframework-
> developer
> >> >>
> >> >
> >> >
> >> >
> >>
> ----------------------------------------------------------------------
> ---
> >> > Take Surveys. Earn Cash. Influence the Future of IT
> >> > Join SourceForge.net's Techsay panel and you'll get the chance to
> >> share
> >> your
> >> > opinions on IT & business topics through brief surveys -- and
> earn
> >> cash
> >> >
> >> http://www.techsay.com/default.php?
> page=join.php&p=sourceforge&CID=DEVDEV
> >>
> >>
> >>
> ----------------------------------------------------------------------
> ---
> >> Take Surveys. Earn Cash. Influence the Future of IT
> >> Join SourceForge.net's Techsay panel and you'll get the chance
> to share
> >> your
> >> opinions on IT & business topics through brief surveys -- and
> earn cash
> >> http://www.techsay.com/default.php?
> page=join.php&p=sourceforge&CID=DEVDEV
> >> _______________________________________________
> >> Springframework-developer mailing list
> >> Spr...@li...
> >> https://lists.sourceforge.net/lists/listinfo/springframework-
> developer
> >>
> >
> ----------------------------------------------------------------------
> ---
> > Take Surveys. Earn Cash. Influence the Future of IT
> > Join SourceForge.net's Techsay panel and you'll get the chance to
> share
> > your
> > opinions on IT & business topics through brief surveys -- and
> earn cash
> > http://www.techsay.com/default.php?
> page=join.php&p=sourceforge&CID=DEVDEV________________________________
> _______________
> > Springframework-developer mailing list
> > Spr...@li...
> > https://lists.sourceforge.net/lists/listinfo/springframework-
> developer
> >
>
>
> ----------------------------------------------------------------------
> ---
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to
> share your
> opinions on IT & business topics through brief surveys -- and earn
> cash
> http://www.techsay.com/default.php?
> page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Springframework-developer mailing list
> Spr...@li...
> https://lists.sourceforge.net/lists/listinfo/springframework-developer
>
> ----------------------------------------------------------------------
> ---
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to
> share your
> opinions on IT & business topics through brief surveys -- and earn
> cash
> http://www.techsay.com/default.php?
> page=join.php&p=sourceforge&CID=DEVDEV________________________________
> _______________
> Springframework-developer mailing list
> Spr...@li...
> https://lists.sourceforge.net/lists/listinfo/springframework-developer
|
|
From: Colin Y. <col...@gm...> - 2006-07-25 21:58:22
|
The spring bind tags are only ever used when rendering the view, not when
submitting the data. Basically the spring bind tags just result in HTML
which is what the browser resubmits.
That being said, if you are using the spring:bind tag then there is a very
useful status object which you can use to get the correct name and value:
<spring:bind path="command.step">
<input type="hidden" name="${status.expression}" value="${status.value
}"/>
</spring:bind>
On 25/07/06, tho...@tr... <tho...@tr...> wrote:
>
> Brendan,
>
> Thanks for your help - I think I figured it out.
>
> If you look at my original example I had
>
> <spring:bind path="command.step">
> <input type="hidden" name="_step" value="STEP1"/>
> </spring:bind>
>
> The name="_step" did not match the property name so it did not get bound
> even though the path explicitly names the property. It seemed to me that
> the path should rule here, but maybe that's not how it's supposed to work.
>
> Once I changed it to
>
> <spring:bind path="command.step">
> <input type="hidden" name="step" value="STEP1"/>
> </spring:bind>
>
> it works fine and so does
>
> <input type="hidden" name="step" value="STEP1" />
>
> They both get bound properly.
>
> Thanks,
> Thomas
>
>
> > Thomas,
> >
> > Can you please try this and let us know what the result is:
> >
> > <input type="hidden" name="step" value="STEP1" />
> >
> > We do this sort of thing all over the place and it works fine. I'm
> > assuming
> > here that step is a property on your command object of course.
> >
> > Also, you did import the spring tags right? (Just asking as that's the
> > sort
> > of thing I forget to do all the time ;-)
> >
> > Thanks
> > Brendan
> >
> > On 7/25/06, Matt Sgarlata <mat...@sp...> wrote:
> >>
> >> I think you can also do
> >>
> >> <input type="hidden" name="command.step" value="<c:out
> >> value='${command.step}'/>"/>
> >>
> >> tho...@tr... wrote:
> >> > Brendan,
> >> >
> >> > That's what I thought too, but the command.step property ends up
> being
> >> > null when accessed from the validation code.
> >> >
> >> > Thomas
> >> >
> >> >> Hi Thomas,
> >> >>
> >> >> I don't see why:
> >> >>
> >> >> <spring:bind path="command.step">
> >> >> <input type="hidden" name="${status.expression}" value="STEP1"/>
> >> >> </spring:bind>
> >> >>
> >> >> wouldn't work or am I misunderstanding your question?
> >> >>
> >> >> Brendan
> >> >>
> >> >> On 7/25/06, tho...@tr... <tho...@tr...>
> >> wrote:
> >> >>> Is there a convenient way to assign a fixed value from a hidden
> form
> >> >>> element and have it bound to the command object? I'm using the new
> >> >>> <form>
> >> >>> tags.
> >> >>>
> >> >>> the <form:hidden> tag does not have a value attribute.
> >> >>>
> >> >>> Tried to mix in a <spring:bind> tag but this resulted in the
> >> preperty
> >> >>> being set to null on the command object even though it originally
> >> had
> >> a
> >> >>> value pre-assigned when the command object was created.
> >> >>>
> >> >>> Can we mix and match <form:> and <spring:bind> tags?
> >> >>>
> >> >>> Here is a simplified version of what I'm using:
> >> >>>
> >> >>> <h4>New Login Account</h4>
> >> >>>
> >> >>> <form:form commandName="command" action="new_user.htm">
> >> >>> <table>
> >> >>> <tr>
> >> >>> <td class="prompt">Login ID:</td><td class="value">
> >> >>> <form:input path="user.userName"/>
> >> >>> </td>
> >> >>> </tr>
> >> >>> <tr class="even">
> >> >>> <td class="prompt">Password:</td><td class="value">
> >> >>> <form:password path="user.password"/>
> >> >>> </td>
> >> >>> <td>Retype Password:</td><td class="value">
> >> >>> <form:password path="user.retypePassword"/>
> >> >>> </td>
> >> >>> </tr>
> >> >>> </table>
> >> >>>
> >> >>> <table>
> >> >>> <tr>
> >> >>> <td class="submit"><input name="_eventId_submit"
> >> type="submit"
> >> >>> value="NEXT"/></td>
> >> >>> </tr>
> >> >>> </table>
> >> >>>
> >> >>> <spring:bind path="command.step">
> >> >>> <input type="hidden" name="_step" value="STEP1"/>
> >> >>> </spring:bind>
> >> >>> <input type="hidden" name="_flowExecutionKey"
> >> >>> value="${flowExecutionKey}"/>
> >> >>>
> >> >>> </form:form>
> >> >>>
> >> >>> The "command.step" is the property that I want to be able to set to
> >> a
> >> >>> fixed value from the form, like STEP1 in the example.
> >> >>>
> >> >>> Thomas
> >> >>>
> >> >>>
> >> >>>
> >>
> -------------------------------------------------------------------------
> >> >>> Take Surveys. Earn Cash. Influence the Future of IT
> >> >>> Join SourceForge.net's Techsay panel and you'll get the chance to
> >> share
> >> >>> your
> >> >>> opinions on IT & business topics through brief surveys -- and earn
> >> cash
> >> >>>
> >>
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> >> >>> _______________________________________________
> >> >>> Springframework-developer mailing list
> >> >>> Spr...@li...
> >> >>>
> https://lists.sourceforge.net/lists/listinfo/springframework-developer
> >> >>>
> >> >>
> >>
> -------------------------------------------------------------------------
> >> >> Take Surveys. Earn Cash. Influence the Future of IT
> >> >> Join SourceForge.net's Techsay panel and you'll get the chance to
> >> share
> >> >> your
> >> >> opinions on IT & business topics through brief surveys -- and earn
> >> cash
> >> >>
> >>
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV_______________________________________________
> >> >> Springframework-developer mailing list
> >> >> Spr...@li...
> >> >>
> https://lists.sourceforge.net/lists/listinfo/springframework-developer
> >> >>
> >> >
> >> >
> >> >
> >>
> -------------------------------------------------------------------------
> >> > Take Surveys. Earn Cash. Influence the Future of IT
> >> > Join SourceForge.net's Techsay panel and you'll get the chance to
> >> share
> >> your
> >> > opinions on IT & business topics through brief surveys -- and earn
> >> cash
> >> >
> >>
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> >>
> >>
> >>
> -------------------------------------------------------------------------
> >> Take Surveys. Earn Cash. Influence the Future of IT
> >> Join SourceForge.net's Techsay panel and you'll get the chance to share
> >> your
> >> opinions on IT & business topics through brief surveys -- and earn cash
> >>
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> >> _______________________________________________
> >> Springframework-developer mailing list
> >> Spr...@li...
> >> https://lists.sourceforge.net/lists/listinfo/springframework-developer
> >>
> >
> -------------------------------------------------------------------------
> > Take Surveys. Earn Cash. Influence the Future of IT
> > Join SourceForge.net's Techsay panel and you'll get the chance to share
> > your
> > opinions on IT & business topics through brief surveys -- and earn cash
> >
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV_______________________________________________
> > Springframework-developer mailing list
> > Spr...@li...
> > https://lists.sourceforge.net/lists/listinfo/springframework-developer
> >
>
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share
> your
> opinions on IT & business topics through brief surveys -- and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Springframework-developer mailing list
> Spr...@li...
> https://lists.sourceforge.net/lists/listinfo/springframework-developer
>
|
|
From: Brendan G. <bre...@gm...> - 2006-07-25 21:52:49
|
Oops, I was going to mention that, but assumed that the $(status.expression}
would fix it. In spring using an _propertyName for a checkbox usually sets
the value to false. I just looked at WebDataBinder and it looks like it was
actually being caused by the underscore. Here is the snippet of code from
WebDataBinder that was setting it to null:
protected void checkFieldMarkers(MutablePropertyValues mpvs) {
if (getFieldMarkerPrefix() != null) {
String fieldMarkerPrefix = getFieldMarkerPrefix();
PropertyValue[] pvArray = mpvs.getPropertyValues();
for (int i = 0; i < pvArray.length; i++) {
PropertyValue pv = pvArray[i];
if (pv.getName().startsWith(fieldMarkerPrefix)) {
String field = pv.getName().substring(
fieldMarkerPrefix.length());
if (getBeanWrapper().isWritableProperty(field) &&
!mpvs.contains(field)) {
Class fieldType =
getBeanWrapper().getPropertyType(field);
--> WILL DROP THROUGH TO HERE
mpvs.addPropertyValue(field, getEmptyValue(field,
fieldType));
}
}
}
}
}
/**
* Determine an empty value for the specified field.
* <p>Default implementation returns <code>Boolean.FALSE</code>
* for boolean fields and an empty array of array types.
* Else, <code>null</code> is used as default.
* @param field the name of the field
* @param fieldType the type of the field
* @return the empty value (for most fields: null)
*/
protected Object getEmptyValue(String field, Class fieldType) {
if (fieldType != null && boolean.class.equals(fieldType) ||
Boolean.class.equals(fieldType)) {
// Special handling of boolean property.
return Boolean.FALSE;
}
else if (fieldType != null && fieldType.isArray()) {
// Special handling of array property.
return Array.newInstance(fieldType.getComponentType(), 0);
}
else {
// Default value: try null.
<-- THIS WILL PROBABLY BE CALLED
return null;
}
}
}
here is a quick and dirty test case to prove it:
import junit.framework.TestCase;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.web.bind.ServletRequestDataBinder;
public class WebDataBinderTests extends TestCase {
private TestBean testBean;
private MockHttpServletRequest request;
private ServletRequestDataBinder binder;
protected void setUp() {
testBean= new TestBean();
request = new MockHttpServletRequest();
binder = new ServletRequestDataBinder(testBean, "command");
}
public void testBindWithUnderscore() {
request.addParameter("_step", "STEP1");
binder.bind(request);
assertNull(testBean.getStep());
}
public void testBindWithoutUnderscore() {
request.addParameter("step", "STEP1");
binder.bind(request);
assertNotNull(testBean.getStep());
}
private class TestBean {
private String step;
/**
* @return the step
*/
public String getStep() {
return step;
}
/**
* @param step the step to set
*/
public void setStep(String step) {
this.step = step;
}
}
}
On 7/25/06, tho...@tr... <tho...@tr...> wrote:
>
> Brendan,
>
> Thanks for your help - I think I figured it out.
>
> If you look at my original example I had
>
> <spring:bind path="command.step">
> <input type="hidden" name="_step" value="STEP1"/>
> </spring:bind>
>
> The name="_step" did not match the property name so it did not get bound
> even though the path explicitly names the property. It seemed to me that
> the path should rule here, but maybe that's not how it's supposed to work.
>
> Once I changed it to
>
> <spring:bind path="command.step">
> <input type="hidden" name="step" value="STEP1"/>
> </spring:bind>
>
> it works fine and so does
>
> <input type="hidden" name="step" value="STEP1" />
>
> They both get bound properly.
>
> Thanks,
> Thomas
>
>
> > Thomas,
> >
> > Can you please try this and let us know what the result is:
> >
> > <input type="hidden" name="step" value="STEP1" />
> >
> > We do this sort of thing all over the place and it works fine. I'm
> > assuming
> > here that step is a property on your command object of course.
> >
> > Also, you did import the spring tags right? (Just asking as that's the
> > sort
> > of thing I forget to do all the time ;-)
> >
> > Thanks
> > Brendan
> >
> > On 7/25/06, Matt Sgarlata <mat...@sp...> wrote:
> >>
> >> I think you can also do
> >>
> >> <input type="hidden" name="command.step" value="<c:out
> >> value='${command.step}'/>"/>
> >>
> >> tho...@tr... wrote:
> >> > Brendan,
> >> >
> >> > That's what I thought too, but the command.step property ends up
> being
> >> > null when accessed from the validation code.
> >> >
> >> > Thomas
> >> >
> >> >> Hi Thomas,
> >> >>
> >> >> I don't see why:
> >> >>
> >> >> <spring:bind path="command.step">
> >> >> <input type="hidden" name="${status.expression}" value="STEP1"/>
> >> >> </spring:bind>
> >> >>
> >> >> wouldn't work or am I misunderstanding your question?
> >> >>
> >> >> Brendan
> >> >>
> >> >> On 7/25/06, tho...@tr... <tho...@tr...>
> >> wrote:
> >> >>> Is there a convenient way to assign a fixed value from a hidden
> form
> >> >>> element and have it bound to the command object? I'm using the new
> >> >>> <form>
> >> >>> tags.
> >> >>>
> >> >>> the <form:hidden> tag does not have a value attribute.
> >> >>>
> >> >>> Tried to mix in a <spring:bind> tag but this resulted in the
> >> preperty
> >> >>> being set to null on the command object even though it originally
> >> had
> >> a
> >> >>> value pre-assigned when the command object was created.
> >> >>>
> >> >>> Can we mix and match <form:> and <spring:bind> tags?
> >> >>>
> >> >>> Here is a simplified version of what I'm using:
> >> >>>
> >> >>> <h4>New Login Account</h4>
> >> >>>
> >> >>> <form:form commandName="command" action="new_user.htm">
> >> >>> <table>
> >> >>> <tr>
> >> >>> <td class="prompt">Login ID:</td><td class="value">
> >> >>> <form:input path="user.userName"/>
> >> >>> </td>
> >> >>> </tr>
> >> >>> <tr class="even">
> >> >>> <td class="prompt">Password:</td><td class="value">
> >> >>> <form:password path="user.password"/>
> >> >>> </td>
> >> >>> <td>Retype Password:</td><td class="value">
> >> >>> <form:password path="user.retypePassword"/>
> >> >>> </td>
> >> >>> </tr>
> >> >>> </table>
> >> >>>
> >> >>> <table>
> >> >>> <tr>
> >> >>> <td class="submit"><input name="_eventId_submit"
> >> type="submit"
> >> >>> value="NEXT"/></td>
> >> >>> </tr>
> >> >>> </table>
> >> >>>
> >> >>> <spring:bind path="command.step">
> >> >>> <input type="hidden" name="_step" value="STEP1"/>
> >> >>> </spring:bind>
> >> >>> <input type="hidden" name="_flowExecutionKey"
> >> >>> value="${flowExecutionKey}"/>
> >> >>>
> >> >>> </form:form>
> >> >>>
> >> >>> The "command.step" is the property that I want to be able to set to
> >> a
> >> >>> fixed value from the form, like STEP1 in the example.
> >> >>>
> >> >>> Thomas
> >> >>>
> >> >>>
> >> >>>
> >>
> -------------------------------------------------------------------------
> >> >>> Take Surveys. Earn Cash. Influence the Future of IT
> >> >>> Join SourceForge.net's Techsay panel and you'll get the chance to
> >> share
> >> >>> your
> >> >>> opinions on IT & business topics through brief surveys -- and earn
> >> cash
> >> >>>
> >>
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> >> >>> _______________________________________________
> >> >>> Springframework-developer mailing list
> >> >>> Spr...@li...
> >> >>>
> https://lists.sourceforge.net/lists/listinfo/springframework-developer
> >> >>>
> >> >>
> >>
> -------------------------------------------------------------------------
> >> >> Take Surveys. Earn Cash. Influence the Future of IT
> >> >> Join SourceForge.net's Techsay panel and you'll get the chance to
> >> share
> >> >> your
> >> >> opinions on IT & business topics through brief surveys -- and earn
> >> cash
> >> >>
> >>
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV_______________________________________________
> >> >> Springframework-developer mailing list
> >> >> Spr...@li...
> >> >>
> https://lists.sourceforge.net/lists/listinfo/springframework-developer
> >> >>
> >> >
> >> >
> >> >
> >>
> -------------------------------------------------------------------------
> >> > Take Surveys. Earn Cash. Influence the Future of IT
> >> > Join SourceForge.net's Techsay panel and you'll get the chance to
> >> share
> >> your
> >> > opinions on IT & business topics through brief surveys -- and earn
> >> cash
> >> >
> >>
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> >>
> >>
> >>
> -------------------------------------------------------------------------
> >> Take Surveys. Earn Cash. Influence the Future of IT
> >> Join SourceForge.net's Techsay panel and you'll get the chance to share
> >> your
> >> opinions on IT & business topics through brief surveys -- and earn cash
> >>
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> >> _______________________________________________
> >> Springframework-developer mailing list
> >> Spr...@li...
> >> https://lists.sourceforge.net/lists/listinfo/springframework-developer
> >>
> >
> -------------------------------------------------------------------------
> > Take Surveys. Earn Cash. Influence the Future of IT
> > Join SourceForge.net's Techsay panel and you'll get the chance to share
> > your
> > opinions on IT & business topics through brief surveys -- and earn cash
> >
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV_______________________________________________
> > Springframework-developer mailing list
> > Spr...@li...
> > https://lists.sourceforge.net/lists/listinfo/springframework-developer
> >
>
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share
> your
> opinions on IT & business topics through brief surveys -- and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Springframework-developer mailing list
> Spr...@li...
> https://lists.sourceforge.net/lists/listinfo/springframework-developer
>
|
|
From: <tho...@tr...> - 2006-07-25 19:33:11
|
Brendan,
Thanks for your help - I think I figured it out.
If you look at my original example I had
<spring:bind path="command.step">
<input type="hidden" name="_step" value="STEP1"/>
</spring:bind>
The name="_step" did not match the property name so it did not get bound
even though the path explicitly names the property. It seemed to me that
the path should rule here, but maybe that's not how it's supposed to work.
Once I changed it to
<spring:bind path="command.step">
<input type="hidden" name="step" value="STEP1"/>
</spring:bind>
it works fine and so does
<input type="hidden" name="step" value="STEP1" />
They both get bound properly.
Thanks,
Thomas
> Thomas,
>
> Can you please try this and let us know what the result is:
>
> <input type="hidden" name="step" value="STEP1" />
>
> We do this sort of thing all over the place and it works fine. I'm
> assuming
> here that step is a property on your command object of course.
>
> Also, you did import the spring tags right? (Just asking as that's the
> sort
> of thing I forget to do all the time ;-)
>
> Thanks
> Brendan
>
> On 7/25/06, Matt Sgarlata <mat...@sp...> wrote:
>>
>> I think you can also do
>>
>> <input type="hidden" name="command.step" value="<c:out
>> value='${command.step}'/>"/>
>>
>> tho...@tr... wrote:
>> > Brendan,
>> >
>> > That's what I thought too, but the command.step property ends up being
>> > null when accessed from the validation code.
>> >
>> > Thomas
>> >
>> >> Hi Thomas,
>> >>
>> >> I don't see why:
>> >>
>> >> <spring:bind path="command.step">
>> >> <input type="hidden" name="${status.expression}" value="STEP1"/>
>> >> </spring:bind>
>> >>
>> >> wouldn't work or am I misunderstanding your question?
>> >>
>> >> Brendan
>> >>
>> >> On 7/25/06, tho...@tr... <tho...@tr...>
>> wrote:
>> >>> Is there a convenient way to assign a fixed value from a hidden form
>> >>> element and have it bound to the command object? I'm using the new
>> >>> <form>
>> >>> tags.
>> >>>
>> >>> the <form:hidden> tag does not have a value attribute.
>> >>>
>> >>> Tried to mix in a <spring:bind> tag but this resulted in the
>> preperty
>> >>> being set to null on the command object even though it originally
>> had
>> a
>> >>> value pre-assigned when the command object was created.
>> >>>
>> >>> Can we mix and match <form:> and <spring:bind> tags?
>> >>>
>> >>> Here is a simplified version of what I'm using:
>> >>>
>> >>> <h4>New Login Account</h4>
>> >>>
>> >>> <form:form commandName="command" action="new_user.htm">
>> >>> <table>
>> >>> <tr>
>> >>> <td class="prompt">Login ID:</td><td class="value">
>> >>> <form:input path="user.userName"/>
>> >>> </td>
>> >>> </tr>
>> >>> <tr class="even">
>> >>> <td class="prompt">Password:</td><td class="value">
>> >>> <form:password path="user.password"/>
>> >>> </td>
>> >>> <td>Retype Password:</td><td class="value">
>> >>> <form:password path="user.retypePassword"/>
>> >>> </td>
>> >>> </tr>
>> >>> </table>
>> >>>
>> >>> <table>
>> >>> <tr>
>> >>> <td class="submit"><input name="_eventId_submit"
>> type="submit"
>> >>> value="NEXT"/></td>
>> >>> </tr>
>> >>> </table>
>> >>>
>> >>> <spring:bind path="command.step">
>> >>> <input type="hidden" name="_step" value="STEP1"/>
>> >>> </spring:bind>
>> >>> <input type="hidden" name="_flowExecutionKey"
>> >>> value="${flowExecutionKey}"/>
>> >>>
>> >>> </form:form>
>> >>>
>> >>> The "command.step" is the property that I want to be able to set to
>> a
>> >>> fixed value from the form, like STEP1 in the example.
>> >>>
>> >>> Thomas
>> >>>
>> >>>
>> >>>
>> -------------------------------------------------------------------------
>> >>> Take Surveys. Earn Cash. Influence the Future of IT
>> >>> Join SourceForge.net's Techsay panel and you'll get the chance to
>> share
>> >>> your
>> >>> opinions on IT & business topics through brief surveys -- and earn
>> cash
>> >>>
>> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>> >>> _______________________________________________
>> >>> Springframework-developer mailing list
>> >>> Spr...@li...
>> >>> https://lists.sourceforge.net/lists/listinfo/springframework-developer
>> >>>
>> >>
>> -------------------------------------------------------------------------
>> >> Take Surveys. Earn Cash. Influence the Future of IT
>> >> Join SourceForge.net's Techsay panel and you'll get the chance to
>> share
>> >> your
>> >> opinions on IT & business topics through brief surveys -- and earn
>> cash
>> >>
>> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV_______________________________________________
>> >> Springframework-developer mailing list
>> >> Spr...@li...
>> >> https://lists.sourceforge.net/lists/listinfo/springframework-developer
>> >>
>> >
>> >
>> >
>> -------------------------------------------------------------------------
>> > Take Surveys. Earn Cash. Influence the Future of IT
>> > Join SourceForge.net's Techsay panel and you'll get the chance to
>> share
>> your
>> > opinions on IT & business topics through brief surveys -- and earn
>> cash
>> >
>> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>>
>>
>> -------------------------------------------------------------------------
>> Take Surveys. Earn Cash. Influence the Future of IT
>> Join SourceForge.net's Techsay panel and you'll get the chance to share
>> your
>> opinions on IT & business topics through brief surveys -- and earn cash
>> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>> _______________________________________________
>> Springframework-developer mailing list
>> Spr...@li...
>> https://lists.sourceforge.net/lists/listinfo/springframework-developer
>>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share
> your
> opinions on IT & business topics through brief surveys -- and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV_______________________________________________
> Springframework-developer mailing list
> Spr...@li...
> https://lists.sourceforge.net/lists/listinfo/springframework-developer
>
|
|
From: Colin Y. <col...@gm...> - 2006-07-25 15:22:38
|
> > If binary data was written directly to the response and then an > exception thrown, I'm not sure what exactly would happen, but if you're > streaming a dynamic image or something like that I'm sure you can safely > assume whether Spring blows up or not that you'll get a bogus response > from the server. The ServletResponse doesn't support using *both* getWriter or getOutputStream, it is one or the other. As you said, if the browser has started receiving, and expecting binary data it would be non-sensical to send html as the content type would all be wrong. |
|
From: Brendan G. <bre...@gm...> - 2006-07-25 15:20:19
|
Thomas,
Can you please try this and let us know what the result is:
<input type="hidden" name="step" value="STEP1" />
We do this sort of thing all over the place and it works fine. I'm assuming
here that step is a property on your command object of course.
Also, you did import the spring tags right? (Just asking as that's the sort
of thing I forget to do all the time ;-)
Thanks
Brendan
On 7/25/06, Matt Sgarlata <mat...@sp...> wrote:
>
> I think you can also do
>
> <input type="hidden" name="command.step" value="<c:out
> value='${command.step}'/>"/>
>
> tho...@tr... wrote:
> > Brendan,
> >
> > That's what I thought too, but the command.step property ends up being
> > null when accessed from the validation code.
> >
> > Thomas
> >
> >> Hi Thomas,
> >>
> >> I don't see why:
> >>
> >> <spring:bind path="command.step">
> >> <input type="hidden" name="${status.expression}" value="STEP1"/>
> >> </spring:bind>
> >>
> >> wouldn't work or am I misunderstanding your question?
> >>
> >> Brendan
> >>
> >> On 7/25/06, tho...@tr... <tho...@tr...> wrote:
> >>> Is there a convenient way to assign a fixed value from a hidden form
> >>> element and have it bound to the command object? I'm using the new
> >>> <form>
> >>> tags.
> >>>
> >>> the <form:hidden> tag does not have a value attribute.
> >>>
> >>> Tried to mix in a <spring:bind> tag but this resulted in the preperty
> >>> being set to null on the command object even though it originally had
> a
> >>> value pre-assigned when the command object was created.
> >>>
> >>> Can we mix and match <form:> and <spring:bind> tags?
> >>>
> >>> Here is a simplified version of what I'm using:
> >>>
> >>> <h4>New Login Account</h4>
> >>>
> >>> <form:form commandName="command" action="new_user.htm">
> >>> <table>
> >>> <tr>
> >>> <td class="prompt">Login ID:</td><td class="value">
> >>> <form:input path="user.userName"/>
> >>> </td>
> >>> </tr>
> >>> <tr class="even">
> >>> <td class="prompt">Password:</td><td class="value">
> >>> <form:password path="user.password"/>
> >>> </td>
> >>> <td>Retype Password:</td><td class="value">
> >>> <form:password path="user.retypePassword"/>
> >>> </td>
> >>> </tr>
> >>> </table>
> >>>
> >>> <table>
> >>> <tr>
> >>> <td class="submit"><input name="_eventId_submit" type="submit"
> >>> value="NEXT"/></td>
> >>> </tr>
> >>> </table>
> >>>
> >>> <spring:bind path="command.step">
> >>> <input type="hidden" name="_step" value="STEP1"/>
> >>> </spring:bind>
> >>> <input type="hidden" name="_flowExecutionKey"
> >>> value="${flowExecutionKey}"/>
> >>>
> >>> </form:form>
> >>>
> >>> The "command.step" is the property that I want to be able to set to a
> >>> fixed value from the form, like STEP1 in the example.
> >>>
> >>> Thomas
> >>>
> >>>
> >>>
> -------------------------------------------------------------------------
> >>> Take Surveys. Earn Cash. Influence the Future of IT
> >>> Join SourceForge.net's Techsay panel and you'll get the chance to
> share
> >>> your
> >>> opinions on IT & business topics through brief surveys -- and earn
> cash
> >>>
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> >>> _______________________________________________
> >>> Springframework-developer mailing list
> >>> Spr...@li...
> >>> https://lists.sourceforge.net/lists/listinfo/springframework-developer
> >>>
> >>
> -------------------------------------------------------------------------
> >> Take Surveys. Earn Cash. Influence the Future of IT
> >> Join SourceForge.net's Techsay panel and you'll get the chance to share
> >> your
> >> opinions on IT & business topics through brief surveys -- and earn cash
> >>
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV_______________________________________________
> >> Springframework-developer mailing list
> >> Spr...@li...
> >> https://lists.sourceforge.net/lists/listinfo/springframework-developer
> >>
> >
> >
> >
> -------------------------------------------------------------------------
> > Take Surveys. Earn Cash. Influence the Future of IT
> > Join SourceForge.net's Techsay panel and you'll get the chance to share
> your
> > opinions on IT & business topics through brief surveys -- and earn cash
> >
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share
> your
> opinions on IT & business topics through brief surveys -- and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Springframework-developer mailing list
> Spr...@li...
> https://lists.sourceforge.net/lists/listinfo/springframework-developer
>
|
|
From: Matt S. <mat...@sp...> - 2006-07-25 15:12:18
|
I think you can also do
<input type="hidden" name="command.step" value="<c:out
value='${command.step}'/>"/>
tho...@tr... wrote:
> Brendan,
>
> That's what I thought too, but the command.step property ends up being
> null when accessed from the validation code.
>
> Thomas
>
>> Hi Thomas,
>>
>> I don't see why:
>>
>> <spring:bind path="command.step">
>> <input type="hidden" name="${status.expression}" value="STEP1"/>
>> </spring:bind>
>>
>> wouldn't work or am I misunderstanding your question?
>>
>> Brendan
>>
>> On 7/25/06, tho...@tr... <tho...@tr...> wrote:
>>> Is there a convenient way to assign a fixed value from a hidden form
>>> element and have it bound to the command object? I'm using the new
>>> <form>
>>> tags.
>>>
>>> the <form:hidden> tag does not have a value attribute.
>>>
>>> Tried to mix in a <spring:bind> tag but this resulted in the preperty
>>> being set to null on the command object even though it originally had a
>>> value pre-assigned when the command object was created.
>>>
>>> Can we mix and match <form:> and <spring:bind> tags?
>>>
>>> Here is a simplified version of what I'm using:
>>>
>>> <h4>New Login Account</h4>
>>>
>>> <form:form commandName="command" action="new_user.htm">
>>> <table>
>>> <tr>
>>> <td class="prompt">Login ID:</td><td class="value">
>>> <form:input path="user.userName"/>
>>> </td>
>>> </tr>
>>> <tr class="even">
>>> <td class="prompt">Password:</td><td class="value">
>>> <form:password path="user.password"/>
>>> </td>
>>> <td>Retype Password:</td><td class="value">
>>> <form:password path="user.retypePassword"/>
>>> </td>
>>> </tr>
>>> </table>
>>>
>>> <table>
>>> <tr>
>>> <td class="submit"><input name="_eventId_submit" type="submit"
>>> value="NEXT"/></td>
>>> </tr>
>>> </table>
>>>
>>> <spring:bind path="command.step">
>>> <input type="hidden" name="_step" value="STEP1"/>
>>> </spring:bind>
>>> <input type="hidden" name="_flowExecutionKey"
>>> value="${flowExecutionKey}"/>
>>>
>>> </form:form>
>>>
>>> The "command.step" is the property that I want to be able to set to a
>>> fixed value from the form, like STEP1 in the example.
>>>
>>> Thomas
>>>
>>>
>>> -------------------------------------------------------------------------
>>> Take Surveys. Earn Cash. Influence the Future of IT
>>> Join SourceForge.net's Techsay panel and you'll get the chance to share
>>> your
>>> opinions on IT & business topics through brief surveys -- and earn cash
>>> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>>> _______________________________________________
>>> Springframework-developer mailing list
>>> Spr...@li...
>>> https://lists.sourceforge.net/lists/listinfo/springframework-developer
>>>
>> -------------------------------------------------------------------------
>> Take Surveys. Earn Cash. Influence the Future of IT
>> Join SourceForge.net's Techsay panel and you'll get the chance to share
>> your
>> opinions on IT & business topics through brief surveys -- and earn cash
>> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV_______________________________________________
>> Springframework-developer mailing list
>> Spr...@li...
>> https://lists.sourceforge.net/lists/listinfo/springframework-developer
>>
>
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys -- and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
|
|
From: Matt S. <mat...@sp...> - 2006-07-25 15:10:13
|
I did some testing with a controller that wrote directly to the response (using response.getWriter()) and then threw an exception. This caused my global HandlerExceptionResolver to kick in, and Spring happily continued and appended my error view to the end of the response. That behavior is probably just fine the way it is now. If binary data was written directly to the response and then an exception thrown, I'm not sure what exactly would happen, but if you're streaming a dynamic image or something like that I'm sure you can safely assume whether Spring blows up or not that you'll get a bogus response from the server. I would love to see a new HandlerExceptionResolver.resolveViewException(request, response, handler, exception) method added. I think there should also be a HandlerExceptionResolver.postProcessException method that allows for the implementation of logic that is common to both controller and view exception handling. Matt Juergen Hoeller wrote: > HandlerInterceptor has actually been around for years, so I'm afraid it's > not as easy to rename. I'm not too bothered with the present name either, > though. > > I'm still open to adding a view exception callback to > HandlerExceptionResolver. You do have a point that if we have > afterCompletion in HandlerInterceptor, we can just as well add a > resolveViewException method (or the like) to HandlerExceptionResolver. > > One further issue to consider here is that a handler is actually allowed to > write the view to the response directly and return null as ModelAndView. The > present HandlerExceptionResolver can't forward to an error view here either, > similar to the situation of an exception during JSP rendering. > > Juergen |
|
From: <tho...@tr...> - 2006-07-25 15:06:27
|
Brendan,
That's what I thought too, but the command.step property ends up being
null when accessed from the validation code.
Thomas
> Hi Thomas,
>
> I don't see why:
>
> <spring:bind path="command.step">
> <input type="hidden" name="${status.expression}" value="STEP1"/>
> </spring:bind>
>
> wouldn't work or am I misunderstanding your question?
>
> Brendan
>
> On 7/25/06, tho...@tr... <tho...@tr...> wrote:
>>
>> Is there a convenient way to assign a fixed value from a hidden form
>> element and have it bound to the command object? I'm using the new
>> <form>
>> tags.
>>
>> the <form:hidden> tag does not have a value attribute.
>>
>> Tried to mix in a <spring:bind> tag but this resulted in the preperty
>> being set to null on the command object even though it originally had a
>> value pre-assigned when the command object was created.
>>
>> Can we mix and match <form:> and <spring:bind> tags?
>>
>> Here is a simplified version of what I'm using:
>>
>> <h4>New Login Account</h4>
>>
>> <form:form commandName="command" action="new_user.htm">
>> <table>
>> <tr>
>> <td class="prompt">Login ID:</td><td class="value">
>> <form:input path="user.userName"/>
>> </td>
>> </tr>
>> <tr class="even">
>> <td class="prompt">Password:</td><td class="value">
>> <form:password path="user.password"/>
>> </td>
>> <td>Retype Password:</td><td class="value">
>> <form:password path="user.retypePassword"/>
>> </td>
>> </tr>
>> </table>
>>
>> <table>
>> <tr>
>> <td class="submit"><input name="_eventId_submit" type="submit"
>> value="NEXT"/></td>
>> </tr>
>> </table>
>>
>> <spring:bind path="command.step">
>> <input type="hidden" name="_step" value="STEP1"/>
>> </spring:bind>
>> <input type="hidden" name="_flowExecutionKey"
>> value="${flowExecutionKey}"/>
>>
>> </form:form>
>>
>> The "command.step" is the property that I want to be able to set to a
>> fixed value from the form, like STEP1 in the example.
>>
>> Thomas
>>
>>
>> -------------------------------------------------------------------------
>> Take Surveys. Earn Cash. Influence the Future of IT
>> Join SourceForge.net's Techsay panel and you'll get the chance to share
>> your
>> opinions on IT & business topics through brief surveys -- and earn cash
>> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>> _______________________________________________
>> Springframework-developer mailing list
>> Spr...@li...
>> https://lists.sourceforge.net/lists/listinfo/springframework-developer
>>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share
> your
> opinions on IT & business topics through brief surveys -- and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV_______________________________________________
> Springframework-developer mailing list
> Spr...@li...
> https://lists.sourceforge.net/lists/listinfo/springframework-developer
>
|
|
From: Brendan G. <bre...@gm...> - 2006-07-25 15:00:23
|
Hi Thomas,
I don't see why:
<spring:bind path="command.step">
<input type="hidden" name="${status.expression}" value="STEP1"/>
</spring:bind>
wouldn't work or am I misunderstanding your question?
Brendan
On 7/25/06, tho...@tr... <tho...@tr...> wrote:
>
> Is there a convenient way to assign a fixed value from a hidden form
> element and have it bound to the command object? I'm using the new <form>
> tags.
>
> the <form:hidden> tag does not have a value attribute.
>
> Tried to mix in a <spring:bind> tag but this resulted in the preperty
> being set to null on the command object even though it originally had a
> value pre-assigned when the command object was created.
>
> Can we mix and match <form:> and <spring:bind> tags?
>
> Here is a simplified version of what I'm using:
>
> <h4>New Login Account</h4>
>
> <form:form commandName="command" action="new_user.htm">
> <table>
> <tr>
> <td class="prompt">Login ID:</td><td class="value">
> <form:input path="user.userName"/>
> </td>
> </tr>
> <tr class="even">
> <td class="prompt">Password:</td><td class="value">
> <form:password path="user.password"/>
> </td>
> <td>Retype Password:</td><td class="value">
> <form:password path="user.retypePassword"/>
> </td>
> </tr>
> </table>
>
> <table>
> <tr>
> <td class="submit"><input name="_eventId_submit" type="submit"
> value="NEXT"/></td>
> </tr>
> </table>
>
> <spring:bind path="command.step">
> <input type="hidden" name="_step" value="STEP1"/>
> </spring:bind>
> <input type="hidden" name="_flowExecutionKey"
> value="${flowExecutionKey}"/>
>
> </form:form>
>
> The "command.step" is the property that I want to be able to set to a
> fixed value from the form, like STEP1 in the example.
>
> Thomas
>
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share
> your
> opinions on IT & business topics through brief surveys -- and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Springframework-developer mailing list
> Spr...@li...
> https://lists.sourceforge.net/lists/listinfo/springframework-developer
>
|
|
From: Matt S. <mat...@sp...> - 2006-07-25 14:55:38
|
Couldn't you just use
<input type="hidden" name="myName" value="myValue"/> ?
You wouldn't get much benefit out of using the <form> tag library for a
constant value like that anyway.
Matt
tho...@tr... wrote:
> Is there a convenient way to assign a fixed value from a hidden form
> element and have it bound to the command object? I'm using the new <form>
> tags.
>
> the <form:hidden> tag does not have a value attribute.
>
> Tried to mix in a <spring:bind> tag but this resulted in the preperty
> being set to null on the command object even though it originally had a
> value pre-assigned when the command object was created.
>
> Can we mix and match <form:> and <spring:bind> tags?
>
> Here is a simplified version of what I'm using:
>
> <h4>New Login Account</h4>
>
> <form:form commandName="command" action="new_user.htm">
> <table>
> <tr>
> <td class="prompt">Login ID:</td><td class="value">
> <form:input path="user.userName"/>
> </td>
> </tr>
> <tr class="even">
> <td class="prompt">Password:</td><td class="value">
> <form:password path="user.password"/>
> </td>
> <td>Retype Password:</td><td class="value">
> <form:password path="user.retypePassword"/>
> </td>
> </tr>
> </table>
>
> <table>
> <tr>
> <td class="submit"><input name="_eventId_submit" type="submit"
> value="NEXT"/></td>
> </tr>
> </table>
>
> <spring:bind path="command.step">
> <input type="hidden" name="_step" value="STEP1"/>
> </spring:bind>
> <input type="hidden" name="_flowExecutionKey" value="${flowExecutionKey}"/>
>
> </form:form>
>
> The "command.step" is the property that I want to be able to set to a
> fixed value from the form, like STEP1 in the example.
>
> Thomas
>
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys -- and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
|