Re: booleans
S Ahmed <[email protected]>
| Newsgroups | gmane.comp.web.freemarker.user |
|---|---|
| Message-ID | <CAG2rwuMBUk=AwjcLTm8ddN_mtsVAKO6-3Hx4JehNYkmpOW6kNg@mail.gmail.com> |
(IntelliJ creates these properties for me using its code generation)
I changed my view code from bug.isResolved to bug.resolved, still getting
an error....
Bug.java:
public boolean isResolved() {
return isResolved;
}
public void setResolved(boolean resolved) {
isResolved = resolved;
}
.ftl:
${bug.resolved}
I'm getting this error:
org.springframework.web.util.NestedServletException: Request
processing failed; nested exception is
freemarker.core.NonStringException: Error on line 4, column 47 in
bugs/show.ftl
Expecting a string, date or number here, Expression bug.resolved is
instead a freemarker.template.TemplateBooleanModel$1
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:894)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778)
javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
On Sun, Jul 1, 2012 at 6:25 PM, Daniel Dekany <[email protected]> wrote:
> Monday, July 2, 2012, 12:16:47 AM, S Ahmed wrote:
>
> > My java classes property is a boolean, and my getter/setters is like:
> >
> > public boolean isSold() {
> > return isSold;
> > }
> >
> > public void setSold(boolean sold) {
> > isSold = sold;
> > }
> >
> > Trying to reference it in my .ftl is causing an error:
> >
> > $(product.isSold}
>
> Should be ${product.sold}, following the JavaBeans rules.
>
> > Do I have to change my java class to use getter/setters like:
> >
> > getIsSold
> > setisSold?
>
> "is" replaces "get", so isSold is fine, and the property name is
> "sold".
>
> > And then do:
> >
> > ${product.isSold}
> >
> > ?
>
> --
> Best regards,
> Daniel Dekany
>
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> FreeMarker-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/freemarker-user
>
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
FreeMarker-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freemarker-user