Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

problem Nesting <fmt: in <c:set

 
Pat Farrell
Rancher
Posts: 4678
7
Linux Mac OS X VI Editor
  • Mark post as helpful
  • send pies
  • 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
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65535
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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>.

 
Tiago Hillebrandt
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, i'm not sure, but you can try make this:

 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65535
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Bear Bibeault, ok, sorry!
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65535
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No apologies are necessary!
 
Pat Farrell
Rancher
Posts: 4678
7
Linux Mac OS X VI Editor
  • Mark post as helpful
  • send pies
  • 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
Author and ninkuma
Marshal
Posts: 65535
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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
Author and ninkuma
Marshal
Posts: 65535
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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: 4678
7
Linux Mac OS X VI Editor
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!