• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

problem Nesting <fmt: in <c:set

 
Rancher
Posts: 4804
7
Mac OS X VI Editor Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am getting a runtime error processing the following EL snippet. I can't tell what to change, I think I've changed every possible combination already. I'm pulling what little hair I have left out in chunks.


The reported error is:
"org.apache.jasper.JasperException: /WEB-INF/pages/closed/usercontrolpanel.jsp(44,12) /WEB-INF/jspf/editcontacttable.jspf(22,52) PWC6031: Unterminated <c:set tag"

What I want to do is put the result of formatting the date object into the ""bdateVar" variable, as a string.

Anybody see what mistake I'm making?

Thanks
pat
 
Sheriff
Posts: 67752
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You cannot use a tag as the attribute value of another tag.

But you don;t need to in this case. The formatDate tag has var and scope attributes that will create the scoped variable without the need for <c:set>.

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, i'm not sure, but you can try make this:

 
Bear Bibeault
Sheriff
Posts: 67752
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tiago Hillebrandt wrote:Well, i'm not sure, but quote don't need from escape char in this case?

No. Even with the escaping, a JSP tag can't be used there. And as pointed out, the <c:set> isn't needed in any case.
 
Tiago Hillebrandt
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Bear Bibeault, ok, sorry!
 
Bear Bibeault
Sheriff
Posts: 67752
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No apologies are necessary!
 
Pat Farrell
Rancher
Posts: 4804
7
Mac OS X VI Editor Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:But you don;t need to in this case. The formatDate tag has var and scope attributes that will create the scoped variable without the need for <c:set>.



Thanks, yes, this works:

<fmt:formatDate var="bdateVar" pattern="MMM dd yyyy" value="${presperson.birthDateAsDate}" />

I had no idea. How does one find the details of EL/JSP? All the links that I can find using google are either simple example pages, or detailed BNF of the spec.

I know that EL/JSP is the way stuff is built these days, but I find the documentation to be opaque or non-existant.
 
Bear Bibeault
Sheriff
Posts: 67752
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The JSTL Specification (links in FAQs) is a pretty easy read.

The EL Specification is not quite so straight-forward (in my opinion) because it's littered with JSF-specific stuff and what's JSP and what's JSF is poorly delineated.

The EL portion of the older JSP 2.0 Specification is a pretty good resource. (They separated the EL spec from the JSP spec with JSP 2.1.)


 
Bear Bibeault
Sheriff
Posts: 67752
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There's also online Javadoc for the JSTL at: http://java.sun.com/products/jsp/jstl/1.1/docs/tlddocs/index.html

It's for 1.1, but it's up-to-date enough to be useful.
 
Pat Farrell
Rancher
Posts: 4804
7
Mac OS X VI Editor Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:The JSTL Specification (links in FAQs) is a pretty easy read.


I may be blind, but I can't find any docs or references to JSTL specs in the JavaRanch (or CodeRanch) Faqs.
Got a link?

I agree that the Javadoc for the JST 1.1 is not too bad. Its better than many of the other doc's that I've stumbled into.
 
Whatever. Here's a tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic