Re: How to convert String to Date in EL?

2019-08-23 Thread Kazuaki Miyauchi
2019年8月20日(火) 17:44 Stuart Thiel :
> Because formats for dates are so ambiguous, there's no reliable way to
> interpret.



 isn't so ambiguous.

Regards,  Kazuaki Miyauchi, Japan

-
To unsubscribe, e-mail: taglibs-user-unsubscr...@tomcat.apache.org
For additional commands, e-mail: taglibs-user-h...@tomcat.apache.org



Re: How to convert String to Date in EL?

2019-08-20 Thread Kazuaki Miyauchi
Excuse me. PC sent my under-writing mail.
2019年8月20日(火) 18:14 Kazuaki Miyauchi :
>  I think many people use JavaBeans or like that using Date data.
> But, in Web site, year, month, day are mostly requested parameters.
> It was very convenient I can use ${param.year} and s

It was very convenient I can use ${param.year} and so on for DB access data.

 Regards,  Kazuaki Miyauchi, Japan

-
To unsubscribe, e-mail: taglibs-user-unsubscr...@tomcat.apache.org
For additional commands, e-mail: taglibs-user-h...@tomcat.apache.org



Re: How to convert String to Date in EL?

2019-08-20 Thread Kazuaki Miyauchi
2019年8月20日(火) 17:55 Stuart Thiel :
> I suspect you can skip the set tag and wrap the parseDate in the sqlParam
> tag as well, but I've never mucked with sql in JSPs (I'm pretty strict
> about using them exclusively as Template Views)

 I think many people use JavaBeans or like that using Date data.
But, in Web site, year, month, day are mostly requested parameters.
It was very convenient I can use ${param.year} and s

-
To unsubscribe, e-mail: taglibs-user-unsubscr...@tomcat.apache.org
For additional commands, e-mail: taglibs-user-h...@tomcat.apache.org



Re: How to convert String to Date in EL?

2019-08-20 Thread Stuart Thiel
I suspect you can skip the set tag and wrap the parseDate in the sqlParam
tag as well, but I've never mucked with sql in JSPs (I'm pretty strict
about using them exclusively as Template Views)

On Tue, Aug 20, 2019, 05:44 Stuart Thiel  wrote:

> Because formats for dates are so ambiguous, there's no reliable way to
> interpret. The is why you'd use the parseDate tag, probably inside a set to
> get a date object that you'd then pass to your dateparam thing. Presumably
> you could write an el "function" to do that inline if you wanted to out in
> the effort to clean your JSP further, as I don't know of such thing
> existing (though I can't imagine why it shouldn't, save to discourage
> everyone putting all their application logic and validation in JSPs)
>
> On Tue, Aug 20, 2019, 05:22 Kazuaki Miyauchi  wrote:
>
>> 2019-08-20 16:39 GMT+09:00, Stuart Thiel :
>> > That's what parseDate does, and why I pointed you at it.
>>
>>  I also want to do like int case as following.
>>
>> 
>> 
>> 
>>
>> 
>> 
>>  insert into test values(?,?)
>>  
>>  
>> 
>>
>>  But, of course, this makes
>>
>> javax.el.ELException: Cannot convert [2019-8-20] of type [class
>> java.lang.String] to [class java.util.Date]
>>
>>  So, I'd like to know how to convert Date type using EL writing.
>> Is there simple method to convert like 0 + for int case?
>>
>>  Regards,Kazuaki Miyauchi, Japan
>>
>> -
>> To unsubscribe, e-mail: taglibs-user-unsubscr...@tomcat.apache.org
>> For additional commands, e-mail: taglibs-user-h...@tomcat.apache.org
>>
>>


Re: How to convert String to Date in EL?

2019-08-20 Thread Stuart Thiel
Because formats for dates are so ambiguous, there's no reliable way to
interpret. The is why you'd use the parseDate tag, probably inside a set to
get a date object that you'd then pass to your dateparam thing. Presumably
you could write an el "function" to do that inline if you wanted to out in
the effort to clean your JSP further, as I don't know of such thing
existing (though I can't imagine why it shouldn't, save to discourage
everyone putting all their application logic and validation in JSPs)

On Tue, Aug 20, 2019, 05:22 Kazuaki Miyauchi  wrote:

> 2019-08-20 16:39 GMT+09:00, Stuart Thiel :
> > That's what parseDate does, and why I pointed you at it.
>
>  I also want to do like int case as following.
>
> 
> 
> 
>
> 
> 
>  insert into test values(?,?)
>  
>  
> 
>
>  But, of course, this makes
>
> javax.el.ELException: Cannot convert [2019-8-20] of type [class
> java.lang.String] to [class java.util.Date]
>
>  So, I'd like to know how to convert Date type using EL writing.
> Is there simple method to convert like 0 + for int case?
>
>  Regards,Kazuaki Miyauchi, Japan
>
> -
> To unsubscribe, e-mail: taglibs-user-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: taglibs-user-h...@tomcat.apache.org
>
>


Re: How to convert String to Date in EL?

2019-08-20 Thread Kazuaki Miyauchi
2019-08-20 16:39 GMT+09:00, Stuart Thiel :
> That's what parseDate does, and why I pointed you at it.

 I also want to do like int case as following.







 insert into test values(?,?)
 
 


 But, of course, this makes

