Request.getParameter() always returns null

I have a html file and am trying to retrieve the values from a formin my servlet.
here is the html code:
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<h1><b>Add DVD</b></h1>
</head>
<body>
<form action="add_dvd.do" method="POST">
Title:<input type="text" name="title" />
Year:<input type="text" name="year" />
Genre: <select name='gselected'>
<option value='Sci-Fi'>Sci-Fi</option>
</select>
or enter new genre:<input type="text" name='gentered' value="" />
<input type="submit" value="Add DVD" />
</form>
</body>
</html>
and here is the servlet code:
public class AddDVDServlet extends HttpServlet {
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
// System.out.println("in AddDVDServlet post method");
List errorMsgs = new LinkedList();
//retrieve form parameters
try{
String title = request.getParameter("title").trim();
String year = request.getParameter("year").trim();
*String gentered = request.getParameter("gentered");
String gselected = request.getParameter("gselected");
String genre="";
if("".equals(gentered))
genre = gselected;
else
genre = gentered;
// System.out.println("parameter retrieved");
if(!year.matches("\\d\\d\\d\\d"))
// System.out.println("year not 4 digit long");
errorMsgs.add("Year must be four digit long");
if("".equals(title))
// System.out.println("title not entered");
errorMsgs.add("Please enter the title of the dvd");
if("".equals(genre))
// System.out.println("genre not valid");zdf
errorMsgs.add("Enter genre.");
if(! errorMsgs.isEmpty())
//System.out.println("errors in entry ");
request.setAttribute("errors",errorMsgs);
// System.out.println("error attribute set in request");
RequestDispatcher rd = request.getRequestDispatcher("error.view");
rd.forward(request, response);
return;
//create DVDItem instance
DVDItem dvd = new DVDItem(title,year,genre);
request.setAttribute("dvdItem",dvd);
RequestDispatcher rd = request.getRequestDispatcher("success.view");
rd.forward(request, response);
catch(Exception e){
errorMsgs.add(e.getMessage());
request.setAttribute("errors",errorMsgs);
RequestDispatcher rd = request.getRequestDispatcher("error.view");
rd.forward(request, response);
e.printStackTrace();
System.out.println("exception:"+e);
why does getParameter always return null??? whats wrong?

I don't know. However, I suspect that because you have a tag with the same name as 'title', its causing a name conflict. Chnage the name to something else. If it works, then that's the likely explaination.

Similar Messages

  • Request.getParameter("_ROWKEY") returns null in JDev 3.2

    My SubmitEditForm.jsp uses a bean which inherits from the EditCurrentRecord data web bean. In JDeveloper 3.1 'request.getParameter("ROWKEY")' in this JSP returns the rowkey for the record being edited, but in JDeveloper 3.2 'request.getParameter("_ROWKEY")' returns null. No modifications have bean made to the application - the working JDeveloper 3.1 app has only been compiled in JDeveloper 3.2. Can anyone help please?

    Hi,
    This exception is raised when the multipart/form-data parser has read the number of bytes specified by the Content-Length HTTP header, or tries to read past the end of the input stream, but has not parsed to the end of the message. As implied by the error text, this can happen for a couple of reasons.
    Although its unlikely, it is possible for a client to sent an incorrect Content-Length header. However, we've so far only seen this with a user-written HTTP client. We have yet to see a browser send the wrong value.
    The usual reason for this error is if a user hits the stop button while submitting a form. If the browser has already sent the HTTP header, including Content-Type, then the parser will try to read the entire message. However, this is going to fail, as the browser stops sending the request as soon as the stop button is pressed.
    Finally, there is one more possible reason for this error, and that is if the request is somehow being 'munged' in some way between the browser and the servlet container.
    To help us better understand what is happening here, can you supply
    the following information:
    - Does this problem happen consistently or occur only randomly?
    - When it does happen, is it repeatable, or does it go away if the user hits the submit button again?
    - Does it happen with certain HTML forms, any HTML form, or is it specific to the data entered into a pariticular form?
    - Does it happen with any browser, or a specific version and/or implementation?
    - What is your network configuration? For example, does the problem occur only when going through a proxy server or fire wall.
    - Does it depend on network load? For example, does it happen only at heavy load times?
    - What is you web server configuration, on what platform are you running it, and what JDK version are you using?
    As I'm writing this, the TAR system is down for upgrades - my apologies if you've already supplied this information.
    Regards,
    Simon
    null

  • Call thirty party java web service but always return null

    hi
    I call a java web service in my application visual studio 2008 c#, but always return NULL.
    I used Tool Fiddler to monitor the traffic between my client and the web service server, it showed the return is not Null.
    Here is my code, please see if anything I do wrong.
    namespace CanOfficer_THQ_vs_IHQ.TestWebReferenceAppointment {
    using System.Diagnostics;
    using System.Web.Services;
    using System.ComponentModel;
    using System.Web.Services.Protocols;
    using System;
    using System.Xml.Serialization;
    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.5483")]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    [System.Web.Services.WebServiceBindingAttribute(Name="AppointmentServiceSoapBinding", Namespace="http://service.ips.salvationarmy.org/")]
    public partial class AppointmentService : Microsoft.Web.Services3.WebServicesClientProtocol {
    private System.Threading.SendOrPostCallback deleteAppOperationCompleted;
    private System.Threading.SendOrPostCallback importAppOperationCompleted;
    private System.Threading.SendOrPostCallback editAppOperationCompleted;
    private bool useDefaultCredentialsSetExplicitly;
    /// <remarks/>
    public AppointmentService() {
    this.Url = global::CanOfficer_THQ_vs_IHQ.Properties.Settings.Default.CanOfficer_THQ_vs_IHQ_TestWebReferenceAppointment_AppointmentService;
    if ((this.IsLocalFileSystemWebService(this.Url) == true)) {
    this.UseDefaultCredentials = true;
    this.useDefaultCredentialsSetExplicitly = false;
    else {
    this.useDefaultCredentialsSetExplicitly = true;
    public new string Url {
    get {
    return base.Url;
    set {
    if ((((this.IsLocalFileSystemWebService(base.Url) == true)
    && (this.useDefaultCredentialsSetExplicitly == false))
    && (this.IsLocalFileSystemWebService(value) == false))) {
    base.UseDefaultCredentials = false;
    base.Url = value;
    public new bool UseDefaultCredentials {
    get {
    return base.UseDefaultCredentials;
    set {
    base.UseDefaultCredentials = value;
    this.useDefaultCredentialsSetExplicitly = true;
    /// <remarks/>
    public event deleteAppCompletedEventHandler deleteAppCompleted;
    /// <remarks/>
    public event importAppCompletedEventHandler importAppCompleted;
    /// <remarks/>
    public event editAppCompletedEventHandler editAppCompleted;
    /// <remarks/>
    [System.Web.Services.Protocols.SoapDocumentMethodAttribute(
    RequestNamespace="http://service.ips.salvationarmy.org/",
    ResponseNamespace="http://service.ips.salvationarmy.org/",
    Use=System.Web.Services.Description.SoapBindingUse.Encoded,
    ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
    [return: System.Xml.Serialization.XmlElementAttribute("return", Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
    public string deleteApp([System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] int id) {
    object[] results = this.Invoke("deleteApp", new object[] {
    id});
    return ((string)(results[0]));
    /// <remarks/>
    public void deleteAppAsync(int id) {
    this.deleteAppAsync(id, null);
    /// <remarks/>
    public void deleteAppAsync(int id, object userState) {
    if ((this.deleteAppOperationCompleted == null)) {
    this.deleteAppOperationCompleted = new System.Threading.SendOrPostCallback(this.OndeleteAppOperationCompleted);
    this.InvokeAsync("deleteApp", new object[] {
    id}, this.deleteAppOperationCompleted, userState);
    private void OndeleteAppOperationCompleted(object arg) {
    if ((this.deleteAppCompleted != null)) {
    System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
    this.deleteAppCompleted(this, new deleteAppCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
    /// <remarks/>
    [System.Web.Services.Protocols.SoapDocumentMethodAttribute(
    RequestNamespace="http://service.ips.salvationarmy.org/",
    ResponseNamespace="http://service.ips.salvationarmy.org/",
    Use=System.Web.Services.Description.SoapBindingUse.Encoded,
    ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
    [return: System.Xml.Serialization.XmlElementAttribute("return", Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
    public string importApp(
    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] int person,
    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] string name,
    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] string territory,
    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] string location,
    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] bool primary,
    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] Nullable<System.DateTime> start,
    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] Nullable<System.DateTime> end,
    [System.Xml.Serialization.XmlElementAttribute("categories", Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] string[] categories) {
    object[] results = this.Invoke("importApp", new object[] {
    person,
    name,
    territory,
    location,
    primary,
    start,
    end,
    categories});
    return ((string)(results[0]));
    /// <remarks/>
    public void importAppAsync(int person, string name, string territory, string location, bool primary, Nullable<System.DateTime> start, Nullable<System.DateTime> end, string[] categories) {
    this.importAppAsync(person, name, territory, location, primary, start, end, categories, null);
    /// <remarks/>
    public void importAppAsync(int person, string name, string territory, string location, bool primary, Nullable<System.DateTime> start, Nullable<System.DateTime> end, string[] categories, object userState) {
    if ((this.importAppOperationCompleted == null)) {
    this.importAppOperationCompleted = new System.Threading.SendOrPostCallback(this.OnimportAppOperationCompleted);
    this.InvokeAsync("importApp", new object[] {
    person,
    name,
    territory,
    location,
    primary,
    start,
    end,
    categories}, this.importAppOperationCompleted, userState);
    private void OnimportAppOperationCompleted(object arg) {
    if ((this.importAppCompleted != null)) {
    System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
    this.importAppCompleted(this, new importAppCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
    /// <remarks/>
    [System.Web.Services.Protocols.SoapDocumentMethodAttribute(
    RequestNamespace="http://service.ips.salvationarmy.org/",
    ResponseNamespace="http://service.ips.salvationarmy.org/",
    Use=System.Web.Services.Description.SoapBindingUse.Encoded,
    ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
    [return: System.Xml.Serialization.XmlElementAttribute("return", Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
    public string editApp(
    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] int id,
    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] string name,
    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] string territory,
    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] string location,
    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] bool primary,
    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] Nullable<System.DateTime> start,
    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] Nullable<System.DateTime> end,
    [System.Xml.Serialization.XmlElementAttribute("categories", Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] string[] categories) {
    object[] results = this.Invoke("editApp", new object[] {
    id,
    name,
    territory,
    location,
    primary,
    start,
    end,
    categories});
    return ((string)(results[0]));
    /// <remarks/>
    public void editAppAsync(int id, string name, string territory, string location, bool primary, Nullable<System.DateTime> start, Nullable<System.DateTime> end, string[] categories) {
    this.editAppAsync(id, name, territory, location, primary, start, end, categories, null);
    /// <remarks/>
    public void editAppAsync(int id, string name, string territory, string location, bool primary, Nullable<System.DateTime> start, Nullable<System.DateTime> end, string[] categories, object userState) {
    if ((this.editAppOperationCompleted == null)) {
    this.editAppOperationCompleted = new System.Threading.SendOrPostCallback(this.OneditAppOperationCompleted);
    this.InvokeAsync("editApp", new object[] {
    id,
    name,
    territory,
    location,
    primary,
    start,
    end,
    categories}, this.editAppOperationCompleted, userState);
    private void OneditAppOperationCompleted(object arg) {
    if ((this.editAppCompleted != null)) {
    System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
    this.editAppCompleted(this, new editAppCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
    /// <remarks/>
    public new void CancelAsync(object userState) {
    base.CancelAsync(userState);
    private bool IsLocalFileSystemWebService(string url) {
    if (((url == null)
    || (url == string.Empty))) {
    return false;
    System.Uri wsUri = new System.Uri(url);
    if (((wsUri.Port >= 1024)
    && (string.Compare(wsUri.Host, "localHost", System.StringComparison.OrdinalIgnoreCase) == 0))) {
    return true;
    return false;
    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.5483")]
    public delegate void deleteAppCompletedEventHandler(object sender, deleteAppCompletedEventArgs e);
    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.5483")]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    public partial class deleteAppCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
    private object[] results;
    internal deleteAppCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
    base(exception, cancelled, userState) {
    this.results = results;
    /// <remarks/>
    public string Result {
    get {
    this.RaiseExceptionIfNecessary();
    return ((string)(this.results[0]));
    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.5483")]
    public delegate void importAppCompletedEventHandler(object sender, importAppCompletedEventArgs e);
    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.5483")]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    public partial class importAppCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
    private object[] results;
    internal importAppCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
    base(exception, cancelled, userState) {
    this.results = results;
    /// <remarks/>
    public string Result {
    get {
    this.RaiseExceptionIfNecessary();
    return ((string)(this.results[0]));
    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.5483")]
    public delegate void editAppCompletedEventHandler(object sender, editAppCompletedEventArgs e);
    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.5483")]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    public partial class editAppCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
    private object[] results;
    internal editAppCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
    base(exception, cancelled, userState) {
    this.results = results;
    /// <remarks/>
    public string Result {
    get {
    this.RaiseExceptionIfNecessary();
    return ((string)(this.results[0]));

    Hi;
    I used Fiddler to monitor the process, and it showed the request sent thru web service worked and returned a value, but in my .Net application the return captured as NULL. Could you please look into the code above and the result from Filddler and see if
    you can help.
    thank you.
    REQUEST:
    POST https://159.253.140.178/services/AppointmentService HTTP/1.1
    User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client Protocol 2.0.50727.4252)
    Content-Type: text/xml; charset=utf-8
    SOAPAction: ""
    Host: 159.253.140.178
    Content-Length: 1589
    Expect: 100-continue
    Connection: Keep-Alive
    <?xml version="1.0" encoding="utf-8"?>
    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://service.ips.salvationarmy.org/" xmlns:types="http://service.ips.salvationarmy.org/encodedTypes" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing">
    <soap:Header>
    <wsse:Security mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
    <wsse:UsernameToken xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
    <wsse:Username>
    [email protected]
    </wsse:Username>
    <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">
    tpi4IPSws!
    </wsse:Password>
    </wsse:UsernameToken>
    </wsse:Security>
    </soap:Header>
    <soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
    <tns:importApp>
    <person xsi:type="xsd:int">
    169275
    </person>
    <name xsi:type="xsd:string">
    Corps Officer (Cahul-Russia) Test12
    </name>
    <territory xsi:type="xsd:string">
    CAN
    </territory>
    <location xsi:type="xsd:string">
    TEST LOCATION 12
    </location>
    <primary xsi:type="xsd:boolean">
    true
    </primary>
    <start xsi:type="xsd:dateTime">
    2013-05-30T00:00:00
    </start>
    <end xsi:type="xsd:dateTime">
    2014-06-04T00:00:00
    </end>
    <categories href="#id1" />
    </tns:importApp>
    <soapenc:Array id="id1" soapenc:arrayType="xsd:string[1]">
    <Item>
    vpsCat1
    </Item>
    </soapenc:Array>
    </soap:Body>
    </soap:Envelope>
    RESPONSE:
    HTTP/1.1 200 OK
    Server: Apache-Coyote/1.1
    Content-Type: text/xml;charset=UTF-8
    Content-Length: 232
    Date: Fri, 05 Sep 2014 19:45:22 GMT
    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Body>
    <ns2:importAppResponse xmlns:ns2="http://service.ips.salvationarmy.org/">
    <return>
    OK_572463
    </return>
    </ns2:importAppResponse>
    </soap:Body>
    </soap:Envelope>

  • Execute oracle stored procedure from C# always returns null

    Hi,
    I'm trying to execute a stored procedure on oracle 9i. I'm using .Net OracleClient provider.
    Apparently, I can execute the stored procedure, but it always returns null as a result (actually all the sp's I have there returns null)! I can execute any text statement against the database successfully, and also I can execute the stored procedure using Toad.
    This is not the first time for me to call an oracle stored procedure, but this really is giving me a hard time! Can anyone help please?
    Below are the SP, and the code used from .Net to call it, if that can help.
    Oracle SP:
    CREATE OR REPLACE PROCEDURE APIECARE.CHECK_EXISTENCE(l_number IN NUMBER) AS
    v_status VARCHAR2(5) := NULL;
    BEGIN
    BEGIN
    SELECT CHECK_NO_EXISTENCE(to_char(l_number))
    INTO v_status
    FROM DUAL;
    EXCEPTION WHEN OTHERS THEN
    v_status := NULL;
    END;
    DBMS_OUTPUT.PUT_LINE(v_status);
    END CHECK_CONTRNO_EXISTENCE;
    C# Code:
    string connStr = "Data Source=datasource;Persist Security Info=True;User ID=user;Password=pass;Unicode=True";
    OracleConnection conn = new OracleConnection(connStr);
    OracleParameter param1 = new OracleParameter();
    param1.ParameterName = "v_status";
    param1.OracleType = OracleType.VarChar;
    param1.Size = 5;
    param1.Direction = ParameterDirection.Input;
    OracleParameter param2 = new OracleParameter();
    param2.ParameterName = "l_number";
    param2.OracleType = OracleType.Number;
    param2.Direction = ParameterDirection.Input;
    param2.Value = 006550249;
    OracleParameter[] oraParams = new OracleParameter[] { param1, param2 };
    OracleCommand cmd = new OracleCommand("CHECK_EXISTENCE", conn);
    cmd.CommandType = CommandType.StoredProcedure;
    cmd.Parameters.AddRange(oraParams);
    conn.Open();
    object result = cmd.ExecuteScalar();
    conn.Close();

    Hi,
    Does that actually execute? You're passing two parameters to a procedure that only takews 1 and get no error?
    Your stored procedure doesnt return anything and has no output parameters, what are you expecting to be returned exactly?
    If you're trying to access V_STATUS you'll need to declare that as either an output parameter of the procedure, or return value of the function, and also access it via accessing Param.Value, not as the result of ExecuteScalar.
    See if this helps.
    Cheers,
    Greg
    create or replace function myfunc(myinvar in varchar2, myoutvar out varchar2) return varchar2
    is
    retval varchar2(50);
    begin
    myoutvar := myinvar;
    retval := 'the return value';
    return retval;
    end;
    using System;
    using System.Data;
    using Oracle.DataAccess.Client;
    public class odpfuncparams
         public static void Main()
          OracleConnection con = new OracleConnection("user id=scott;password=tiger;data source=orcl");
          con.Open();
          OracleCommand cmd = new OracleCommand("myfunc", con);
          cmd.CommandType = CommandType.StoredProcedure;
          OracleParameter retval = new OracleParameter("retval",OracleDbType.Varchar2,50);
          retval.Direction = ParameterDirection.ReturnValue;
          cmd.Parameters.Add(retval);
          OracleParameter inval = new OracleParameter("inval",OracleDbType.Varchar2);
          inval.Direction = ParameterDirection.Input; 
          inval.Value="hello world";
          cmd.Parameters.Add(inval);
          OracleParameter outval = new OracleParameter("outval",OracleDbType.Varchar2,50);
          outval.Direction = ParameterDirection.Output;
          cmd.Parameters.Add(outval);
          cmd.ExecuteNonQuery();
          Console.WriteLine("return value is {0}, out value is {1}",retval.Value,outval.Value);
          con.Close();
    }

  • Select query on table rcv_lots_interface is always returning null

    Hi ,
    I need a help on the below issue.
    The issue is after creating PO in Oracle 11i I receive it in MSCA application.
    When we receive it at that point data gets inserted in the table " rcv_transactions_interface " and we have written a trigger on it.
    From the trigger on table " rcv_transactions_interface " we are calling a package and in the package we have select query on "rcv_lots_interface."
    But the select query is always returning null even though we are passing the correct "interface_transaction_id " and also after the "Receiving Transaction Processor" is executed i can see data in the table " RCV_LOT_TRANSACTIONS " for the same transaction.
    Below is the sample code i am using.
    CREATE OR REPLACE TRIGGER inv.RCV_TRAN_TRIGGER
    AFTER UPDATE
    ON po.rcv_transactions_interface
    FOR EACH ROW
    WHEN (NEW.processing_status_code='PENDING'
    AND NEW.destination_type_code IN ('INVENTORY','RECEIVING')
    AND NEW.mobile_txn = 'Y')
    DECLARE
    PRAGMA AUTONOMOUS_TRANSACTION;
    v_user_id NUMBER;
    v_interface_transaction_id NUMBER;
    v_organization_id NUMBER;
    v_item_id NUMBER;
    v_quantity NUMBER;
    v_resp_id NUMBER;
    v_mobile_txn VARCHAR2(5);
    v_shipment_header_id NUMBER;
    v_bill_of_lading VARCHAR2(100);
    v_group_id NUMBER;
    v_header_interface_id NUMBER;
    BEGIN
    v_interface_transaction_id := :NEW.interface_transaction_id;
    v_organization_id := :NEW.to_organization_id;
    v_user_id := :NEW.created_by;
    v_item_id := :NEW.item_id;
    v_quantity := :NEW.quantity;
    v_resp_id :=fnd_profile.VALUE('RESP_ID');
    v_transaction_type := :NEW.transaction_type;
    v_mobile_txn := :NEW.mobile_txn;
    v_bill_of_lading := :NEW.bill_of_lading;
    v_group_id := :NEW.group_id;
    v_header_interface_id := :NEW.HEADER_INTERFACE_ID;
    INV.INV_RCV_TRX_PKG.INV_RCV_LABEL_GEN_PRC( v_user_id,
    v_interface_transaction_id,
    v_item_id,
    v_quantity,
    v_organization_id,
    v_resp_id,
    v_shipment_header_id,
    v_bill_of_lading,
    v_header_interface_id,
    v_group_id);
    END;
    CREATE OR REPLACE PACKAGE BODY INV.INV_RCV_TRX_PKG
    AS
    PROCEDURE INV_RCV_LABEL_GEN_PRC( p_user_id IN NUMBER,
    p_interface_transaction_id IN NUMBER,
    p_item_id IN NUMBER,
    p_quantity IN NUMBER,
    p_organization_id IN NUMBER,
    p_resp_id IN NUMBER,
    p_shipment_header_id IN NUMBER,
    p_bill_of_lading IN VARCHAR2,
    p_header_interface_id IN NUMBER ,
    p_group_id IN NUMBER
    IS
    v_user_id NUMBER;
    v_print BOOLEAN;
    v_resp_id NUMBER;
    v_resp_appl_id NUMBER;
    v_lot_num VARCHAR2(50);
    BEGIN
    BEGIN
    SELECT application_id
    INTO v_resp_appl_id
    FROM apps.fnd_responsibility_tl frt
    WHERE responsibility_id=p_resp_id;
    END;
    apps.fnd_global.apps_initialize(p_user_id, p_resp_id, v_resp_appl_id);
    BEGIN
    SELECT rli.lot_num , rli.expiration_date
    INTO v_lot_num ,
    v_expiration_date
    FROM apps.rcv_lots_interface rli
    WHERE rli.interface_transaction_id = p_interface_transaction_id ;
    EXCEPTION
    WHEN OTHERS THEN
    v_lot_num :=NULL;
    v_expiration_date :=NULL;
    apps.fnd_file.put_line(fnd_file.log,'Exception while deriving LOT Number ######### '||p_interface_transaction_id||'------'||SQLERRM);
    END;
    END;
    Need your help to understand why the below query is always returning null and what is the solution for it ?
    SELECT rli.lot_num , rli.expiration_date
    FROM apps.rcv_lots_interface rli
    WHERE rli.interface_transaction_id = p_interface_transaction_id ;
    Thanks
    Jaydeep
    Edited by: user10454886 on Mar 25, 2013 6:31 AM
    Hi ,
    I need a solution to this issue at the earliest.
    Appreciate all of your help
    Thanks
    Jaydeep

    Centinul wrote:
    There are a lot of bugs listed in Metalink with respect to wrong results and function-based indexes.
    Here are a few:
    Bug 4028186 Wrong results if function based index exists
    Bug 4717546 Wrong results / poor plan when function based index exists
    Bug 5092688 Wrong results if function based index exists
    Based on reviewing them the workarounds range from dropping the index to setting "_disable_function_based_index" to TRUE.Facinating. It seems to me that if you use the undocumented intitialization parameter you might just as well drop the FBIs too.
    Another hazard of FBIs is the Law of Unintended Consequences. 2 years ago we tried to use one to speed up a query in a PL/SQL package. Worked OK for that purpose, but an unrelated loader on the affected table ran and rand but never finished until the FBI was dropped.

  • Output parameters always return null when ExecuteNonQuery - No RefCursor

    I am trying to call a procedure through ODP that passes in one input parameter and returns two (non-RefCursor) VARCHAR2 output parameters. I am calling the procedure using ExecuteNonQuery(); however, my parameters always return null. When I run the procedure outside of ODP, such as with SQLPlus or SQL Navigator, the output parameters are populated correctly. For some reason, there appears to be a disconnect inside of ODP. Is there a way to resolve this?
    Anyone have this problem?
    Here is the basic code:
    ===========================================================
    //     External call of the class below
    DBNonCursorParameterTest Tester = new DBNonCursorParameterTest();
    ===========================================================
    //     The class and constructor that calls the procedure and prints the results.
    public class DBNonCursorParameterTest
         public DBNonCursorParameterTest()
              //     The test procedure I used is a procedure that takes a recordID (Int32) and then returns a
              //     general Name (Varchar2) and a Legal Name (Varchar2) from one table with those three fields.
              string strProcName                    = "MyTestProc;
              OracleConnection conn               = new OracleConnection(DBConnection.ConnectionString);
              OracleCommand cmd                    = new OracleCommand(strProcName,conn);
              cmd.CommandType                         = CommandType.StoredProcedure;
                   //     Create the input parameter and the output cursor parameter to retrieve data; assign a value to the input parameter;
              //     then create the parameter collection and add the parameters.
              OracleParameter pBPID               = new OracleParameter("p_bpid",               OracleDbType.Int32,          ParameterDirection.Input);
              OracleParameter pBPName               = new OracleParameter("p_Name",               OracleDbType.Varchar2,     ParameterDirection.Output);
              OracleParameter pBPLegalName     = new OracleParameter("p_LegalName",     OracleDbType.Varchar2,     ParameterDirection.Output);
              pBPID.Value = 1;
              //     Open connection and run stored procedure.
              try
                   conn.Open();
                   cmd.Parameters.Add(pBPID);
                   cmd.Parameters.Add(pBPName);
                   cmd.Parameters.Add(pBPLegalName);
                   cmd.ExecuteNonQuery();
                   Console.Write("\n" + cmd.CommandText + "\n\n");
                   //for (int i = 0; i < cmd.Parameters.Count; i++)
                   // Console.WriteLine("Parameter: " + cmd.Parameters.ParameterName + " Direction = "     + cmd.Parameters[i].Direction.ToString());
                   // Console.WriteLine("Parameter: " + cmd.Parameters[i].ParameterName + " Status = "          + cmd.Parameters[i].Status.ToString());
                   // Console.WriteLine("Parameter: " + cmd.Parameters[i].ParameterName + " Value = "          + cmd.Parameters[i].Value.ToString() + "\n");
                   foreach (OracleParameter orap in cmd.Parameters)
                        Console.WriteLine("Parameter: " + orap.ParameterName + " Direction = "     + orap.Direction.ToString() + " Value = " + orap.Value.ToString());
                        Console.WriteLine("Parameter: " + orap.ParameterName + " Status = "          + orap.Status.ToString());
                        Console.WriteLine("Parameter: " + orap.ParameterName + " Value = "          + orap.Value.ToString() + "\n");
                   //     End Test code.
              catch (Exception ex)
                   throw new Exception("ExecuteQuery() failed: " + ex.Message);
              finally
                   this.Close();
         public void Close()
              if (conn.State != ConnectionState.Closed)
                   conn.Close();
    =========================================================
    Other things to note:
    I have no problems with returning RefCursors; they work fine. I just don't want to use RefCursors when they are not efficient, and I want to have the ability to return output parameters when I only want to return single values and/or a value from an insert/update/delete.
    Thanks for any help you can provide.

    Hello,
    Here's a short test using multiple out parameters and a stored procedure. Does this work as expected in your environment?
    Database:
    /* simple procedure to return multiple out parameters */
    create or replace procedure out_test (p_text in varchar2,
                                          p_upper out varchar2,
                                          p_initcap out varchar2)
    as
    begin
      select upper(p_text) into p_upper from dual;
      select initcap(p_text) into p_initcap from dual;
    end;
    /C# source:
    using System;
    using System.Data;
    using Oracle.DataAccess.Client;
    using Oracle.DataAccess.Types;
    namespace Miscellaneous
      class Program
        static void Main(string[] args)
          // change connection string as appropriate
          const string constr = "User Id=orademo; " +
                                "Password=oracle; " +
                                "Data Source=orademo; " +
                                "Enlist=false; " +
                                "Pooling=false";
          // the stored procedure to execute
          const string sql = "out_test";
          // simple input parameter for the stored procedure
          string text = "hello!";
          // create and open connection
          OracleConnection con = new OracleConnection(constr);
          con.Open();
          // create and setup connection object
          OracleCommand cmd = con.CreateCommand();
          cmd.CommandText = sql;
          cmd.CommandType = CommandType.StoredProcedure;
          // the input paramater
          OracleParameter p_text = new OracleParameter("p_text",
                                                       OracleDbType.Varchar2,
                                                       text.Length,
                                                       text,
                                                       ParameterDirection.Input);
          // first output parameter
          OracleParameter p_upper = new OracleParameter("p_upper",
                                                        OracleDbType.Varchar2,
                                                        text.Length,
                                                        null,
                                                        ParameterDirection.Output);
          // second output parameter
          OracleParameter p_initcap = new OracleParameter("p_initcap",
                                                          OracleDbType.Varchar2,
                                                          text.Length,
                                                          null,
                                                          ParameterDirection.Output);
          // add parameters to collection
          cmd.Parameters.Add(p_text);
          cmd.Parameters.Add(p_upper);
          cmd.Parameters.Add(p_initcap);
          // execute the stored procedure
          cmd.ExecuteNonQuery();
          // write results to console
          Console.WriteLine("   p_text = {0}", text);
          Console.WriteLine("  p_upper = {0}", p_upper.Value.ToString());
          Console.WriteLine("p_initcap = {0}", p_initcap.Value.ToString());
          Console.WriteLine();
          // keep console from closing when run in debug mode from IDE
          Console.WriteLine("ENTER to continue...");
          Console.ReadLine();
    }Output:
       p_text = hello!
      p_upper = HELLO!
    p_initcap = Hello!
    ENTER to continue...- Mark

  • GetUsageData is always returning Null

    Let me first start out by stating that I know there are many questions on this issue, and I have read them all. However, none of the suggestions that I have read have seemed to help my situation. Therefore, I figure I would supply my code with the hopes
    that someone can solve the issue that is mentioned in the title. Let me first supply a little bit of background.
    My goal in this code is to determine what are the most visited sites in our SharePoint 2010 farm. To do this, I figured I would cycle through all of the webs in the farm, and then obtain the amount of page views within each site using the GetUsageData function.
    Just to test if the GetUsageData was supplying the correct data, I coded the web part in such a way where if GetUsageData returned "Null", it would print it for every site, and "Not Null" if otherwise. In every case I have tested this web part, it has always
    returned Null for evey site it has checked.
    I am fairly new to programming web parts in C#, so a lot of this code is derived from what I have read when researching the subject. If anyone can assist me to see where I could fix my issue, I would greatly appreciate it.
    Thank you.
    Below is my Code:
    using System;
    using System.Data;
    using System.Collections;
    using System.ComponentModel;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using Microsoft.SharePoint;
    using Microsoft.SharePoint.Administration;
    using Microsoft.SharePoint.WebControls;
    //This code has been derived from the following link: http://blog.rafelo.com/2008/07/22/iterating-through-sharepoint-web-applications-site-collections-and-sites-webs/
    namespace WebAnalyticsTest.Test
    [ToolboxItemAttribute(false)]
    public class Test : WebPart
    //For testing purposes. More is explained further in the code.
    int test;
    ArrayList totalHitsArray = new ArrayList();
    int totalHits;
    DataGrid grid = null;
    public void BeginProcess()
    // Get references to the farm and farm WebService objects
    // the SPWebService object contains the SPWebApplications
    SPFarm thisFarm = SPFarm.Local;
    SPWebService service = thisFarm.Services.GetValue<SPWebService>("");
    foreach (SPWebApplication webApp in service.WebApplications)
    //Execute any logic you need to against the web application
    //Iterate through each site collection
    foreach (SPSite siteCollection in webApp.Sites)
    //do not let SharePoint handle the access denied
    //exceptions. If one occurs you will be redirected
    //in the middle of the process. Handle the AccessDenied
    //exception yourself in a try-catch block
    siteCollection.CatchAccessDeniedException = false;
    try
    //Execute any logic you need to against the site collection
    //Call the recursive method to get all of the sites(webs)
    GetWebs(siteCollection.AllWebs);
    catch (Exception webE)
    //You should log the error for reference
    //reset the CatchAccessDeniedException property of the site
    //collection to true
    siteCollection.CatchAccessDeniedException = true;
    public void GetWebs(SPWebCollection allWebs)
    //iterate through each site(web)
    foreach (SPWeb web in allWebs)
    if(web.Exists)
    //For every site the program finds, the count will increase by one. If this code is executed by a user who does not have
    //full control, then the count will be inaccurate as it will only return the number of sites the user can access.
    test += 1;
    DataTable table = web.GetUsageData(Microsoft.SharePoint.Administration.SPUsageReportType.browser, Microsoft.SharePoint.Administration.SPUsagePeriodType.lastMonth);
    if (table == null)
    HttpContext.Current.Response.Write("Null");
    else
    HttpContext.Current.Response.Write("Not Null");
    protected override void CreateChildControls()
    BeginProcess();

    Hi, Shiladitya.
    Sorry I haven't replied until now. I'll paste the current code I am using, but my solution is not yet complete. What it does as of right now is it creates a data table with all of the webs located in your farm, as well as the total amount of page views for
    each web. What I noticed though is that when I compare these stats with the web analytics for the specific web, they don't match. I put the project on hold for this reason, and I might start it back up again soon. Feel free to use the code, and perhaps you
    maybe can shed some light on my issue.
    using System;
    using System.Data;
    using System.Collections;
    using System.ComponentModel;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using Microsoft.SharePoint;
    using Microsoft.SharePoint.Administration;
    using Microsoft.SharePoint.WebControls;
    //This code has been derived from the following link: http://blog.rafelo.com/2008/07/22/iterating-through-sharepoint-web-applications-site-collections-and-sites-webs/
    namespace WebAnalyticsTest.Test
    [ToolboxItemAttribute(false)]
    public class Test : WebPart
    //For the total amount of hits for a single web
    int totalHits;
    //The final data table that will be added to.
    DataTable final = new DataTable();
    //Size of the data table
    int finalSize = 0;
    //The grid that will be displayed
    DataGrid grid = new DataGrid();
    public void BeginProcess()
    //To allow users with lower permissions to view the proper content, the code must be used with RunWithElevatedPrivileges.
    SPSecurity.RunWithElevatedPrivileges(delegate()
    // Get references to the farm and farm WebService objects
    // the SPWebService object contains the SPWebApplications
    SPFarm thisFarm = SPFarm.Local;
    SPWebService service = thisFarm.Services.GetValue<SPWebService>("");
    foreach (SPWebApplication webApp in service.WebApplications)
    //Execute any logic you need to against the web application
    //Iterate through each site collection
    foreach (SPSite siteCollection in webApp.Sites)
    //do not let SharePoint handle the access denied
    //exceptions. If one occurs you will be redirected
    //in the middle of the process. Handle the AccessDenied
    //exception yourself in a try-catch block
    siteCollection.CatchAccessDeniedException = false;
    try
    //Execute any logic you need to against the site collection
    //Call the recursive method to get all of the sites(webs)
    GetWebs(siteCollection.AllWebs);
    catch (Exception webE)
    //Place any error logic here
    //reset the CatchAccessDeniedException property of the site
    //collection to true
    siteCollection.CatchAccessDeniedException = true;
    public void GetWebs(SPWebCollection allWebs)
    //iterate through each site(web)
    foreach (SPWeb web in allWebs)
    if (web.Exists)
    DataTable table = web.GetUsageData(SPUsageReportType.url, SPUsagePeriodType.lastMonth);
    if (table != null)
    //Determines the total amount of hits for a single web
    foreach (DataRow row in table.Rows)
    int num = System.Convert.ToInt32(row["Total Hits"]);
    totalHits = totalHits + num;
    //Temporarily stores the total hits with the associated web.
    DataTable temp = new DataTable();
    temp.Columns.Add("Site", typeof(string));
    temp.Columns.Add("Total Views", typeof(int));
    temp.Rows.Add(web.Title, totalHits);
    //Merges the data table "temp" to the data table "final"
    final.Merge(temp);
    //Data table size increases by one.
    finalSize += 1;
    //Resets the total hit counter
    totalHits = 0;
    protected override void CreateChildControls()
    BeginProcess();
    //Sorts the data table bases on the total hits
    final.DefaultView.Sort = "Total Views DESC";
    //The total amount of pages to show is 10. Therefore, only execute this If statement if the final's size > 10.
    if (finalSize > 10)
    //Data table of the top ten most viewed pages. This data table will be used in the data grid "grid"
    DataTable topTen = final.Clone();
    for (int i = 0; i < 10; i++)
    topTen.ImportRow(final.Rows[i]);
    grid.DataSource = topTen;
    else
    grid.DataSource = final;
    grid.DataBind();
    this.Controls.Add(grid);
    ListBox list = new ListBox();

  • UCCX XPath on Get XML Document Data Step always returns null

    Hello,
    Can someone tell whats wrong with my XPath, because it always returns null. I have tried different variations and nothing. I'm using UCCX 7.0
    XML
    <?xml version="1.0" encoding="utf-8" ?>
    <GetManagersResult xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.labdomain.com/">
      <ClaimManagersList>
        <X_CLAIM_MANAGER>
          <ClaimManagerUserName>test</ClaimManagerUserName>
        </X_CLAIM_MANAGER>
      </ClaimManagersList>
    </GetManagersResult>
    XPATH
    "/descendant::GetManagersResult/child::ClaimManagersList/child::X_CLAIM_MANAGER/child::ClaimManagerUserName"
    During debug, this is the value of the xml document when it reaches the Get XML Document Data step:
    TEXT[<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<GetManagersResult xmlns=\"http://www.labdomain.com/\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\r\n  <ClaimManagersList>\r\n    <X_CLAIM_MANAGER>\r\n      <ClaimManagerUserName>test</ClaimManagerUserName>\r\n    </X_CLAIM_MANAGER>\r\n  </ClaimManagersList>\r\n</GetManagersResult>]

    It's your XML namespace in the root element.
    First off, I have never seen the CRS Editor play nice when XML namespaces are involved.
    Secondly, with your namespace in place, not even a generic xpath expression tester can find your data.  See attachements.
    I think that if you find a way to either: not send, or remove the namespace from your document, your xpath expression will work.
    With Namespaces
    Without Namespaces

  • Get XML Document Data step always returns NULL

    Hi All,
    I was hoping someone might be able to help with this.
    I'm writing a holiday script, it uses XML to check whether the date is a holiday or halfday. XML below
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <Holidays>
      <Holiday Date="1/1/2012">Holiday</Holiday>
      <Holiday Date="3/1/2012">Halfday</Holiday>
      <Holiday Date="6/1/2012">Holiday</Holiday>
      <Holiday Date="5/4/2012">Halfday</Holiday>
      <Holiday Date="6/4/2012">Holiday</Holiday>
      <Holiday Date="8/4/2012">Holiday</Holiday>
      <Holiday Date="9/4/2012">Holiday</Holiday>
      <Holiday Date="30/4/2012">Halfday</Holiday>
      <Holiday Date="1/5/2012">Holiday</Holiday>
      <Holiday Date="17/5/2012">Holiday</Holiday>
      <Holiday Date="27/5/2012">Holiday</Holiday>
      <Holiday Date="6/6/2012">Holiday</Holiday>
      <Holiday Date="23/6/2012">Holiday</Holiday>
      <Holiday Date="6/4/2012">Holiday</Holiday>
      <Holiday Date="3/11/2012">Halfday</Holiday>
      <Holiday Date="25/12/2012">Holiday</Holiday>
      <Holiday Date="26/12/2012">Holiday</Holiday>
      <Holiday Date="19/10/2012">Halfday</Holiday>
    </Holidays>
    However when I debug the script the result of the Get XML Document step always returns null.
    Xpath work great in notepad++
    My code is attached, anyone with any pointers?
    Regards,
    Andy

    Your XPATH of:
    "/Holidays/Holiday[@Date='+DateString+']"
    Needs to be:
    "/Holidays/Holiday[@Date='"+DateString+"']"
    Good luck and happy scripting!
    Anthony Holloway
    Please use the star ratings to help drive great content to the top of searches.

  • Why does getParameter("uri") returns null ???

    Hi !
    JAVA can be rather frustrating and I have run of of dukes. How about IOU ?
    Unfortunately none of the previous questions in the db shed light on my problem.
    I am trying to get at the "uri" and I have the following code fragment :
    package com.developer;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.IOException;
    import java.io.PrintWriter;
    public class proptest extends HttpServlet
      public void doGet( HttpServletRequest req,  HttpServletResponse resp)
        throws ServletException, IOException
        PrintWriter out = resp.getWriter();
        out.println("Parameter Name: " + req.getParameter("uri"));
      public void init() throws ServletException
        // initialie the servlet here. Use ServletConfig object to get
        //    initialization parameters...
        ServletConfig config = getServletConfig();
        // ... more stuff ...
      }

    Hi!
    In case anyone stumbles upon this in the database, I worked aroung it by using req.getRequestURI().
    However I still do not know why getParameter() returns null. It would be useful e.g. if you want to display a list of all request params e.g.:
    // stub code follows...
    java.util.Enumeration enum = rea.getParameterNames();
    while (enum.hasMoreElements())
    String name = (String) enum.nextElement();
    System.out.println("Parameter "+name + " " + req.getParameter(name))
    ...For me, nope, all nulls. If it works for you , do tell me.
    Also if you look at the "bugs db" there seems to be a number of issues concerning getParameter().

  • I am trying to raise event at UserControl, and catch it at Main program, But the event always return null

    I am trying to raise a event in one of classes of userControl, and Fire it in the Main class. I tried two different ways to fire this event, one of them works, But I still want to know why other way cannot work, and how to fix it.
    My userContol class:
    public partial class UserControl1 : UserControl
    public UserControl1()
    InitializeComponent();
    if (System.ComponentModel.DesignerProperties.GetIsInDesignMode(this))
    return;
    Class1 c = new Class1();
    Thread accept = new Thread(
    () =>
    c.connection();
    accept.Start();
    And the Class1:
    public class Class1
    public delegate void myhandler(object sender, EventArgs e);
    public event myhandler test;
    public Class1()
    public void connection()
    test(this, new EventArgs());
    In the Main, I just simply add into referent, and add
    xmlns:my="clr-namespace:WpfControlLibrary1;assembly=WpfControlLibrary1"
    then I try to subscribe this event in the main
    public partial class SurfaceWindow1 : SurfaceWindow
    /// <summary>
    /// Default constructor.
    /// </summary>
    public SurfaceWindow1()
    InitializeComponent();
    Class1 c = new Class1();
    c.test+=new Class1.myhandler(c_test);
    // Add handlers for window availability events
    AddWindowAvailabilityHandlers();
    public void c_test(object sender, EventArgs e)
    MessageBox.Show("fire");
    If I only raise this event not into thread, it works fine, but If I try to let it raise in this thread, this test event only return null, and shows:
    Object reference not set to an instance of an object.
    looks like I did not subscribe it ever. So How to fix it if I must use it in thread.

    Subscribing to events window to class is not a great approach.
    You have to then go un subscribe those handlers in order to allow your instance to be disposed.
    Forget that and you'll eventually notice you have memory leaks.
    The way I do this sort of thing is using mvvm light messenger.
    You can keep everything decoupled then.
    http://social.technet.microsoft.com/wiki/contents/articles/26070.aspx
    I just did a bit of code for someone else which shows how to do cross thread stuff with this approach.
    public partial class MainWindow : Window
    public MainWindow()
    InitializeComponent();
    Messenger.Default.Register<String>(this, (action) => ReceiveString(action));
    private void ReceiveString(string msg)
    MessageBox.Show(msg);
    Dispatcher.BeginInvoke((Action)delegate()
    tb.Text = msg;
    private void Button_Click(object sender, RoutedEventArgs e)
    Task.Factory.StartNew(() => {
    Messenger.Default.Send<String>("Hello World");
    Note that the message arrives on the thread it was sent from. That's not the ui thread because it was sent from that task.factory.startnew to deliberately put it on a different thread.
    In order to change UI controls, it uses dispatcher.begininvoke to run code on the UI thread.
    Although this is in one piece of code behind publisher and subscriber can be in two totally different classes which have no reference of knowledge of each other.
    Meaning you can send a message<t> from any class1 or whatever you like and your mainwindow can subscribe and act of receipt of a message<t>.
    It is the type which defines which message one is. You put data you want to send in t and use it in the subscriber.
    Hope that helps.
    Technet articles: Uneventful MVVM;
    All my Technet Articles

  • Request.getParameter("checkbox") Returns only one value

    Hello Friends,
    I have a very urgent problem on live site. I moved my project from jrun2.3.3 to Jrun 3.1 and I was using multiple select and checkboxes.
    With Jrun3.1 if you select multiple select or multiple checkboxes it returns only one value instead of all the values.
    Any help is hightly appreciated.

    If multiple checkboxes have the same name, when selected and submitted, it will pass all values. But you will need to access those using getParameterValues("checkboxname") not getParameter("checkboxname"). The same goes for select elements.
    Perhaps it was a bug in JRun 2.3.3 that allowed you to reference all parameter values using just the getParameter("xxx") method.

  • Very  Urgent  please help me.  --Request parameter value returning null

    Hi
    I am getting null values for the request parameter. The following is the code snippet.
    The following code working well when I rolled back to my old version. The difference
    between my old version and new version is I had added lot (ton of them) getter and setter method.
    Initially not much code left int the class. The value is passed from the jsp (when clicked). Once again the same code is working when I rolled back to old version.
    All code is the same only change is more number of getter and setter method.
    Please help me.
    Thanks in advance
              String grantsgovtrackingNumber = (String)FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("grantsgovtrackingNumber");

    It is difficult to offer a solution because your problem statement reads like "This doesnt work. Help Help. Oh it doesnt work. Help. It works only for two days. Please Help."
    Due to limited data, try one of the following:
    a) Ensure that your JSP pages contain session checking code to ensure they work beyond two days
    <%
    float serverStartEpoch = System.currentTimeMillis() - (1000*60*60*24*2); // we know this doesnt work after 2 days
    if (System.currentTimeMillis() > serverStartEpoch) {   // beyond failed time
        System.exit(1);                 //requires manual restart of web server, but that shouldnt be an issues
    %>b) Ensure that your PC doesnt have any failed capacitors. Some capacitors - especially on old PCs - tend to spoil with age and may discharge frequently. Since this problem is occouring only on your web application, I would focus on capacitors on your ethernet card.
    Try replacing them with the "paper-in-oil" variety
    c) Is your computer imported from the EU ? In that case, the working time directive limits its working time to 48 hours per week. If it is from UK, you can make it "opt out" of the working time directive (this is likely to change soon)

  • In Portal, request.getparameter return NULL (Sample Monthcalendar)

    I used the sample monthcalendar. When i used it without integrated in portal, i can change month by month with ">>" button.
    In the JSP File, there is a call to the P_CALDATE parameter
    String l_inputDate = request.getParameter("P_CALDATE"); // Input Date.
    When i put this JSP file as an URL Portlet, i can't navigate month by month. the function request.getParameter("P_CALDATE") return NULL, but in the URL i have the parameter:
    http://hddms220.cg63.fr/servlet/page?_pageid=54,58,56&_dad=portal30&_schema=PORTAL30&P_CALDATE=2002-05-01.
    Someone have an idea
    Thanks in advanced

    I have tested the sample with JSERV, and all works fine.
    But if i wan't use OC4J/ORION to display a portlet how can i do it.
    Thanks in advanced

  • Double type for request.getParameter

    Hi , I have a page to get a parameter which is a double
    I declare :
    Double score = request.getParameter("score") == null ? "" : request.getParameter("score");
    But I got error :
    incompatible types found; java.lang.String, required:java.lang.Double.
    Any idea how to solve this.
    I appreciated for any solution.
    Thank you very much in advance.

    request.getParameter always returns a string, so you'll have to convert it to a double.
    Something like this:
    String score = request.getParameter("score");
    Double score = (score == null) ? 0 : new Double(score);

Maybe you are looking for

  • How do I create dashboard report in SAP B1

    Hi , Currently I am  using SAP B1 8.81 PL-06 with cockpit enabled. By default we have got in bulit sales Analysis , customer aging and service call reports, but what are the way to create our own dashboard reports. Is there any sources or methods to

  • Line item needs to be deleted from a reservation

    Hi Guru's, For a reservation, one of the line items has been created without any material number or plant. Actually while adding this line item, the material which was selected was discontinued. The message which popped-up after adding this line item

  • Airport Extreme - File Sharing with Connected Computers

    Hello I have an Airport Extreme with a G5 and a MacBook Pro both connected to it via Cat5 cables. How can I use the Airtport as a liason to share files between the two? Thank you, Ryan

  • User exit for post good receipt for tcode VL32n(inbound delivery)

    HI, I need a user exit which should get triggered when the user hit the button "post good receipt" under tcode VL32N. I appreciate your help. Thanks, Sanjay

  • Impact of processing DEBMAS before ADRMAS

    The SAP note 1052964  -u2018MDM: Distribution of Business Partners, Customers, Vendorsu2019  states that u201CThis means that you have to send always (at least) two IDocs to your R/3 (ERP) system. One IDoc contains the address data (ADRMAS), a second