Problem-Writing datas to a Servlet thro' URLConnection class

Hi,
Iam trying to post some string data to a servlet.
The servlet reads 2 parameters from url.And reads the xml string message thro post method.
So in the client program, I added those parameters to the URL directly like this,
"http://localhost/servlet/test?action1=value1&action2=value2" ,and created url object .
And using URLConnection iam trying to post the xml string.
But the servlet does not read the parameter values.Is my approach is correct?
client code:
package test;
import java.net.*;
import java.io.*;
import java.util.*;
public class Testxml{
public static void main(String ars[])
String XML="<?xml version='1.0'?><Test><msg>test message</msg></Test>";
String server="http://localhost/servlet/test";
String encodeString = URLEncoder.encode("action1") + "=" + URLEncoder.encode("something1")+"&"+URLEncoder.encode("action2") + "=" + URLEncoder.encode("something2");
try{
     URL u = new URL(server+"?"+encodeString);
     URLConnection uc = u.openConnection();
     uc.setDoOutput(true);
     uc.setUseCaches(false);
     uc.setRequestProperty("Content-type", "application/x-www-form-urlencoded");
     OutputStream out = uc.getOutputStream();
     PrintWriter wout = new PrintWriter(out);
     wout.write(alertXML);
     wout.flush();
     wout.close();
     System.out.println("finished");
     catch(Exception e) {
     System.out.println(e);
Servlet code:
package test;
import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class test extends HttpServlet {
public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
     performTask(req, res);
public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
     performTask(req, res);
public void performTask(HttpServletRequest request, HttpServletResponse response) {
     try{
String action1=request.getParameter("action1");
String action2=request.getParameter("action2");
if(action1.equals("something1") && action1.equals("something2") )
     ServletInputStream in = request.getInputStream();
     byte[] buffer = new byte[1024];
     String xmlMsg = "";
     int len = in.read(buffer,0,buffer.length);
     if(len>0)
     while (len > 0 ){
               xmlMsg += new String(buffer,0,len);
               len = in.read(buffer);
     System.out.println("xml : "+xmlMsg);
This is not working.Even,it does not invoke servlet.Is this approach is correct?.
Thanx,
Rahul.

Hi,
Did you get the answer to your problem? I am facing the same problem, so if you have the solution, please share the same.
TIA
Anup

Similar Messages

  • Problem with Date object in Servlet

    in following code what i want to do is to convert database date field date
    string in to Date format oject. here user entered date string is convered to Date object successfully but database date field date String is not converting to Date object and i want to compare two dates wheter user ented date is more than the database date field. Pls if u can correct this it is a big help for me.
    Thank u,
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    import java.util.Date;
    //import java.text.*;
    public class chkAvail extends HttpServlet
         Connection con=null;
         PreparedStatement ps1,ps2;
         PrintWriter out;
         String UArraDate="";
         String UDepaDate="";
         String ChkType="";     
         Date d2;
    String aDate="";
         public void doGet(HttpServletRequest req,HttpServletResponse res)throws IOException,ServletException
              d2=new Date();
              try
                   res.setContentType("text/html");
                   out=res.getWriter();
                   //UArraDate=req.getParameter("ArrDate");
                   //UDepaDate=req.getParameter("DepaDate");
                   //ChkType=req.getParameter("ChkType");
                   String mydb="jdbc:odbc:portal";
                   Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                   con=DriverManager.getConnection(mydb);
                   UArraDate="13/09/05";
                   Date d1=new Date(UArraDate);
                   ps1=con.prepareStatement("SELECT * FROM cottageReservation");
                   ResultSet re1=ps1.executeQuery();
                   while(re1.next())
                        //aDate=re1.getString("ADate");
                        //d2=java.sql.Date.valueOf(re1.getString("ADate"));
                        //out.println(d2);
                        aDate=re1.getString("ADate");
                        d2=new Date(aDate);
                        if(d1.after(d2))
                             System.out.println("OK");
                        else
                             System.out.println("NotOK");
              catch(SQLException e)
                   System.out.println(""+e);
              catch(ClassNotFoundException e)
              catch(Exception e)
    }

    Here is an example of how objects can be refered.....
    have a look
    //////////////////////////CustomDatumExample.java///////////////////////////////
    import java.sql.*;
    import oracle.jdbc.driver.*;
    import oracle.sql.*;
    import java.math.BigDecimal;
    public class CustomDatumExample
    /* Example invocation:
    java customDatumTest "jdbc:oracle:oci8:@" SCOTT TIGER \
    "oracle.jdbc.driver.OracleDriver"
    public static void main(String args []) throws Exception
    // Connect
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver ());
    OracleConnection conn = (OracleConnection)
    DriverManager.getConnection("jdbc:oracle:oci8:@",
    "scott", "tiger");
    // Create a Statement
    Statement stmt = conn.createStatement ();
    try
    stmt.execute ("drop table EMPLOYEE_TABLE");
    stmt.execute ("drop type EMPLOYEE");
    catch (SQLException e)
    // An error is raised if the table/type does not exist. Just ignore it.
    // Create and populate tables
    stmt.execute ("CREATE TYPE EMPLOYEE AS OBJECT(EmpName VARCHAR2(50),EmpNo INTEGER)");
    stmt.execute ("CREATE TABLE EMPLOYEE_TABLE (ATTR1 EMPLOYEE)");
    stmt.execute ("INSERT INTO EMPLOYEE_TABLE VALUES (EMPLOYEE('Susan Smith', 123))");
    stmt.close();
    // Create a CustomDatum object
    Employee e = new Employee("George Jones", new BigDecimal("456"));
    // Insert the CustomDatum object
    PreparedStatement pstmt
    = conn.prepareStatement ("insert into employee_table values (?)");
    pstmt.setObject(1, e, OracleTypes.STRUCT);
    pstmt.executeQuery();
    System.out.println("insert done");
    pstmt.close();
    // Select now
    Statement s = conn.createStatement();
    OracleResultSet rs = (OracleResultSet)
    s.executeQuery("select * from employee_table");
    while(rs.next())
    Employee ee = (Employee) rs.getCustomDatum(1, Employee.getFactory());
    System.out.println("EmpName: " + ee.empName + " EmpNo: " + ee.empNo);
    rs.close();
    s.close();
    if (conn != null)
    conn.close();
    /////////////////////////////////////////////////Employee.java///////////////////////////////////
    import java.math.BigDecimal;
    import java.sql.SQLException;
    import oracle.jdbc.driver.OracleConnection;
    import oracle.sql.*;
    public class Employee implements CustomDatum, CustomDatumFactory
    static final Employee _employeeFactory = new Employee(null, null);
    public static CustomDatumFactory getFactory()
    return _employeeFactory;
    public Employee ()
    /* constructor */
    public Employee(String empName, BigDecimal empNo)
    this.empName = empName;
    this.empNo = empNo;
    /* CustomDatum interface */
    public Datum toDatum(OracleConnection c) throws SQLException
    StructDescriptor sd =
    StructDescriptor.createDescriptor("SCOTT.EMPLOYEE", c);
    Object [] attributes = { empName, empNo };
    return new STRUCT(sd, c, attributes);
    /* CustomDatumFactory interface */
    public CustomDatum create(Datum d, int sqlType) throws SQLException
    if (d == null) return null;
    Object [] attributes = ((STRUCT) d).getAttributes();
    return new Employee((String) attributes[0],
    (BigDecimal) attributes[1]);
    /* fields */
    public String empName;
    public BigDecimal empNo;
    }

  • Problem writing to output using servlet

    Hi All,
    I created a servlet which reads file and writes to output . This works fine
    when request protocol is http . But if protocol is changed to https servlet doesnt write to output. This servlet is deployed in secure environment as EAR project .But pops up error in popup
    Internet explorer cannot download /ImageServlet/.... from the server....
    requested site is unavailable.
    Here is my servlet code
                        String key = request.getParameter("key");
                        if( key != null){
                             String[] keys = key.split(":");
                             System.out.println("request.getAuthType() :"+ request.getAuthType());
                             if(request.getAuthType() != null){
                             if(keys != null && keys.length >1){
                                  ImageUtil imageUtil = new ImageUtil();
                                  byte[] bytes = imageUtil.getDocumentContent(keys[0]);
                                  ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
                                  BufferedInputStream bis = new BufferedInputStream(bais);
                                  ServletOutputStream out = response.getOutputStream();
                                  BufferedOutputStream bos = new BufferedOutputStream(out);
                                  response.reset();
                                  if(keys[1].equalsIgnoreCase("doc") ) {
                                       response.setContentType("application/msword;charset=utf-8");
                                       response.setHeader("Content-Disposition","inline;filename=\"file.doc\";");
                                  }else if(keys[1].equalsIgnoreCase("xls") ) {
                                       response.setContentType("application/vnd.ms-excel");
                                       response.setHeader("Content-Disposition","inline;filename=\"file.xls\";");
                                  }else if(keys[1].equalsIgnoreCase("rtf") ){
                                       response.setContentType("application/msword");
                                       response.setHeader("Content-Disposition","inline;filename=\"file.rtf\";");                         
                                  }else if(keys[1].equalsIgnoreCase("html") || keys[1].equalsIgnoreCase("htm")){
                                       response.setContentType("text/html");
                                       response.setHeader("Content-Disposition","inline;filename=\"file.html\";");                         
                                  }else if(keys[1].equalsIgnoreCase("txt")){
                                       response.setContentType("text/plain");
                                       response.setHeader("Content-Disposition","inline;filename=\"file.txt\";");                         
                                  //setting some response headers
                                  response.setHeader("Cache-Control","no-store, no-cache, must-revalidate,post-check=0, pre-check=0"); //HTTP 1.1
                                  response.setHeader("Pragma","no-cache"); //HTTP 1.0
                                  response.setDateHeader ("Expires", 0);
                             int i;
                             while ( (i = bis.read(bytes)) > 0)
                                  bos.write(bytes,0,i);
                             bos.flush();               
                             bos.close();
                             bis.close();
                             bais.close();
                             System.out.println("Has written");
                             }else{
                                  log.error("Key is not good.");
                   }else{
                        log.error("Please enter key for streaming.");
              }catch(Exception e)     {
    log.error(e.toString());
    e.printStackTrace();
    In web.xml
         <servlet>
              <servlet-name>ImageServlet</servlet-name>
              <servlet-class>
                   com.pfpc.opdesktop.image.servlet.ImageServlet
              </servlet-class>
         </servlet>     
         <servlet-mapping>
         <servlet-name>ImageServlet</servlet-name>
         <url-pattern>/ImageServlet/*</url-pattern>
         </servlet-mapping>
         <security-constraint>
              <display-name>ImageServlet</display-name>
              <web-resource-collection>
                   <web-resource-name>ImageServlet</web-resource-name>
                   <description>ImageServlet</description>
                   <url-pattern>/ImageServlet/*</url-pattern>
                   <http-method>GET</http-method>
                   <http-method>POST</http-method>
                   <http-method>OPTIONS</http-method>
              </web-resource-collection>
              <auth-constraint>
                   <description>ImageServlet</description>
                   <role-name>ImageServlet</role-name>
              </auth-constraint>
              <user-data-constraint>
                   <transport-guarantee>NONE</transport-guarantee>
              </user-data-constraint>
         </security-constraint>
              <security-role>
              <description>ImageServlet - OpDesktopWAR</description>
              <role-name>ImageServlet</role-name>
         </security-role>
    In application.xml
         <security-role id="SecurityRole_1164052833984">
              <description>ImageServlet - OpDesktopWAR</description>
              <role-name>ImageServlet</role-name>
         </security-role>
    Can anyone please tell me what is problem.very urgent.
    Thankyou

    Hi,
    Found the solution for the problem. For some reason
    response.setHeader("Cache-Control","no-store, no-cache, must-revalidate,post-check=0, pre-check=0"); //HTTP 1.1
                                  response.setHeader("Pragma","no-cache"); //HTTP 1.0
                                  response.setDateHeader ("Expires", 0);
    These header settings were causing this issue. If I take out these settings then it works
    FYI
    Thankyou very much for all help

  • Problem writing a New ToPass inheriting from ToCustom.class

    Hi,
    we are writing a new ToPass but we have two problems:
    For a deletion of a user we need two parameters, but the method "deleteEntryCustom(String arg0)" only supports one parameter. We tried to concatenate two parameters and split them within the method, but we always get the same error-Message "putNextEntry failed storing ....".
    Is anybody out there, who can help?
    Kind regards,
    Achim Heinekamp

    Hi Dominik,
    thank you for your Reply.
    I think, the problem is not the InitCustom().
    We use the InitCustom() to establish a connection to the target.
    With the entry "changetype = delete" in the ToPass-Configuration the method "deleteEntryCustom()" is going to be started, isn't it?
    I tried returncodes "0" and "1" für "deleteEntryCustom". I haven't tried any other numbers.
    I tried the method "logIt()" several times but it didn't help me with this particular problem.
    I forgot the information, that the deletion was executed.
    best regards,
    Achim
    Edited by: Achim Heinekamp on Aug 13, 2008 1:35 PM

  • Problem in writing data to excel spread sheet using jdbc

    Hi Friend,
    I have written a jdbc application ,that retrives data from oracle8i database and writes to excel spread sheet.
    Here I am facing a problem while writing date vales to the spread sheet.
    It is just writing 00.00.0 , instead of a date like 21/10/2005, where I am going wrong , can any one guide me.
    Thanks in advance.

    Don't cross-post!
    http://forum.java.sun.com/thread.jspa?threadID=643815&tstart=0
    Especially when you already got your answer in the other post jackass. If you don't understand the answer then say so there.

  • Problem while writing data on xls file using jxl API

    Hi,
    I am getting problem while writing data on excel file using jxl api.
    When i write data on file and all handles associated to the file are closed, file size increases but when i open the file nothing is written in it and when file is closed manually from excel window, file size decreased to its original that was before writing data.
    here is code:
              FileOutputStream os = new FileOutputStream(this.dirPath + this.fileName, true);
              WritableWorkbook this.workbook = Workbook.createWorkbook(os);
    after writing data following handler are closed:
    this.os.flush();
                        this.workbook.write();
                        this.workbook.close();
                        this.os.close();
                        this.os = null;
    can any body help me.
    Thanks in advance

    Err, I did help you. I did understand your problem; and I solved it for you. What was missing was that you apparently made no effort to understand what you were being told. Or even consider it. You just argued about it, as though you were the one with the solution, instead of the one whose code didn't work.
    And the other thing that was missing was the part where you said 'thank you' to me for solving your problem. Somewhat more appropriate than biting the hand that fed you, frankly. I do this for nothing, on my own gas, and it's extremely irritating when people keep asking about problems I have already solved for them. I am entitled to discourage that. It's part of making them more efficient actually.
    But it happens often enough that it also makes me think I'm just wasting my time. Probably I am.

  • Facing problem in writing data to excel sheet using ActiveX

    Hi.
    I want to write data from a one dimesional array to a particular excel sheet in a particular row.Please see the attached vi for explantion.
    It is giving error.But If I give a new file name when the appliation is getting closed it is writing data to the new excel file.
    Please help.
    Thanks in advance
    Attachments:
    Excel sheetWrite.vi ‏90 KB

    Thanks Jhoskin and Rudi .......
    I am able to write data to excel sheet now. I am attaching one"test.zip" file that contains a VI named "Squence.vi "that contains another subVI named "Write U94006 Table To XL.vi"which does the functionality of counting the number of rows in the excel sheet and writing data in the next blank row. I am using the same subVI in the VI named "Sequence.vi"two times so it is taking a lot of time in opening and closing the excel sheet. Will you please suggest some way of calling the subVI only one time.
    Rikki
    Attachments:
    Test.zip ‏105 KB

  • Problem in writing data to flat file

    Hi,
    I have created an interface with table as source and file as target. My interface is running from long time but its not writing data into file. Any clue?
    -Chikk

    Hi,
    Please, take a look if the target file is locked.
    Try to delete it and put the "Truncate" option from IKM to yes.
    Cezar

  • Reading client-posted data via Tomcat servlet

    Hi,
    I'm doing some simple client/servlet communication using Tomcat, using POST's via an HttpURLConnection.
    I'm seeing my data at the servlet side via getInputStream(), but I can't decode it to a String, even by using InputStreamReader (which is supposed to do that). If I send a 5 character String, at the servlet I see "^@^@^@^@^@". I've tried constructing a String from a byte[], but it doesn't decode, either.
    I've tried writing the data as text with PrintWriter on the client side, and then reading text on the servlet side with getReader(), but getReader() returns null.
    I'm beginning to wonder if the problem is within Tomcat itself.
    Reading the docs and api's leads me to believe this should be very straightforward, but it's just not working.
    Any thoughts would be greatly appreciated!!!

    Here's the code... but there's been a strange twist:
    (client side)
    private void writeStringAsText(OutputStream outputStream, String content) throws UnsupportedEncodingException
    PrintWriter printer = new PrintWriter(outputStream);
    String encoded = URLEncoder.encode(content,"UTF-8");
    System.err.println("asText is [" + content + "], encoded = [" + encoded + "]");
    printer.println(encoded);
    printer.flush();
    printer.close();
    Servlet side:
    BufferedReader reader = request.getReader();
    StringBuffer sBuf = new StringBuffer();
    while ((line = reader.readLine()) != null){
    sBuf.append(line);
    Yesterday the problem disappeared, but it reappeared today.
    So, yesterday, the above code worked fine. Today I learned that
    a call to reader.ready() (servlet side) returns false.
    Does anyone know why a BufferedReader would return ready() == false??
    (Other than what the Javadoc say)
    Thanks in advance!

  • Sending data to a Servlet. EOFException and StreamCorruptedException.

    Hi!
    I have a small servlet that receives some text from a client, and returns a response. The problem is that when i try to receive the data in the servlet, I get and EOFException. And when the client tries to read the response, a StreamCorruptedException is thrown. Can anybody please point me in the right direction here?
    The code for servlet is as follows:
         protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
              DataInputStream in = new DataInputStream((InputStream) request.getInputStream());
              String message;
              String text = null;
              try {
                   text = in.readUTF();//EOFException thrown here!
                   message = "100 ok";
              } catch (Throwable t) {
                   message = "200 " + t.toString();
              response.setContentType("text/html;charset=UTF-8");
              response.setContentLength(message.length());
              in.close();
              PrintWriter out = response.getWriter();
              out.println(message);
              out.flush();
              out.close();
              System.out.println(". Received text: " + text == null ? "none" : text);
         }And the code for the client:
         @Test
         public void test2() throws IOException, ClassNotFoundException {
              String input = "This text is to be sent";
              URL serverURL = new URL("http://localhost:8080/myURL");
              URLConnection con = serverURL.openConnection();
              con.setDoInput(true);
              con.setDoOutput(true);
              con.setUseCaches(false);          
              con.setRequestProperty("Content-Type", "application/x-java-serialized-object");
              OutputStream outstream = con.getOutputStream();
              ObjectOutputStream oos = new ObjectOutputStream(outstream);
              oos.writeObject(input);
              oos.flush();
              oos.close();
              InputStream instr = con.getInputStream();
              ObjectInputStream inputFromServlet = new ObjectInputStream(instr);//StreamCorruptedException thrown here ("invalid stream header")
              String result = (String) inputFromServlet.readObject();
              inputFromServlet.close();
              instr.close();
              System.out.println(result);
         }The EOFException is thrown at the line text = in.readUTF(); in the servlet, and the StreamCorruptedException is thrown at ObjectInputStream inputFromServlet = new ObjectInputStream(instr); in the client. What is wrong here?
    Edited by: Fush on Apr 15, 2008 6:59 AM
    Edited by: Fush on Apr 15, 2008 7:00 AM
    Edited by: Fush on Apr 15, 2008 7:03 AM

    Your server reads a UTF-encoded String with readUTF().
    So your client should write a UTF-encoded String with writeUTF().
    Your server writes lines with PrintWriter.println().
    So your client should read lines with BufferedReader.readLine().

  • A problem with data acquisitioning in LV 7.1 (transition from Traditional NI-DAQ to NI-DAQmx)

    Hi to everyone,
    I have a problem with data acquisitioning in LV 7.1.
    I made a transition from Tradiotional NI-DAQ to NI-DAQmx in my LabVIEW application.
    The problem I have is that when I acquire data in Traditional (without writing somewhere -
    just reading) then there is no scan backlog data. But when I acquire data in application that
    acquisition is based on DAQmx than a scan backlog indicator shows numbers from 20 to 50 for
    about 6 min and then that number quite quickly increases until I get an error (unable to
    acquire data. The data was overwritten).
    Acquisition settings are the same in both cases. When I acquire with DAQmx I use a global
    channels. Is a reason for that phenomenon in global channels data procesing? But it seems
    strange why does it flows quite smoothly for about 6 min and then it stucks?
    Best regards,
    Ero

    If you have an old Daq unit it may not be compatible with DAQMX. Which DAQ unit do you have? I think NI have a list showing which DAQ driver you can use with your card
    Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
    (Sorry no Labview "brag list" so far)

  • I am writing datas into a FIFO ,i am reading datas from fifo .but when i am writing datas like a a(0),a(1),a(2 like that.when i am reading dating datas a(0)comes to a(3 ) rd place .what is the reason ?

    I am writing datas into a FIFO in FPGA Target side  ,i am reading datas from fifo in windows host side  .but when i am writing datas like a a(0),a(1),a(2 like that.when i am reading dating datas a(0)comes to a(3 ) rd place, a(1) comes to a a(0) .what is the reason ?

    Please use a shorter title in your subject line and not post the entire question in therre.  (See the subject line I created.)   There is also no such word as "datas".  Data is already plural.
    Please read http://stackoverflow.com/help/how-to-ask.  Your question is hard to read because you aren't using proper punctuation and capitalization of your sentences.  It looks like one run-on sentence.
    Beyond that, it is impossible to help you solve our problem with just your question.  Please provide some more information.  Perhaps even attach code we can look at.  Show us what the data you are sending is supposed to look like, and what it actually looks like.

  • How can i get an Applet transfer data to a servlet like a Form does?

    it is clear that URL class provides way to connect to remote web resource. and furthermore i am trying to make an applet perform like a Form in html to send user data to a servlet. i may adhere a long name-value string to url sent by applet but this is not a good way to hide information like hidden variables. Is there any class in J2SE package that i can wrap those Form data and send them in the way Form does...?
    cheers!

    Double posted
    http://forum.java.sun.com/thread.jspa?threadID=578770&messageID=2913924#2913924
    In your other post:
    but i just don't want to build a string with serlet name followed by many NV pairs tthis is a GET request:
    myURL?name=value&name=value
    To use a POST
    http://javaalmanac.com/egs/java.net/Post.html
    This still requires you to make a VP string that you write to an outputstream of the
    URLConnection. There is no other way to do this unless in an applet.

  • Problem finding data in an Oracle Database using CMP beans

    I am having a problem retrieving data from an Oracle database that has a date as
    part of the key. This data was loaded into my database via a batch process writing
    in java using java.sql.Date to store the date information. When calling the findByPrimaryKey
    method of a CMP Entity Bean I continued to get the FinderException. I know this
    data is in my database because I can view the data via SQLPlus and Microsoft Access.
    Has anyone ever experience problems with CMP beans accessing data from an Oracle
    database that had a date as part if the key or with accessing data in the database
    that insert via another method outside of your CMP bean. I desperately need some
    answers.

    Hi Dave,
    You should probably post this type of question in the CMP or JDBC section
    for best results. Chances are that the date is suffering from a rounding
    problem (it could be a date/time in the database with a different time zone)
    or is not the date that you think it is (wrong century or millenium). I've
    seen both. You need to write a quick piece of code that loads in those
    values as both Java timestamps and dates and makes sure that they are what
    you think they are.
    Peace,
    Cameron Purdy
    Tangosol Inc.
    Tangosol Coherence: Clustered Coherent Cache for J2EE
    Information at http://www.tangosol.com/
    "Dave White" <[email protected]> wrote in message
    news:3c1a4ac3$[email protected]..
    >
    I am having a problem retrieving data from an Oracle database that has adate as
    part of the key. This data was loaded into my database via a batchprocess writing
    in java using java.sql.Date to store the date information. When callingthe findByPrimaryKey
    method of a CMP Entity Bean I continued to get the FinderException. Iknow this
    data is in my database because I can view the data via SQLPlus andMicrosoft Access.
    Has anyone ever experience problems with CMP beans accessing data from anOracle
    database that had a date as part if the key or with accessing data in thedatabase
    that insert via another method outside of your CMP bean. I desperatelyneed some
    answers.

  • Problem in date formatting DD-MMM-YYYY

    Hi,
    I am writing a method in my Application:
    //@@begin FormatDate()
    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-mm-dd");
         Date d;
         String OutDate = "";
         try {
              d = dateFormat.parse(InDate);
              dateFormat.applyPattern("DD-MMM-YYYY");
              OutDate = dateFormat.format(d);
         } catch (ParseException e) {
              wdComponentAPI.getMessageManager().reportWarning("Date Parse Exception");
         return (OutDate);
        //@@end
    The OutDate that I get is in Format DD-MMM-YYYY but MMM is in digits instead of letters i.e. for 2007-07-31 it gives 31-007-2007 instead of 31-Jul-2007.
    Any clues to get proper output??
    I have tried applying format DD-MON-YYYY it too doesn't help.
    Thanks
    Anagha

    Hi ..
    check this link..
    https://help.sap.com/javadocs/NW04/current/wd/com/sap/tc/webdynpro/services/sal/localization/api/IWDResourceHandler.html
    https://help.sap.com/javadocs/NW04S/current/wd/com/sap/tc/webdynpro/services/sal/localization/api/IWDResourceHandler.html#formatDate(java.util.Date)
    How to calculate next date in Java
    Re: Problem with DATE field
    Hope this will helpful for u..
    Urs GS

Maybe you are looking for

  • How do i transfer files from my old pc to my new i mac

    How do i transfer files from my old pc to my new i mac

  • Using HTTPS and SSH from LabVIEW VIs

    I am currently using custom VIs, built over the TCP/IP LabVIEW VIs, to access to a distant machine with the TELNET protocol, and to access a HTTP server with the HTTP protocol. In a near future, I will have to use more secure protocols such as SSH an

  • IPad Air won't update to OSX 8.0.2

    I have a 16GB iPad Air. There is not enough room left to update wirelessly to OSX 8.0.2. so I've been trying to do it via iTunes on my MBP.  All seems to go OK for first 10 minutes or so of download, but then I keep getting a message saying that ther

  • Forms Logon options

    Hi all, What are the options do i have if i want to create a logon form . I don't want to use logon form provided and it has few options .... i would like to create my own logon form..... do i have to use data block if i have a simple form like usern

  • Problems with 2 I cloud accounts

    Hi,       I have an I phone 4 which for the last 12 months has worked fine and updated I cloud without problem,however yesterday i ddecided i wanted to change the phone to use my me.com address as the Apple id and use it as my only email address.I de