javax.el.ELException: Cannot convert [2019-8-20] of type [class
java.lang.String] to [class java.util.Date]

 So, I'd like to know how to convert Date type using EL writing.
Is there simple method to convert like 0 + for int case?

 Regards,Kazuaki Miyauchi, Japan

-
To unsubscribe, e-mail: taglibs-user-unsubscr...@tomcat.apache.org
For additional commands, e-mail: taglibs-user-h...@tomcat.apache.org



Re: How to convert String to Date in EL?

2019-08-20 Thread Stuart Thiel
That's what parseDate does, and why I pointed you at it.

On Tue, Aug 20, 2019, 04:15 Kazuaki Miyauchi  wrote:

>  This also works using Java description as following.
>
> 
> <% SimpleDateFormat sdFormat = new SimpleDateFormat("/MM/dd");
>Date date = sdFormat.parse(session.getAttribute("date").toString());
>session.setAttribute("date_o", date); %>
> 
> 
>  insert into test values(?,?)
>  
>  
> 
>
>  We need such complicated way to Web-DB access?
> We need simple way using EL description.
>
>  Regards,Kazuaki Miyauchi, Japan
>
> -
> To unsubscribe, e-mail: taglibs-user-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: taglibs-user-h...@tomcat.apache.org
>
>


Re: How to convert String to Date in EL?

2019-08-20 Thread Kazuaki Miyauchi
 This also works using Java description as following.


<% SimpleDateFormat sdFormat = new SimpleDateFormat("/MM/dd");
   Date date = sdFormat.parse(session.getAttribute("date").toString());
   session.setAttribute("date_o", date); %>


 insert into test values(?,?)
 
 


 We need such complicated way to Web-DB access?
We need simple way using EL description.

 Regards,Kazuaki Miyauchi, Japan

-
To unsubscribe, e-mail: taglibs-user-unsubscr...@tomcat.apache.org
For additional commands, e-mail: taglibs-user-h...@tomcat.apache.org



Re: How to convert String to Date in EL?

2019-08-19 Thread Stuart Thiel
Nope, its to convert a string to a date. I think BalusC is the answer
(ranked 246 or something). While the initial question was not what you were
looking for, the reason I suggested you have a read is because you can
often learn a lot of other things (in particular what you are looking for),
and I'm suspecting you didn't take that advice here.

On Mon, Aug 19, 2019, 01:30 Kazuaki Miyauchi  wrote:

>  Hi, Stuart, Thanks for your quick reply.
>
> 2019年8月19日(月) 13:01 Stuart Thiel :
> > The solution with fmt:parseDate is likely what you want, but read what
> > they say and perhaps change what you're doing a bit.
>
>  That is to convert Date type to String.
> I'd like to know reverse way. Google doesn't hit this error message.
>
> Regards,Kazuaki Miyauchi, Japan
>
> -
> To unsubscribe, e-mail: taglibs-user-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: taglibs-user-h...@tomcat.apache.org
>
>


Re: How to convert String to Date in EL?

2019-08-18 Thread Kazuaki Miyauchi
 Hi, Stuart, Thanks for your quick reply.

2019年8月19日(月) 13:01 Stuart Thiel :
> The solution with fmt:parseDate is likely what you want, but read what
> they say and perhaps change what you're doing a bit.

 That is to convert Date type to String.
I'd like to know reverse way. Google doesn't hit this error message.

Regards,Kazuaki Miyauchi, Japan

-
To unsubscribe, e-mail: taglibs-user-unsubscr...@tomcat.apache.org
For additional commands, e-mail: taglibs-user-h...@tomcat.apache.org



Re: How to convert String to Date in EL?

2019-08-18 Thread Stuart Thiel
Hello Kazuaki,

A quick google is probably more effective than mailing this list every time:
https://stackoverflow.com/questions/6162401/convert-and-format-a-date-in-jsp

The solution with fmt:parseDate is likely what you want, but read what
they say and perhaps change what you're doing a bit.

On Sun, Aug 18, 2019 at 11:46 PM Kazuaki Miyauchi  wrote:
>
>  I made following JSP.
>
> <%@ page contentType="text/html;charset=UTF-8"%>
> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core; %>
> <%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql; %>
>
> 
> 
>   Insert Date
> 
> 
>
> 
> 
> 
>  insert into test values(?,?)
>  
>  
> 
> 
>
> 
>  
> 
> 
> 
>
> Table was simply made as following.
> create table test (when_cause date, how text);
>
>  Then, I got following error in tomcat-9.0.22.
> org.apache.jasper.JasperException: Unable to convert string
> [2019-8-19] to class [java.util.Date] for attribute [value]: [Property
> Editor not registered with the PropertyEditorManager]
>
>  How to convert String date data to Date type?
>
>  After changing as following, it works.
> But, it's not easily readable when making complicated sql.
>
> 
>  insert into test values('2019-8-19',?)
>  
> 
>
> Regards, Kazuaki Miyauchi, Japan
>
> -
> To unsubscribe, e-mail: taglibs-user-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: taglibs-user-h...@tomcat.apache.org
>


-- 
Stuart Thiel, P. Eng.

-
To unsubscribe, e-mail: taglibs-user-unsubscr...@tomcat.apache.org
For additional commands, e-mail: taglibs-user-h...@tomcat.apache.org