-
1. Re: How to resolve EL expressions in code?
danielc.roth Oct 17, 2008 11:49 PM (in response to x490812)Try something like this
String fullAddress = Interpolator.instance().interpolate("# {AVM_REQUEST_RESPONSE.respParsedHousenumber} #{AVM_REQUEST_RESPONSE.respParsedDirectionprefix} #{AVM_REQUEST_RESPONSE.respParsedStreetname} #{AVM_REQUEST_RESPONSE.respParsedStreetsuffix} #{AVM_REQUEST_RESPONSE.respParsedDirectionsuffix} #{AVM_REQUEST_RESPONSE.respParsedAptorunit}");
I've linebreaked to make it mor readable.
-
2. Re: How to resolve EL expressions in code?
x490812 Oct 19, 2008 12:09 AM (in response to x490812)Can you think of any reason why the interpolator would not work ??? I run it, and get no errors or exceptions, but the value returned is null string. What I found was that the first time I call interpolate, the getters are not called. the next time I call it, they are called and I get the correct values; It works the second time... Is this a bug? here is the code
avmReqResp.setRespParsedHousenumber(hn); avmReqResp.setRespParsedDirectionprefix(dp); avmReqResp.setRespParsedStreetname(sn); avmReqResp.setRespParsedStreetsuffix(ss); avmReqResp.setRespParsedAptorunit(pa); avmReqResp.setRespParsedDirectionsuffix(pd); String fullAddress = hn + " " + dp + " " + sn + " " + ss + " " + pd + " " + pa; fullAddress = fullAddress.replaceAll(" *", " ").trim(); String fullAddress2 = Interpolator.instance().interpolate("#{AVM_REQUEST_RESPONSE.respParsedHousenumber} #{AVM_REQUEST_RESPONSE.respParsedDirectionprefix} #{AVM_REQUEST_RESPONSE.respParsedStreetname} #{AVM_REQUEST_RESPONSE.respParsedStreetsuffix} #{AVM_REQUEST_RESPONSE.respParsedDirectionsuffix} #{AVM_REQUEST_RESPONSE.respParsedAptorunit}");
-
3. Re: How to resolve EL expressions in code?
danielc.roth Oct 19, 2008 1:02 AM (in response to x490812)The
AVMREQUESTRESPONSE
must be in a context where the interpolator may find it.Do this to see how things work, and then modify your code to match it:
java.util.Date date = new java.util.Date(); org.jboss.seam.contexts.Contexts.getEventContext().set("myOwnDate",date); String s = Interpolator.instance().interpolate("#{myOwnDate.time}");
s will be the same as date.getTime (as a string)
Comprende? :-)
-
4. Re: How to resolve EL expressions in code?
x490812 Oct 20, 2008 4:39 AM (in response to x490812)Thanks you so much - the problem was that I as assigning values to the object then trying to interpolate the object within the same function; Apperently, seam does not outject until the end of the function. I determined this by setting the object into scope then interpolating.
Thanks again