getting the current date to a netui:textBox - Weblogic

This is a discussion on getting the current date to a netui:textBox - Weblogic ; Hi all, now I have a nice simple problem I have the following line in a jsp netui:form: This sets the textBox to the date when the page opens. What I'd like to do is automatically fill this value with ...

+ Reply to Thread
Results 1 to 5 of 5

Thread: getting the current date to a netui:textBox

  1. getting the current date to a netui:textBox

    Hi all,

    now I have a nice simple problem
    I have the following line in a jsp netui:form:


    This sets the textBox to the date when the page opens.
    What I'd like to do is automatically fill this value with today's date.

    I have tried the following:


    but I just get an empty text box.

    Thanks again for any help.

    /Nigel

  2. Re: getting the current date to a netui:textBox

    <%!
    SimpleDateFormat formatter = new SimpleDateFormat("yyyy.MM.dd");
    %>

    <%
    String cDate = null;
    synchronized( formatter )
    {
    cDate = formatter.format(new Data());
    }
    %>



    Please note that I do not have workshop installed on this machine so the code above is not tested.

    Keep me posted if this does not do the trick.

    - Anders M.

  3. Re: getting the current date to a netui:textBox

    Hi Anders,

    Thanks for the tip.

    I get the following error when runnning the page now:
    Caught exception when evaluating expression "{page.cDate}" with available binding contexts [actionForm, pageFlow, globalApp, request, session, appication, pageContext, bundle, container, url, pageInput]. Root cause: com.bea.wlw.netui.script.xscript.IllegalContextSta teException: The context "page" could not be found.

    There is a context: pageContext, which I tested with {pageContext.cDate} which didnīt give me an error, actually it didnīt return anything (

    According to WLS, the available contexts are:
    actionForm,appication,bundle,globalApp,pageContext ,pageFlow,request,session, and url.

    I thought the current date should lie in the session context, or ??

    /Nigel

  4. Re: getting the current date to a netui:textBox

    Sorry about thatone, the code below is tested and working. Keep me posted if this does not work.

    <%!
    SimpleDateFormat formatter = new SimpleDateFormat("yyyy.MM.dd");
    %>

    <%
    synchronized( formatter )
    {
    pageContext.setAttribute("cDate", formatter.format(new Date()));
    }
    %>







  5. Re: getting the current date to a netui:textBox

    Perfect

    I had to write the netui line as


    to get it into my db field...

    Thanks again Anders, esp for the ultra fast reply

    /Nigel

+ Reply to Thread