DateTime class in a webservice. please help

Hi All.
I can't figure out wich class type to use to publish a dateTime in a webservice.
I have an ejb 3.0 entity bean generated with the jdeveloper wizard mapped to a Oracle 9i table. This table have some DateTime field, wich generates properties of type java.sql.Timestamp.
To use this entity, I have the ejb 3.0 facade session bean with a method defined similar to the following:
@WebMethod
public String storeMyEntity(MyEntity ent);
I am able to create the client (Web and standalone) application and store data in all field. Nevertheless, the WSDL generated by the webservice don't show the datetime fields.
I've tried using oracle.sql.datetime and the field appears, but this is useless in a heterogenous environment (consuming the webservice from a Delphi client for example)
Appreciate your help very much.

wrong group???
no one ever publish a dateTime in a webservice with EBJ 3.0 and annotations???
please some tip. Thanks
Marko.

Similar Messages

  • How can I call a ABAP proxy class from BADI? PLease help

    hi Experts,
        I have a scenario where I have to call a ABAP proxy class from a BADI. How can I do this? Does anybody has sample code for the same?
    Please help.
    Thanks
    Gopal

    Hi,
       You can call a method of a class from BADI. Here are the steps.
       1) In the BADI implementation create a object for the proxy class.
       2) Call the Execute_Synchronous method.
        You can define a BADI by using SE18 and you can implement it by using SE19.
    Sample code...
    ================================================
      METHOD ZIF_EX_VBADI~CONVERTUPPER.
      DATA: OBJ TYPE REF TO ZTESTCLASS.
      DATA: IT_DATA  TYPE ZIN_MT,
                IT_RES   TYPE ZOUT_MT,
                SEXCEPTION TYPE REF TO CX_AI_SYSTEM_FAULT.
      TRY.
          CREATE OBJECT OBJ
             EXPORTING
                 LOGICAL_PORT_NAME = 'TESTPORT'.
      CATCH CX_AI_SYSTEM_FAULT INTO SEXCEPTION.
      ENDTRY.
    ENDMETHOD.
    ================================================
    Thanks,
    Vivek LR

  • A question about class and interface? please help me!

    the following is program:
    interface A{
    public class B implements A{
    public static void main(String [] args){
    A a = new B();
    System.out.println(a.toString());
    }i want to ask a question, the method toString() is not belong to interface A, why a can call method toString()? the interface call the method that isn't belong to, why? please help me...

    because a.toString() call the method toString() of class Object because B implements A, but extends Object and in the class Object there is a method toString(). infact if you override the method toString() in class B, a.toString() call toString() in class B.
    try this:
    interface A {}
    public class B implements A
      public String toString()
        return "B";
      public static void main(String [] args)
        A a = new B();
        System.out.println(a.toString());
      }by gino

  • Can not run file.class with Internet Explorer ( Please help me)

    Please help me ! ! (Beginer Programming)

    First, you can't run a .class file. Secondly, you have to post your code, that is the only way we could help

  • Call a method/Functio in a class using MouseOver StaticText - Please help!!

    Hello, I have an array of unknown size of Static Text component's of the type com.sun.rave.web.ui.component.StaticText, They're named "st_utp_1", "st_utp_2", "st_utp_3".... so forth.
    I have a class called "Page1.class" in this class I have a Method(or function, please correct me on that). called declared as:
    public void utp(int utv) {
    }When I mouse over a particular StaticText box, I would like it to call the method "utp(x);" where x is the last number in the StaticText ID. for example, If I mouseOver "st_utp_23" I would like it to call the method "utp(23);", If I then mouseOver "st_utp_107" I would like to call the method as "utp(107);".
    Currently I can't get any StaticText to call any method in my class file with a mouseOver function. I can however call my method successfully from within the class file itself.
    Please, can anyone help me?
    Looking forward to the response. Cheers

    Cheers, thanks for the quick response
    I imagine you mean something like this
    public void init() {
          st_utp_1.addMouseListener(new MouseAdapter() {
              public void mouseEntered(MouseEvent e) {
                  utptab(1);
    }The problem is that the statiicText componet "st_utp_1" is of type "com.sun.rave.web.ui.component.StaticText"
    It comes up with the error:
    symbol : method addMouseListener(<anonymous java.awt.event.MouseAdapter>)
    location: class com.sun.rave.web.ui.component.StaticText
    st_utp_1.addMouseListener(new MouseAdapter()
    If I create a new Jlabel called "jl_utp_1" and write the same code:
    public void init() {
          jl_utp_1.addMouseListener(new MouseAdapter() {
              public void mouseEntered(MouseEvent e) {
                  utptab(1);
    }it executes without a problem, I believe it's the type of StaticText compnent I'm using.
    Any more help would be appreciated.

  • Executing one system command from one java class. ERROR. Please help me

    Hello i am trying to add users into one linux machine using one jaav program but when i execute the java class the system doesn't show me any error and dont make anything.
    The linux command, in the main of the class, is correct; from thelinux shell it runs well, but from the java class it doesn't run.
    Can you help me please?
    thanks
    import java.io.*;
    public class ejecutaUsuario {
    /** Creates a new instance of ejecutaUsuario */
    public ejecutaUsuario(String cmdline) {
    try {
    String line;
    Process p = Runtime.getRuntime().exec(cmdline);
    BufferedReader input =
    new BufferedReader
    (new InputStreamReader(p.getInputStream()));
    while ((line = input.readLine()) != null) {
    System.out.println(line);
    input.close();
    catch (Exception err) {
    err.printStackTrace();
    System.out.println(err);
    public static void main(String argv[]) {
    String passwd="hola";
    String usuarioInterno="xxxxxx";
    new ejecutaUsuario("/bin/sh useradd -p `openssl passwd -1 -salt 12345678 " + passwd + "` -d /home/" + usuarioInterno + " -m -s /bin/bash " + usuarioInterno);

    Try gettting the error input stream as well (getErrorStream()). Maybe you are getting output there.
    You might want to try just executing the 'useradd' part, getting the output stream of that process, and then put the parameters of useradd into the outputstream.
    Later
    Cardwell

  • WSIF - Can we return java class back to bpel (PLEASE HELP)

    Scenario : We have old project and migrating to Oracle BPEL.
    In this project we have Java Files and inside that java files we have many functions which return java object. Is it possible to return java value object to bpel process.
    Steps which i have followed:
    1. Created a WSDL file using the control file given below.
    2. Changed the name spaces and types generated to XFMFRq and TXNLog as i/p and o/p.
    3. Imported same file into oracle bpel.
    4. Called the function : logbegin.
    EXCEPTION : The types are not compactable is the exception we are getting but we are able to call the function and execute first line but not able to return TXNLOG class as an xml element to bpel.
    For Example :
    1. Java Method and this method returns Java Value Object
    Java Control which has TXNLOG as the value object which will return the value.
    CONTROL FILE
    public TxnLog logBegin(com.hp.rtfs.xfmf.doc.XFMFRqDocument requestXML)throws Exception
    //LogUtil.logDebug(LogConstants.MODULE_BPM,BPM_CONTROL_NAME,"Enter Method logBegin ");
    txnLog=new TxnLog();
    try
    System.out.println("AMMA1121212");
    LogUtil.logDebug(LogConstants.MODULE_BPM,BPM_CONTROL_NAME,"Entering Top user id update in LogBegin");
    txnLog.setTlogChannelLoginId("AMMA1");
    txnLog.setTlogChannelUserId("AMMA2");
    System.out.println("AMMA2");
    txnLog.setTlogChinChannelId("ATM");
    txnLog.setTlogChannelSessionId("SESSION-1111");
    System.out.println("AMMA3");
    txnLog.setTlogCustCifKey((new Long("121212")));
    txnLog.setTlogEmtnTxnCd("TXN-001");
    System.out.println("AMMA4");
    txnLog.setTlogSendIpAddr("10.1.1.1");
    txnLog.setTlogChannelTxnSeqId(new Integer("1212"));
    System.out.println("AMMA5");
    TxnLogPK txnLogPk=new TxnLogPK(new Integer("121212"),
    DateUtil.getDate(requestXML.getXFMFRq().getMsgRqHdr().getUID().getRTFSTransSeqUIDDt()),"1212");
    txnLog.setTxnLogPK(txnLogPk);
    System.out.println("AMMA6");
    catch(Exception e)
    //LogUtil.logError(LogConstants.MODULE_BPM,BPM_CONTROL_NAME,"Exception "+e.getMessage());
    e.printStackTrace();
    return txnLog;
    TXN LOG value object is :
    // Oracle JDeveloper Stub Generated Source
    package com.hp.rtfs.ods.infra.trx;
    public class TxnLog
         implements java.io.Serializable
         // Constructors
         public TxnLog(com.hp.rtfs.ods.infra.trx.TxnLogPK p1, java.lang.Long p2, java.lang.String p3, java.util.Calendar p4, java.lang.String p5, java.lang.String p6, java.lang.String p7, java.lang.String p8, java.lang.String p9, java.lang.Integer p10, java.util.Calendar p11, java.lang.String p12, com.hp.rtfs.ods.infra.channel.ChannelInfo p13, java.util.Set p14) { }
         public TxnLog() { }
         public TxnLog(com.hp.rtfs.ods.infra.trx.TxnLogPK p1, java.util.Set p2) { }
         // Fields
         private com.hp.rtfs.ods.infra.trx.TxnLogPK TxnLogPK;
         private java.lang.Long tlogCustCifKey;
         private java.lang.String tlogEmtnTxnCd;
         private java.util.Calendar tlogStartDt;
         private java.lang.String tlogStat;
         private java.lang.String tlogSendIpAddr;
         private java.lang.String tlogChannelUserId;
         private java.lang.String tlogChannelLoginId;
         private java.lang.String tlogChannelSessionId;
         private java.lang.Integer tlogChannelTxnSeqId;
         private java.util.Calendar tlogEndDt;
         private java.lang.String tlogChinChannelId;
         private com.hp.rtfs.ods.infra.channel.ChannelInfo channelInfo;
         private java.util.Set txnLogDatas;
         // Methods
         public com.hp.rtfs.ods.infra.trx.TxnLogPK getTxnLogPK() { }
         public void setTxnLogPK(com.hp.rtfs.ods.infra.trx.TxnLogPK p1) { }
         public java.lang.Long getTlogCustCifKey() { }
         public void setTlogCustCifKey(java.lang.Long p1) { }
         public java.lang.String getTlogEmtnTxnCd() { }
         public void setTlogEmtnTxnCd(java.lang.String p1) { }
         public java.util.Calendar getTlogStartDt() { }
         public void setTlogStartDt(java.util.Calendar p1) { }
         public java.lang.String getTlogStat() { }
         public void setTlogStat(java.lang.String p1) { }
         public java.lang.String getTlogSendIpAddr() { }
         public void setTlogSendIpAddr(java.lang.String p1) { }
         public java.lang.String getTlogChannelUserId() { }
         public void setTlogChannelUserId(java.lang.String p1) { }
         public java.lang.String getTlogChannelLoginId() { }
         public void setTlogChannelLoginId(java.lang.String p1) { }
         public java.lang.String getTlogChannelSessionId() { }
         public void setTlogChannelSessionId(java.lang.String p1) { }
         public java.lang.Integer getTlogChannelTxnSeqId() { }
         public void setTlogChannelTxnSeqId(java.lang.Integer p1) { }
         public java.util.Calendar getTlogEndDt() { }
         public void setTlogEndDt(java.util.Calendar p1) { }
         public java.lang.String getTlogChinChannelId() { }
         public void setTlogChinChannelId(java.lang.String p1) { }
         public com.hp.rtfs.ods.infra.channel.ChannelInfo getChannelInfo() { }
         public void setChannelInfo(com.hp.rtfs.ods.infra.channel.ChannelInfo p1) { }
         public java.util.Set getTxnLogDatas() { }
         public void setTxnLogDatas(java.util.Set p1) { }
         public java.lang.String toString() { }
         public boolean equals(java.lang.Object p1) { }
         public int hashCode() { }
    ---------------------------------------------------------------------------

    I have been bragging to my clients the benefits of
    Java Applications, but one thing I couldn't convince
    them is the use of a JVM. They dislike the idea of
    downloading the JRE, and the slowness of programs
    running in an interpreter. I am stumped for not being
    able to satisfy their need for a .EXE program on their
    Win32 systems. And, it would be ridiculous to go back
    again to C++, after learning Java. I'm not going to address the JRE distribution as it's already been mentioned and there are several ways of approaching that problem that you can find easily in the forum so I won't waste space for it here.
    What you need to address more than anything is the supposed slowness of java programs. The question at hand is slow as compared to what? In what context? A benchmark can be twisted to show whatever the author of the report wants it to show. Thus I tend to distrust such statistics in general due to the economical influence of the author or comissioner of the report being in the business of trying to sell something. Exactly what are they calling slow and what causes this perception on their part? I wouldn't sidestep the issue, or try to B.S. about it, but I'd be willing to bet that their fears are unfounded and based on superstition and hearsay.
    >
    Is their a tool or a way to convert .CLASS files into
    .EXE(Win32) files, to make it execute faster and
    independent? I know it would sacrifice portability,
    but I have to give in to demands. As they say it,
    "The customers are always right." Please, anybody out
    there, shed some light for me on this one. Thanx in
    advance.
    BlueKnyght.ph

  • Problem using java crypto class... Please help me

    Hi, i'm trying to do application that send information via socket, and i have to send the data encrypted,
    i`m trying to implemented the RC4 algorithm.... I read an article that said that the java sdk 1.4 has already
    implemented the securities classes. So I made this little program:
    import javax.crypto.spec.*;
    import javax.crypto.*;
    import java.security.*;
    import java.io.*;
    public class MicroRC4
    public void encriptaClavePublica(String trama)
    Cipher rc4Cipher;
    byte[] rc4KeyByte;
    SecretKey rc4Key;
    String keyStr;
    String messageEncryp;
    byte[] messageEncrypByte;
    rc4Key = null;
    messageEncryp = trama;
    // Clave para encriptar el mensaje
    keyStr = new String();
    keyStr = "12345678";
    rc4KeyByte = new byte[8];
    messageEncrypByte = new byte[255];
    for(int i=0; i < 8; i++)
    rc4KeyByte[i] = (byte)keyStr.charAt(i);
    try
    for(int i=0; i < messageEncryp.length(); i++)
    messageEncrypByte[i] = (byte)messageEncryp.charAt(i);
    rc4Key = (SecretKey)new SecretKeySpec(rc4KeyByte, "RC4");
    rc4Cipher = Cipher.getInstance("RC4");
    rc4Cipher.init(Cipher.ENCRYPT_MODE, rc4Key);
    byte[] result = null;
    result = rc4Cipher.doFinal(messageEncrypByte);
    System.out.println("Usage:"+result);
    catch(Exception e)
    System.out.println(" Error: " + e.getMessage());
    System.out.println("\n........................................\n");
    I don't know what is wrong but when i run the application it show me the following message :
    Error: Algorithm RC4 not available
    Does anybody know what is wrong ??
    Does anybody can help me ??
    or tell me when can i find some source code that implement de RC4 algorithm
    Thank's in advance..
    Alejandro.

    Hi Alejandro,
    In the ends i decided to implement the algorithm by
    myself, i did it... any way thank's again.... If
    anybody want to see the code, send me a mail......
    AlejandroCan I also get the source code? my email id is [email protected]
    Thanks a lot!
    Srik.

  • Class Access & Package Question - Please Help

    Hi,
    I have a question regarding how to access a class in an abnormal directory structure.
    Here's the type of directory structures:
    -Documenter
    -com
    -xyz
    -business
    -AppBase
    -com
    -xyz
    -util
    I have a class called Hash that is in the util directory and I want to access it from a class in the business directory. How can I do that? Any help would be appreciated.

    Thanks, I should have mentioned that WebApp is the same parent directory for the Documenter & AppBase directories:
    -c:\WebApp
    -Documenter
    -com
    -xyz
    -business
    -c:\WebApp
    -AppBase
    -com
    -xyz
    -util
    Can I still just make sure the that the classpath contains the above directories? Thanks in advance.

  • Codebase help. Applet class not found. Please help..

    I have web application (WEB) and struts configuration on weblogic server. I have configured the struts xml to call a HTML under certain condition and the HTML in turn should load a applet. The HTML is getting called correctly but the applet fails to load.
    My html is in the C:\xxx\yyy\web\billing directory and the applet class is in the
    C:\xxx\yyy\web\WEB-INF\classes\com\zzz\kkk\jjj\billing\helper directory. The Applet class is in the package com\zzz\kkk\jjj\billing\helper . I tried all combination of codebase in the HTML but the applet is NOT FOUND.
    Any help would be appreciated.
    Thanks

    >
    The browser needs to grab the applet class, so it can
    execute it locally.
    I think that stuff in WEB-INF is never directly
    delivered to the client -- the server denies that it
    exists.
    So create another directory under docroot that will
    hold applet classes.Thanks. I moved the applet class to the same directory as the HTML file and it works now.

  • Preloader and Document Class BIG question (yeap please help)

    Hy,
    I know that this its a question posted many, many times, but
    after searching the net, reading a lot of books and searching this
    forum too, I cant get out with a solution. If I'd say for sure
    there is no possibility to create something like this, I just go
    back to old methods but is not the scope of Adobe with AS3 to
    encourage the use of OOP principle or not?
    The problem:
    I have a single fla file (AS3) with a single frame on
    timeline, frame that its there when you will create the file with
    flash. In the library I have different symbols, that for simplicity
    are only jpg image, (BitmapData) checked for export for
    ActionScript and exported on frame one. An external .as file called
    DocumentClass its off course my Document Class
    This its all that I want to do with the fla, the goal its to
    create, animate etc. only with AS3 in external classes, no timeline
    script. I don't want to load external files, XML, or else in this
    movie. I just want a single swf after compilation, no additional
    files.
    Ok, how do I create a preloader that will take care of
    starting the logic after the whole swf its loaded and in the same
    time shows the user a percentage or a load bar or something that
    its not the blank screen when the swf its downloading. I want to do
    this without another swf that load this swf, or timeline scripts,
    or place all the content on second frame and then gotoAndStop to
    the third frame. All this are not solution but cheap tricks, that
    are against all this OOP principle that I just continue to read in
    books and here from guru programmers.
    The big question is:
    It is possible to create a preloader, when use a document
    class with your fla? And if yes, how?
    I know that the Document Class its not instantiated if its
    not fully loaded, if that's true when the document class will be
    fully loaded? maybe after the whole movie its loaded? And, if its
    true, it will never show a percentage bar "while" the movie its
    loaded. And if that's true WHY use a document class anyway?
    Thank you for reading this and I really wait to get some
    answer.

    I am pretty sure you cannot do self preloader with one frame
    and all the objects in the library. I guess the key here is
    one-frame design. Screen refreshes (renders) only when all the
    scripts in the frame are executed - this is a very important thing
    to understand about how Flash works. Yes, you can force screen
    refresh with updateAfterEvent() method but it is attached to a
    handful of events only (MouseEvent and TimerEvent) but, again, all
    this functionality is available only after first frame scripts are
    executed. Thus, it seems like the only way to create preloader from
    within SWF is to use multiple frames and set library objects to
    load in later (not first) frame.
    quote:
    And if that's true WHY use a document class anyway?
    Well, preloader is the last thing that would be on my mind in
    terms of using AS3 ability to link DocumentClass to the top movie.
    This feature allows for very sophisticated architectural
    approaches. It has no connection to preloader as to any other
    features developer wants to implement. Neither it depends on or
    negates timeline. As a matter of fact, although I love one-frame
    applications, I find on numerous occasions that my application
    would be more efficient if I used several (at least two) frames.
    gotoAndStop is not deprecated. It is a valid MovieClip class'
    method. After all, having only one frame doesn't mean not having
    frames at all - there is one already. Frames are fundament of
    Flash. AS3 did introduce frameless entities like Sprite, etc. but
    it doesn't mean that frames are going anywhere.
    I would agree that timeline code is inferior to
    classed/packaged (read: better organized) code but, still, how is
    it not OOP? Frame is an Object, right? Why using timeline is cheap
    and not a solution?
    On a side note, I see too many times how some authors (and
    managers) are pushing their agenda (or close mindedness) onto their
    audience with no real substantiation. Claiming that timeline in
    Flash is not valid architectural decision from OOP standpoint is
    totally wrong. As wrong as strict adherence to design patterns. I
    don't think there is sharply defined "right" or "wrong" in
    programming. One finds the best optimal solution. The goal is to
    create something that works fine. Unless, of course, the process is
    the goal - but very few of us can afford focusing on the process.

  • I cant locate capture devices!!!! Please HELP!!!

    I am trying to send voice over to another computer but right now I cant get my program to detect my capture device. I looked through the forum for solutions and found 2 solutions- 1 is using the JMF registry editor and click on "connect capture devices"; 2 is using "Vector devices = CaptureDeviceManager.getDeviceList(null);" which gets me the entire list of devices.
    I tried both but nothing happend. I tried a USB microphone/headset, a regular microphone and a normal non-usb microphone/headset. None of them worked for my program. The weird thing is that when I run JMF application and try to use the application for voice capturing those capture devices do work. So basically my program doesnt seem to work... Below is the test class I made. Please help me out! thanks
    import java.io.*;
    import java.util.Vector;
    import javax.media.*;
    import javax.media.format.*;
    public class Devicew {
    public static void main(String [] args) {
         Vector devices = CaptureDeviceManager.getDeviceList(null);
         System.out.println("Number of capture devices: " + devices.size());
         for (int n = 0; n < devices.size(); n++) {
         CaptureDeviceInfo info = (CaptureDeviceInfo) devices.elementAt(n);
    System.out.println("we found something" + n);
         System.out.println(info.toString());
    }

    Hi
    Strictly speaking this doesn't sound like a jmf api problem.
    It sounds like the classpath is not set properly for your app. When you launch the app set the classpath variables to your classes eg
    java -jar -cp path/to/my/classes myapp.jar
    hope helps
    regards

  • Error in creating a process using runtime class - please help

    Hi,
    I am experimenting with the following piece of code. I tried to run it in one windows machine and it works fine. But i tried to run it in a different windows machine i get error in creating a process. The error is attached below the code. I don't understand why i couldn't create a process with the 'exec' command in the second machine. Can anyone please help?
    CODE:
    import java.io.*;
    class test{
    public static void main(String[] args){
    try{
    Runtime r = Runtime.getRuntime();
         Process p = null;
         p= r.exec("dir");
         BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));
         System.out.println(br.readLine());
    catch(Exception e){e.printStackTrace();}
    ERROR (when run in the dos prompt):
    java.io.IOException: CreateProcess: dir error=2
    at java.lang.Win32Process.create(Native Method)
    at java.lang.Win32Process.<init>(Win32Process.java:63)
    at java.lang.Runtime.execInternal(Native Method)
    at java.lang.Runtime.exec(Runtime.java:550)
    at java.lang.Runtime.exec(Runtime.java:416)
    at java.lang.Runtime.exec(Runtime.java:358)
    at java.lang.Runtime.exec(Runtime.java:322)
    at test.main(test.java:16)
    thanks,
    Divya

    As much as I understand from the readings in the forums, Runtime.exec can only run commands that are in files, not native commands.
    Hmm how do I explain that again?
    Here:
    Assuming a command is an executable program
    Under the Windows operating system, many new programmers stumble upon Runtime.exec() when trying to use it for nonexecutable commands like dir and copy. Subsequently, they run into Runtime.exec()'s third pitfall. Listing 4.4 demonstrates exactly that:
    Listing 4.4 BadExecWinDir.java
    import java.util.*;
    import java.io.*;
    public class BadExecWinDir
    public static void main(String args[])
    try
    Runtime rt = Runtime.getRuntime();
    Process proc = rt.exec("dir");
    InputStream stdin = proc.getInputStream();
    InputStreamReader isr = new InputStreamReader(stdin);
    BufferedReader br = new BufferedReader(isr);
    String line = null;
    System.out.println("<OUTPUT>");
    while ( (line = br.readLine()) != null)
    System.out.println(line);
    System.out.println("</OUTPUT>");
    int exitVal = proc.waitFor();
    System.out.println("Process exitValue: " + exitVal);
    } catch (Throwable t)
    t.printStackTrace();
    A run of BadExecWinDir produces:
    E:\classes\com\javaworld\jpitfalls\article2>java BadExecWinDir
    java.io.IOException: CreateProcess: dir error=2
    at java.lang.Win32Process.create(Native Method)
    at java.lang.Win32Process.<init>(Unknown Source)
    at java.lang.Runtime.execInternal(Native Method)
    at java.lang.Runtime.exec(Unknown Source)
    at java.lang.Runtime.exec(Unknown Source)
    at java.lang.Runtime.exec(Unknown Source)
    at java.lang.Runtime.exec(Unknown Source)
    at BadExecWinDir.main(BadExecWinDir.java:12)
    As stated earlier, the error value of 2 means "file not found," which, in this case, means that the executable named dir.exe could not be found. That's because the directory command is part of the Windows command interpreter and not a separate executable. To run the Windows command interpreter, execute either command.com or cmd.exe, depending on the Windows operating system you use. Listing 4.5 runs a copy of the Windows command interpreter and then executes the user-supplied command (e.g., dir).
    Taken from:
    http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html

  • Please help with my helper class

    Hi,
    plz I need some assistance with this:
    I have a big table which consist of 200 columns. This table gets fields from different tables. It has records of orders which may have several items and each item can have up to 8 taxes. So i have fields reaping for other order order records. I need to display an order then have a navigation to list items in details, with all its taxes, one by one.
    Here is how I have decided to do it in a nutshell. I have decided to get all taxes of a particular item and put in a map with tax_codes as values and tax details arraylist as values. I then add this to an item with its other details. then I add items to a particular order. I have separated orders,items and taxes in their separate beans. Im trying to first the implimentation for each order, item and taxes by displaying them on a JSP. However am currently getting the following error with taxdetails:
    java.lang.ClassCastException: OrderItems.ItemTax cannot be cast to java.lang.String
    at OrderItems.OrderDetails.getItemTaxDetails(OrderDetails.java:166)
    at OrderItems.Controller.processRequest(Controller.java:57)
    at OrderItems.Controller.doGet(Controller.java:72)
    I have a list of all itemTaxCodes am iterating and am casting to string...am not casting ItemTax object.Here is my code below:
    OrderDetails.java
    package orderitems;
    import java.sql.*;
    import java.util.*;
    public class OrderDetails {
        private LineOder lineOrder;
        private Map lineItems;
        //returns an item number, key_item, from its unique keys
        public int getItemNumber(int key_item, String key_year,
                String key_office,String key_client,String key_company){
            Connection conn = null;
            Statement stat = null;
            ResultSet rst = null;
            int itmNum = 0;
             * key_item a unique number for an item.
             * key_year,key_office,key_client,key_company unique keys
             * for each order where this key_item is taken
             * from.
            String select = "SELECT key_item FROM "+
                    Constants.WEB_TABLE +" WHERE key_item = " + key_item +
                    " AND key_year = '" + key_year + "'" +
                    " AND key_office = '" + key_office + "'" +
                    " AND key_client = '" + key_client + "'" +
                    " AND key_company = '" + key_company +"'";
            DbConnection dbConn = new DbConnection();
            try {
                conn = dbConn.getDbConnection(Constants.WEB_JNDI);
                stat = conn.createStatement();
                rst = stat.executeQuery(select);
                if(rst.next()){
                    itmNum = Integer.parseInt(rst.getString("key_item"));
            } catch (SQLException ex) {
                ex.printStackTrace();
            } finally{
                SQLHelper.cleanUp(rst, stat, conn);
            return itmNum;
        //get a list of item number(item codes)
        public List getAllItemNumbers(String key_year,
                String key_office,String key_client,String key_company){
            List itemNumbers = new ArrayList();
            LineItem itemNumber = null;
            Connection conn = null;
            Statement stat = null;
            ResultSet rst = null;
            String select = "SELECT key_item FROM "+ Constants.WEB_TABLE +
                    " WHERE key_year = '" + key_year + "'" +
                    " AND key_office = '" + key_office + "'" +
                    " AND key_client = '" + key_client + "'" +
                    " AND key_company = '" + key_company + "'";
            DbConnection dbConn = new DbConnection();
            try {
                conn = dbConn.getDbConnection(Constants.WEB_JNDI);
                stat = conn.createStatement();
                rst = stat.executeQuery(select);
                while(rst.next()){
                    itemNumber = new LineItem();
                    itemNumber.setKey_item(Integer.parseInt(rst.getString("key_item")));
                    itemNumbers.add(itemNumber);
            } catch (SQLException ex) {
                ex.printStackTrace();
            } finally{
                SQLHelper.cleanUp(rst, stat, conn);
            return itemNumbers;
        //get a list of tax codes
        public List getAllTaxCodes(int key_item, String key_year,
                String key_office,String key_client,String key_company){
            Connection conn = null;
            Statement stat = null;
            ResultSet rst = null;
            ItemTax taxCode;
            List taxCodes = new ArrayList();
            int itemNum = getItemNumber(key_item, key_year,
                    key_office,key_client,key_company);
            String select = "SELECT key_tax_code FROM "+
                    Constants.WEB_TABLE +" WHERE key_item = " + itemNum +
                    " AND key_year = '" + key_year + "'" +
                    " AND key_office = '" + key_office + "'" +
                    " AND key_client = '" + key_client + "'" +
                    " AND key_company = '" + key_company +"'";
            DbConnection dbConn = new DbConnection();
            try {
                conn = dbConn.getDbConnection(Constants.WEB_JNDI);
                stat = conn.createStatement();
                rst = stat.executeQuery(select);
                while(rst.next()){
                    taxCode = new ItemTax();
                    taxCode.setKey_tax_code(rst.getString("key_tax_code"));
                    taxCodes.add(taxCode);
            } catch (SQLException ex) {
                ex.printStackTrace();
            } finally{
                SQLHelper.cleanUp(rst, stat, conn);
            return taxCodes;
        //use tax code to get tax details
        public Map getItemTaxDetails(String key_year,String key_office,
                String key_client,String key_company,int key_item){
            ItemTax taxDetail = null;
            List taxDetails = new ArrayList();
            List itemTaxCodes = new ArrayList();
            Map itemTaxdetails = new HashMap();
            Connection conn = null;
            Statement stat = null;
            ResultSet rst = null;
            //get a list of all tax codes of an item with a
            //given item number
            itemTaxCodes = getAllTaxCodes(key_item,key_year,///a list of tax codes
                    key_office,key_client,key_company);
            DbConnection dbConn = new DbConnection();
            try {
                conn = dbConn.getDbConnection(Constants.WEB_JNDI);
                stat = conn.createStatement();
                for(Iterator taxCodeIter= itemTaxCodes.iterator(); taxCodeIter.hasNext();){
                    String taxCode = (String)taxCodeIter.next();/////casting taxtCode to string***exception occurs from here
                    String select = "SELECT tax_type,tax_value," +
                            "tax_limit_val FROM "+ Constants.WEB_TABLE +
                            " WHERE key_item = "+ key_item +
                            " AND key_year = '" + key_year + "'" +
                            " AND key_office = '" + key_office + "'" +
                            " AND key_client = '" + key_client + "'" +
                            " AND key_company = '" + key_company +"'" +
                            " AND key_tax_code = '" + taxCode + "'";///tax code string
                    rst = stat.executeQuery(select);
                    while(rst.next()){
                        taxDetail = new ItemTax();
                        //records to be displayed only
                        taxDetail.setKey_item(Integer.parseInt(rst.getString("key_item")));
                        taxDetail.setTax_value(rst.getString("tax_value"));
                        taxDetail.setTax_limit_val(Float.parseFloat(rst.getString("tax_limit_val")));
                        //////other details records ommited//////////////////////////
                        taxDetails.add(taxDetail);
                //a HashMap of all tax code as keys and list of details as values 4 each key
                for(int i = 0;i<itemTaxCodes.size(); i++){
                    itemTaxdetails.put(itemTaxCodes.get(i),taxDetails.get(i));
            } catch (SQLException ex) {
                ex.printStackTrace();
            } finally{
                SQLHelper.cleanUp(rst, stat, conn);
            return itemTaxdetails;
        //details of an item with all its taxes
        public List getAllItemDetails(String key_year,
                String key_office,String key_client,String key_company){
            List lineItems = new ArrayList();
            List itemNumbers = new ArrayList();
            Map taxDetails = new HashMap();
            LineItem item = null;
            Connection conn = null;
            Statement stat = null;
            ResultSet rst = null;
            //A list of all item numbers in the declaration
            itemNumbers = getAllItemNumbers(key_year,
                    key_office,key_client,key_company);
            DbConnection dbConn = new DbConnection();
            try {
                conn = dbConn.getDbConnection(Constants.WEB_JNDI);
                stat = conn.createStatement();
                for(Iterator itemIter= itemNumbers.iterator(); itemIter.hasNext();){
                    int itemNumber = ((Integer)itemIter.next()).intValue();
                    String select = "SELECT item_description,item_mass," +
                            "item_cost" +
                            " FROM " + Constants.WEB_TABLE +
                            " WHERE key_year = '"+key_year+"'" +
                            " AND key_office = '"+key_office+ "'"+
                            " AND key_client = '"+key_client+ "'"+
                            " AND key_company = '"+key_company+ "'"+
                            " AND key_item = " + itemNumber;
                    rst = stat.executeQuery(select);
                    while(rst.next()){
                        item = new LineItem();
                        item.setItem_description(rst.getString("item_description"));
                        item.setItem_mass(Float.parseFloat(rst.getString("item_mass")));
                        item.setKey_item(Integer.parseInt(rst.getString("item_cost")));
                        //////other details records ommited//////////////////////////
                        //A HashMap of all itemTaxeCodes as its keys and an ArrayList of itemTaxedetails as its values
                        taxDetails = getItemTaxDetails(item.getKey_year(),item.getKey_office(),
                                item.getKey_client(),item.getKey_company(),item.getKey_item());
                        //item tax details
                        item.setItmTaxes(taxDetails);
                        //list of items with tax details
                        lineItems.add(item);
            } catch (SQLException ex) {
                ex.printStackTrace();
            } finally{
                SQLHelper.cleanUp(rst, stat, conn);
            return lineItems;
        public Set getDeclarations(String key_year,String key_cuo,
                String key_dec,String key_nber){
            List lineItems = new ArrayList();
            Set lineOrders = new HashSet();
            Connection conn = null;
            Statement stat = null;
            ResultSet rst = null;
            LineOder lineOrder = null;
            String select = "SELECT * FROM " + Constants.WEB_TABLE +
                    " WHERE key_year = '" + key_year + "'" +
                    " AND key_cuo = '" + key_cuo + "'" +
                    " AND key_dec = '" + key_dec + "'" +
                    " AND key_nber = '" + key_nber + "'";
            DbConnection dbConn = new DbConnection();
            try {
                conn = dbConn.getDbConnection(Constants.WEB_JNDI);
                stat = conn.createStatement();
                rst = stat.executeQuery(select);
                while(rst.next()){
                    lineOrder = new LineOder();
                    lineOrder.setKey_year(rst.getString("key_year"));
                    lineOrder.setKey_office(rst.getString("key_cuo"));
                    lineOrder.setKey_client(rst.getString("key_dec"));
                    lineOrder.setKey_company(rst.getString("key_nber"));
                    ////list of items with all their details
                    lineItems = getAllItemDetails(lineOrder.getKey_year(),lineOrder.getKey_office(),
                            lineOrder.getKey_client(),lineOrder.getKey_company());
                    //setting item details
                    lineOrder.setItems(lineItems);
                    //a list of order with all details
                    lineOrders.add(lineOrder);
            } catch (SQLException ex) {
                ex.printStackTrace();
            } finally{
                SQLHelper.cleanUp(rst, stat, conn);
            return lineOrders;
    } and my testing servlet controller
    Controller.java
    package orderitems;
    import java.io.*;
    import java.util.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class Controller extends HttpServlet {
        private Map taxDetails = new HashMap();
        //private List itemDetails = new ArrayList();
        //private Set orderDetails = new HashSet();
        private OrderDetails orderDetails = null;
        protected void processRequest(HttpServletRequest request,
                HttpServletResponse response)throws
                ServletException, IOException {
            response.setContentType("text/html;charset=UTF-8");
            String key_year = "2007";
            String key_office = "VZX00";
            String key_company = "DG20";
            String key_client =  "ZI001";
            int key_item = 1;
            String nextView = "/taxdetails_list.jsp";
            //String nextView = "/order_list.jsp";
            //String nextView = "/items_list.jsp";
            orderDetails = new OrderDetails();
            taxDetails = orderDetails.getItemTaxDetails(key_year,key_office,
                    key_company,key_client,key_item);
            //Store the collection objects into HTTP Request
            request.setAttribute("taxDetails", taxDetails);
            RequestDispatcher reqstDisp =
                    getServletContext().getRequestDispatcher(nextView);
            reqstDisp.forward(request,response);
        protected void doGet(HttpServletRequest request,
                HttpServletResponse response)throws
                ServletException, IOException {
            processRequest(request, response);
        protected void doPost(HttpServletRequest request,
                HttpServletResponse response)throws
                ServletException, IOException {
            processRequest(request, response);
    }I have not included code for beans to reduce on bulk.please help and with suggestions...
    Thanx in advance.
    Edited by: aiEx on Oct 3, 2007 8:13 AM

    aiEx wrote:
    sometimes a tap on the head is needed to really learn and understand :-)You're casting them to the String type while they are of the ItemTax type and you've confirmed it yourself. Likely you misunderstood the concepts behind "casting" and you was expecting some magic that they are automatically converted somehow from the ItemTax type to the String type while the ItemTax class isn't a subclass of the String class :)

  • Please help me for Calendar class

    Now i am working in SAP.Now we are doing Internal project for Company Timesheet of the employee,they are using Java,javascript,html,jsp,mysql.
    Please give Support for developing this task
    I am trying to do employee's timesheet( i.e. daily working hours).Here i attach my documents.here in that screen i am selecting fig1 calendar date for 19th july 2006 now we can see it in fig2 there we will see 15th july 2006 to 21st july 2006 is visible. The scnario is when ever we select the any of the day of the week we need to display whole week sun,mon to sat.
    when i am selecting (select week days by using javascript) total weekly working hours should come.please guide me and give me sample code.
    I think you understand what i am asking. using javascript calendar i am selecting the date.and from database i have to get the daily working hours of the perticular employee. I am not so familiar in java,that's why only i am asking .Please help me
    Advance thanks for You
    code i am pasting here
    thanks&Regards
    Vijaya
    ********** Java code******************
    import java.util.Calendar;
    import java.util.Date;
    class FirstAndLastDay4
    public static void main(String[] args)
    //int i=1;
    try{
    Calendar date=Calendar.getInstance();
    int day = date.get(Calendar.DAY_OF_WEEK);
    switch(day){
    case(1):
    { System.out.println("\n Input date [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK));
    System.out.println("First day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("First day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("Last day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("First day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("Last day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("Last day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("Last day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    break;
    case(2):
    { System.out.println("\n Input date [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)-1);
    System.out.println("First day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("First day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("Last day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("First day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("Last day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("Last day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("Last day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    break;
    case(3):
    { System.out.println("\n Input date [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)-2);
    System.out.println("First day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("First day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("Last day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("First day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("Last day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("Last day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("Last day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    break;
    case(4):
    { System.out.println("\n Input date [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)-3);
    System.out.println("First day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("First day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("Last day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("First day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("Last day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("Last day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("Last day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    break;
    case(5):
    { System.out.println("\n Input date [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)-4);
    System.out.println("First day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    /*for(int i=0,j=1;i<7;i++)
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+i);
    System.out.println("Last day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("First day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("Last day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("First day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("Last day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("Last day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("Last day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("Last day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    break;
    case(6):
    { System.out.println("\n Input date [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)-5);
    System.out.println("First day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+6);
    System.out.println("Last day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("First day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("Last day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("First day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("Last day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("Last day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("Last day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    break;
    case(7):
    { System.out.println("\n Input date [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)-6);
    System.out.println("First day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+6);
    System.out.println("Last day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("First day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("Last day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("First day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("Last day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("Last day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("Last day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    break;
    }catch(Exception e){
    e.printStackTrace();
    }

    Hi All,
    I am trying to do employee's timesheet( i.e. daily working hours).Here i attach my documents.here in that screen i am selecting fig1 calendar date for 19th july 2006 now we can see it in fig2 there we will see 15th july 2006 to 21st july 2006 is visible. The scnario is when ever we select the any of the day of the week we need to display whole week sun,mon to sat.
    when i am selecting (select week days by using javascript) total weekly working hours should come.please guide me and give me sample code.
    Thanks in advance
    thanks & regards
    <code>
    import java.util.Calendar;
    import java.util.Date;
    class FirstAndLastDay
         public static void main(String[] args)
              try{
                   Calendar date=Calendar.getInstance();
                   int day = date.get(Calendar.DAY_OF_WEEK);
                   switch(day){
                        case(1):
                        {     System.out.println("\n Input date [" + new java.util.Date(date.getTimeInMillis()) + "]");
                             date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK));
                             System.out.println("First day [" + new java.util.Date(date.getTimeInMillis()) + "]");
                             date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+6);                         
                             System.out.println("Last day [" + new java.util.Date(date.getTimeInMillis()) + "]");
                             break;
                        case(2):
                        {     System.out.println("\n Input date [" + new java.util.Date(date.getTimeInMillis()) + "]");
                             date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)-1);
                             System.out.println("First day [" + new java.util.Date(date.getTimeInMillis()) + "]");
                             date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+6);                         
                             System.out.println("Last day [" + new java.util.Date(date.getTimeInMillis()) + "]");
                             break;
                        case(3):
                        {     System.out.println("\n Input date [" + new java.util.Date(date.getTimeInMillis()) + "]");
                             date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)-2);
                             System.out.println("First day [" + new java.util.Date(date.getTimeInMillis()) + "]");
                             date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+6);                         
                             System.out.println("Last day [" + new java.util.Date(date.getTimeInMillis()) + "]");
                             break;
                        case(4):
                        {     System.out.println("\n Input date [" + new java.util.Date(date.getTimeInMillis()) + "]");
                             date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)-3);
                             System.out.println("First day [" + new java.util.Date(date.getTimeInMillis()) + "]");
                             date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+6);                         
                             System.out.println("Last day [" + new java.util.Date(date.getTimeInMillis()) + "]");
                             break;
                        case(5):
                        {     System.out.println("\n Input date [" + new java.util.Date(date.getTimeInMillis()) + "]");
                             date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)-4);
                             System.out.println("First day [" + new java.util.Date(date.getTimeInMillis()) + "]");
                             date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+6);                         
                             System.out.println("Last day [" + new java.util.Date(date.getTimeInMillis()) + "]");
                             break;
                        case(6):
                        {     System.out.println("\n Input date [" + new java.util.Date(date.getTimeInMillis()) + "]");
                             date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)-5);
                             System.out.println("First day [" + new java.util.Date(date.getTimeInMillis()) + "]");
                             date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+6);                         
                             System.out.println("Last day [" + new java.util.Date(date.getTimeInMillis()) + "]");
                             break;
                        case(7):
                        {     System.out.println("\n Input date [" + new java.util.Date(date.getTimeInMillis()) + "]");
                             date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)-6);
                             System.out.println("First day [" + new java.util.Date(date.getTimeInMillis()) + "]");
                             date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+6);                         
                             System.out.println("Last day [" + new java.util.Date(date.getTimeInMillis()) + "]");
                             break;
              }catch(Exception e){
                   e.printStackTrace();
    </code>

Maybe you are looking for