PDA

View Full Version : How to properly create variables?


Kimmi
07-06-2009, 06:15 PM
I know how to create a variable. What I'm asking is, how do you put actual text into a variable?

For instance, say that I create the variable:

<c:set var="date" value="${param.year} ${param.month} ${param.day}"/>

What if I wanted to add a dash in between the variables? I want to make it so that when I insert it into the database, it automatically has a dash in between everything so that it's in the correct date format.

How would I do that? If I did it like this....

<c:set var="date" value="${param.year} - ${param.month} - ${param.day}"/>

...then it would think I wanted to SUBTRACT everything. Please help me. This is probably the most simple question anyone could ever ask.

shyam
07-08-2009, 06:09 PM
<c:set var="date"><c:out value="${param.year}" />-<c:out value="${param.month}" />-<c:out value="${param.day}" /></c:set>

Kimmi
07-09-2009, 01:47 AM
Thank you!