date

X-Application Version: 3.1.3
Tamino Version : 3.1.1
Platform : Win2k
WebContainer : Tomcat 3.3
JDK Version : 1.3.1

hi
can you send the plugin to put the current date in the variable.

thanks alot

Hi,

I assume, that you are aware to the “login example” posted earlier in this community:
http://tamino.forums.softwareag.com/viewtopic.php?p=13414

Based on this example I have added a small plugin called : setDateToVariable

    public static void setDateToVariable(BusinessDocumentWorkspace ws, VariablesHandler variables) throws XException {
        Date date = new Date();
        String formatedDate = DateFormat.getDateInstance(DateFormat.LONG).format(date);
        variables.setVariable("currentDate", formatedDate, "session");
    }
</pre><BR>Before this plugin can be used, you have to register it in xapplication.xml file of your application. Please include following lines:<BR><pre class="ip-ubbcode-code-pre">
        <action name="currentDate" method="WorkspacePlugin.setDateToVariable">
            <arg>variables</arg>
        </action>
</pre><BR><BR>I have modified your home.jsp with the following line of code in order to show you the manner of operation:<BR><pre class="ip-ubbcode-code-pre">
<tr><td  width="746" align="right"><xapp:directcommand type="currentDate"/><xapp:getvar name="currentDate"/></td></tr>
</pre><BR><BR>I have added the result as an extract of a screen shot.<BR><BR>Instead of using two seperate tags, you are also able to modify the plugin with a return statement of type String:<BR><BR><pre class="ip-ubbcode-code-pre">
    public static [b]String[/b] setDateToVariable(BusinessDocumentWorkspace ws, VariablesHandler variables) throws XException {
        Date date = new Date();
        String formatedDate = DateFormat.getDateInstance(DateFormat.LONG).format(date);
        variables.setVariable("currentDate", formatedDate, "session");
        [b]return formatedDate;[/b]
    }
</pre><BR><BR>The code in your jsp page would look as following:<BR><BR><pre class="ip-ubbcode-code-pre">
<tr><td  width="746" align="right"><xapp:directcommand type="currentDate"/></td></tr>




Bye
Thorsten
currentDate.gif

hi
please send the attachment again

thanks

hi
please send the attacment again

thanks

Hi,

which attachment?

Bye
Thorsten

hi
I send the plugin that I used for application.when I insert the fuction setDateToVariable did not work.!!!(I did all of thing you said must do)

thanks alot
WorkspacePlugin.java (3.47 KB)

Hi,

I believe, that I have found the problem.
You didn’t write what kind of errors/trouble you have. But the attachment helped me.

The plugin methode setDateToVariable should contain some formatting tags, in order to help you understanding.
Unfortunately this went wrong and the formatting tags are included in the java code :wink:

Therefore, remove this tags ("[ b ]","[ /b ]") out of your source, recompile it and than it should work.

The source should now look like:

    public static String setDateToVariable(BusinessDocumentWorkspace ws, VariablesHandler variables) throws XException {
        Date date = new Date();
        String formatedDate = DateFormat.getDateInstance(DateFormat.LONG).format(date);
        variables.setVariable("currentDate", formatedDate, "session");
        return formatedDate;
    }



By the way, have you registered the plugin method in you xapplication.xml file?

Bye
Thorsten

I just want U to send me .java and .class files of this date plugin , coz I don’t know how to compile a .java to a .class

Hi,

I have attached a zip file containing both - the source and the class file.

If you want to maintain the plugin in future then
you need to compile the source file each time, after doing some changes.

If you want to learn more about java, servlets, xml or if you would like to have a deeper sight in these topics, then I would recommend you to have a look into a good book, like: “Sams Teach Yourself Java2 in 21 Days”.
"[…] The book teaches Java 2 programming to beginners and experienced programmers, with an emphasis on how Java is being used today in new areas such as Java servlets and XML processing […]"

Bye Thorsten

P.S.: If you are in a dos box then “javac WorkspacePlugin” will compile the file in to WorkspacePlugin.class.
“javac -?” will give you advice for all compiler options
The java/bin folder must me set in your path environment
date_plugin.zip (3.15 KB)