Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Aug 2008
    Location
    Bismarck, ND, USA
    Posts
    17
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Exclamation java.util.Date / string issue in JSP file

    My texts for JSP/JSTL do not get here until probably Monday, but this is the only project that I've got going on right now. I have a value, currently held in a string, that I need to parse into the standard java.util.Date elements (ie x.date, x.year, x.month, x.hours, x.minutes, x.seconds). The sun documentation is showing me some things that might be useful, but 90% of it is depreciated.

    Can someone tell me a quick and simple way to take a string value of the fomatting: "2008-07-11 15:30:00.0" and break it down into a java.util.Date element x with the previously mentioned attributes?

    We've got java.util.Date beans defined in this code, but until my documentation gets here (hopefully tomorrow and not Monday), I really don't know how to make any of the beans do what I want with this string.

    Anything you can enlighten me on in this situation would be very much appreciated.

    TIA

    Damon Getsman
    http://www.lookupanyone.com/namelist...ew-getson.html
    ITrx

  • #2
    New Coder
    Join Date
    Aug 2008
    Location
    Bismarck, ND, USA
    Posts
    17
    Thanks
    1
    Thanked 0 Times in 0 Posts
    btw: popup IM contact is welcome

  • #3
    New Coder
    Join Date
    Aug 2008
    Location
    Bismarck, ND, USA
    Posts
    17
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Unhappy

    Also, sorry for the multiple posts on my topic, but I've got a little bit more information that may be helpful to show you guys exactly where I'm at right now.

    Okay so here's a cut 'n paste of text from a BBS where I was looking for some help with this... It explains a little more thoroughly what I've tried to do to get this working, as well as the point that I don't know nearly enough about JSP/Java interaction yet.

    -=-=-=-=-=-
    Aug 28, 2008 16:42 from Grumps
    Instantiate a DateFormat object df, then myDate = df.parse(myString)?

    Sry, I know that's on the page. 's all I got.
    [Programming> msg #198 (3 remaining)] Read cmd -> Next

    Aug 28, 2008 16:45 from Qwe
    Well after including java.text.Dateformat the following code is not
    working
    from within the jsp:
    Code:
                               <%
                                     inDate = java.text.DateFormat.parse(param.timeIn);
                                     outDate = java.text.DateFormat.parse(param.timeOut);
                                %>
    *feels eyelids grow heavy*
    [Programming> msg #199 (2 remaining)] Read cmd -> Next

    Aug 28, 2008 16:59 from Qwe
    Okay my guess at this point is that I have to use a
    Code:
    <jsp:useBean id="ouah" class="java.text.DateFormat" scope="page" />
    to instantiate DateFormat into something that I can use... then it will probably be some sort of
    Code:
    <jsp:setProperty name="ouah" property=??? value=???>
    to invoke the formatting on my string... I don't really have a clue what goes in property, but I can probably find that in the class methods... Now that I think about it it should be "parse" I would assume, and value should have my "${whatever}" holding the string that I want to format.

    I do not have a clue if I'm right, though. And if I'm right I don't have a clue on how to access the results unless they'd be ouah.hours, .minutes, etc...
    [Programming> msg #200 (1 remaining)] Read cmd -> Next

    Aug 28, 2008 17:09 from Qwe
    java.text.DateFormat is completely unknown to my tomcat6
    java.text.SimpleDateFormat is found, and seems alright until it tries to execute the block of code that my parse testing is in.

    tomcat logs vomit this:
    ug 28, 2008 4:08:16 PM org.apache.catalina.core.ApplicationDispatcher invoke
    SEVERE: Servlet.service() for servlet jsp threw exception
    org.apache.jasper.JasperException: Cannot find any information on property 'parse' in a bean of type 'java.text.SimpleDateFormat'

    from my code of:
    Code:
    <jsp:useBean id="fmtDate" class="java.text.SimpleDateFormat" scope="page" />
    . . . .
    <%-- debugging --%>
    <jsp:setProperty name="fmtDate" property="parse" value="$ (param.timeIn}" />
    <%-- done debugging --%>
    [Programming> msg #201 (0 remaining)] Read cmd ->

    -=-=-=-=-=-
    Hope this gives more of a clue of where I'm at...

    TIA for any advice you can give or pointers in the right direction.

    Damon Getsman
    http://bbs.utopiadammit.com
    ITrx


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •