Reflection Set Properties

Hello,  I have the below code snippet where I am trying to load dynamic csv files(The columns names can change, so I cant define a regular class and read them into that class) and create a dynamic class with Reflection and then map the data back to
those properties.  I cant figure out how to set the properties for the dynamic class.  How do I map the data to the properties dynamically?
//The Files Look Like This
//FILE 1
"Item","Id","Color"
"Cart","24HJ01","Blue"
"Cart","24HJ02","Red"
"Cart","24HJ03","Orange"
"Cart","24HJ04","Yellow"
"Tank","24HJ05","Blue"
"Tank","24HJ06","Black"
"Tank","24HJ07","Orange"
"Switch","24HJ08","White"
"Switch","24HJ09","Brown"
"Switch","25HJ07","Black"
//FILE 2
"City","State","Code"
"Buffalo","NY","A001"
"Denver","CO","A002"
"Tampa","FL","A003"
"Nashville","TN","A004"
//Field Class
public class Field
public string FieldName { get; set; }
public Type FieldType { get; set; }
//Building My Class Like this
public static class MyTypeBuilder
public static void CreateNewObject(List<Field> fields)
var myType = CompileResultType(fields);
var myObject = Activator.CreateInstance(myType);
public static Type CompileResultType(List<Field> fields)
TypeBuilder tb = GetTypeBuilder();
ConstructorBuilder constructor =
tb.DefineDefaultConstructor(MethodAttributes.Public | MethodAttributes.SpecialName |
MethodAttributes.RTSpecialName);
foreach (var field in fields)
CreateProperty(tb, field.FieldName, field.FieldType);
Type objectType = tb.CreateType();
return objectType;
private static TypeBuilder GetTypeBuilder()
var typeSignature = "MyDynamicType";
var an = new AssemblyName(typeSignature);
AssemblyBuilder assemblyBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly(an,
AssemblyBuilderAccess.Run);
ModuleBuilder moduleBuilder = assemblyBuilder.DefineDynamicModule("MainModule");
TypeBuilder tb = moduleBuilder.DefineType(typeSignature
, TypeAttributes.Public |
TypeAttributes.Class |
TypeAttributes.AutoClass |
TypeAttributes.AnsiClass |
TypeAttributes.BeforeFieldInit |
TypeAttributes.AutoLayout
, null);
return tb;
private static void CreateProperty(TypeBuilder tb, string propertyName, Type propertyType)
FieldBuilder fieldBuilder = tb.DefineField("_" + propertyName, propertyType, FieldAttributes.Private);
PropertyBuilder propertyBuilder = tb.DefineProperty(propertyName, PropertyAttributes.HasDefault,
propertyType, null);
MethodBuilder getPropMthdBldr = tb.DefineMethod("get_" + propertyName,
MethodAttributes.Public | MethodAttributes.SpecialName | MethodAttributes.HideBySig, propertyType,
Type.EmptyTypes);
ILGenerator getIl = getPropMthdBldr.GetILGenerator();
getIl.Emit(OpCodes.Ldarg_0);
getIl.Emit(OpCodes.Ldfld, fieldBuilder);
getIl.Emit(OpCodes.Ret);
MethodBuilder setPropMthdBldr =
tb.DefineMethod("set_" + propertyName,
MethodAttributes.Public |
MethodAttributes.SpecialName |
MethodAttributes.HideBySig,
null, new[] {propertyType});
ILGenerator setIl = setPropMthdBldr.GetILGenerator();
Label modifyProperty = setIl.DefineLabel();
Label exitSet = setIl.DefineLabel();
setIl.MarkLabel(modifyProperty);
setIl.Emit(OpCodes.Ldarg_0);
setIl.Emit(OpCodes.Ldarg_1);
setIl.Emit(OpCodes.Stfld, fieldBuilder);
setIl.Emit(OpCodes.Nop);
setIl.MarkLabel(exitSet);
setIl.Emit(OpCodes.Ret);
propertyBuilder.SetGetMethod(getPropMthdBldr);
propertyBuilder.SetSetMethod(setPropMthdBldr);
// My Current Attempt -- Everything works correctly until I get down to the foreach statement to try and Set the Object Properties.  
//File To Load
const string file = @"sample.txt";
//Define string Type to Dynamically build the Properties
var testDataType = typeof(string);
//Read in the File
var configFile = File.ReadLines(file).Select(line => line.Split(new[] {','}));
//Enumerate to List
var enumerable = configFile as IList<string[]> ?? configFile.ToList();
//Get Columns
var columns = enumerable.Take(1);
//Read the columns into a string list and replace the quotes
var columnList = new List<string>(columns.First().Select(s => s.Replace("\"", string.Empty)));
////Get Rows
//var rows = enumerable.Skip(1);
////Read rows into a list
//var rowList = rows.Select(yu => yu.Select(s => s.Replace("\"", string.Empty))).ToList();
//Map the columns to the Field class
var loadFields = columnList.Select(p => new Field {FieldName = p, FieldType = testDataType}).ToList();
//Create Dynamic Class
var myType = MyTypeBuilder.CompileResultType(loadFields);
//Get the type
Type customType = myType;
//create the actual List<customType> type
Type genericListType = typeof(List<>);
//Make Generic Type
Type customListType = genericListType.MakeGenericType(customType);
//Create List
IList customListInstance = (IList)Activator.CreateInstance(customListType);
//Create Instance
object someCustomClassInstance = Activator.CreateInstance(customType);
//Get Properties
var properties = someCustomClassInstance.GetType().GetProperties();
foreach (var o in enumerable)
//SetObjectProperty(someCustomClassInstance, properties.First().Name.ToString(CultureInfo.InvariantCulture), o[1]);
//customListInstance.Add(someCustomClassInstance);
private void SetObjectProperty(object theObject, string propertyName, object value)
Type type = theObject.GetType();
var property = type.GetProperty(propertyName);
var setter = property.SetMethod;
setter.Invoke(theObject, new object[] { value });

Hello,  I have the below code snippet where I am trying to load dynamic csv files(The columns names can change, so I cant define a regular class and read them into that class) 
Why not? A CSV file is no type so it won't give any information. 
I describe this mostly as pulling a tooth rectally. Do things as difficult as possible. it serves nothing but for those who don't know better it looks impressive. 
Success
Cor

Similar Messages

  • "Message from Webpage (error) There was an error in the browser while setting properties into the page HTML, possibly due to invalid URLs or other values. Please try again or use different property values."

    I created a site column at the root of my site and I have publishing turned on.  I selected the Hyperlink with formatting and constraints for publishing.
    I went to my subsite and added the column.  The request was to have "Open in new tab" for their hyperlinks.  I was able to get the column to be added and yesterday we added items without a problem. 
    The problem arose when, today, a user told me that he could not edit the hyperlink.  He has modify / delete permissions on this list.
    He would edit the item, in a custom list, and click on the address "click to add a new hyperlink" and then he would get the error below after succesfully putting in the Selected URL (http://www.xxxxxx.com), Open
    Link in New Window checkbox, the Display Text, and Tooltip:
    "Message from Webpage  There was an error in the browser while setting properties into the page HTML, possibly due to invalid URLs or other values. Please try again or use different property values."
    We are on IE 9.0.8.1112 x86, Windows 7 SP1 Enterprise Edition x64
    The farm is running SharePoint 2010 SP2 Enterprise Edition August 2013 CU Mark 2, 14.0.7106.5002
    and I saw in another post, below with someone who had a similar problem and the IISreset fixed it, as did this problem.  I wonder if this is resolved in the latest updated CU of SharePoint, the April 2014 CU?
    Summary from this link below: Comment out, below, in AssetPickers.js
    //callbackThis.VerifyAnchorElement(HtmlElement, Config);
    perform IISReset
    This is referenced in the item below:
    http://social.technet.microsoft.com/Forums/en-US/d51a3899-e8ea-475e-89e9-770db550c06e/message-from-webpage-error-there-was-an-error-in-the-browser-while-setting?forum=sharepointgeneralprevious
    TThThis is possibly the same information that I saw, possibly from the above link as reference.
    http://seanshares.com/post/69022029652/having-problems-with-sharepoint-publishing-links-after
    Again, if I update my SharePoint 2010 farm to April 2014 CU is this going to resolve the issue I have?
    I don't mind changing the JS file, however I'd like to know / see if there is anything official regarding this instead of my having to change files.
    Thank you!
    Matt

    We had the same issue after applying the SP2 & August CU. we open the case with MSFT and get the same resolution as you mentioned.
    I blog about this issue and having the office reference.
    Later MSFT release the Hotfix for this on December 10, 2013 which i am 100% positive should be part of future CUs.
    So if you apply the April CU then you will be fine.
    Please remember to mark your question as answered &Vote helpful,if this solves/helps your problem. ****************************************************************************************** Thanks -WS MCITP(SharePoint 2010, 2013) Blog: http://wscheema.com/blog

  • TDMS Set Properties in a loop?

    I am using LV 8.5 and am trying to apply TDMS properties to multiple channels in one fell swoop, with the idea of being able to automate it for the number of channels currently active.  I know how to do this, except for one step I'm struggling with.  I keep getting the error:
    "LabVIEW:  An input parameter is invalid. For example if the input is a path, the path might contain a character not allowed by the OS such as ? or @.
    =========================
    NI-488:  Command requires GPIB Controller to be Controller-In-Charge."
    coming from the tdms set properties.  I'm feeding it an an indexing array of strings, which I believe are C-strings so null terminator as the help files says it struggles with such, and no addresses.  I've attached a partially completed VI that is otherwise working.
    Thanks for your assistance,
    Bret Dahme
    Solved!
    Go to Solution.
    Attachments:
    Multiple_inputs.vi ‏102 KB

    Bingo!  Glad that it was a quick and easy solution.  The help file says group or channel and nothing that i can see of requireing either.
    Thanks for the help!
    Attachments:
    Multiple_inputs.vi ‏98 KB

  • General class and setting properties vs specific inner class

    This is a general question for discussion. I am curious to know how people differentiate between instantiating a standard class and making property adjustments within a method versus defining a new inner class with the property adjustments defined within.
    For example, when laying out a screen do you:
    - instantiate all the objects, set properties, and define the layout all within a method
    - create an inner class that defines the details of the layout (may reference other inner classes if complex) that is then just instantiated within a method
    - use some combination of the two depending on size and complexity.
    - use some other strategy
    Obviously, by breaking the work up into smaller classes you are simplifying the structure since each class is taking on less responsibility, as well as hiding the details of the implementaion from higher level classes. On the other hand, if you are just instantiating an object and making some SET calls is creating an inner class overkill.
    Is there a general consensus for an approach? I am curious to hear the approach of others.

    it's depends on your design..
    usually, if the application is simple and is not expected to be maintain (update..etc..) than I just have all the building of the gui within the same class (usually..the main class that extends JFrame).
    if the application follows the MVC pattern, than I would have a seperate class that build the GUI for a particular View. I would create another class to handle the ActionEvent, and other event (Controller)
    I rarely use inner class...and only use them to implements the Listerner interface (but only for simple application)..

  • SETTING PROPERTIES FOR A MAPPING VIA OMBPLUS ISN'T WORKING

    Hi, i have a problem with OMBPLUS:
    I have a script which creates a mapping and then is supposed to change properties for the mapping and seems to do so via OMBRETRIEVE. But when looking in OWB the properties aren't changed.
    If I change any of the properties inside OWB and then run the script again, then the properties are changed. Does anyone know why the behavior is like this?
    /thanx Joel
    When running the script the output looks like this:
    CREATE MAPPING 'XXX_1_IN'... DONE
    DEFAULT_OPERATING_MODE={SET BASED FAIL OVER TO ROW BASED}
    ALTER MAPPING PROPERTIES FOR 'T_A_TEST_XXX_1_IN'... DONE
    DEFAULT_OPERATING_MODE={SET BASED}
    -- ALL DONE --
    The script:
    set temp_module "TMP"
    set tmp_table1 "XXX_1"
    set tmp_table2 "XXX_2"
    set map_name "XXX_1_IN"
    puts -nonewline "CREATE MAPPING '$map_name'... "
    OMBCREATE MAPPING '$map_name' \
    ADD TABLE OPERATOR '$tmp_table1' BOUND TO TABLE '../$temp_module/$tmp_table1' \
    ADD TABLE OPERATOR '$tmp_table2' BOUND TO TABLE '../$temp_module/$tmp_table2' \
    ADD CONNECTION \
    FROM GROUP 'INOUTGRP1' OF OPERATOR '$tmp_table1' \
    TO GROUP 'INOUTGRP1' OF OPERATOR '$tmp_table2'
    OMBCOMMIT
    puts "DONE"
    set prop [OMBRETRIEVE MAPPING '$map_name' GET PROPERTIES (DEFAULT_OPERATING_MODE) ]
    puts "DEFAULT_OPERATING_MODE=$prop"
    puts -nonewline " ALTER MAPPING PROPERTIES FOR '$map_name'... "
    OMBALTER MAPPING '$map_name' \
    SET PROPERTIES (DEFAULT_OPERATING_MODE) \
    VALUES ('SET BASED')
    OMBCOMMIT
    set prop [OMBRETRIEVE MAPPING '$map_name' GET PROPERTIES (DEFAULT_OPERATING_MODE) ]
    puts "DEFAULT_OPERATING_MODE=$prop"
    puts "-- ALL DONE --"
    puts ""
    OMBDISCONNECT

    Thanks for your idea Roman, but it doesn't solve my problem.
    The problem is regardless of which property (Runtime parameters in OWB) I try to change. Before ANY property is changed via OWB (GUI) the changes via OMB doesn't come to effect (even if RETREIVE after OMBCOMMIT says so).
    Regards, Joel

  • SETTING PROPERTIES FOR A MAPPING VIA OMBPLUS ISN'T WORKING (OWB10gR2)

    Hi, i have a problem with OMBPLUS:
    I have a script which creates a mapping and then is supposed to change properties for the mapping. The script worked in previous releases of OWB but after upgrading to 10gR2 I get an error that DEFAULT_OPERATING_MODE property does not exist.
    Does anyone know why I get the error?
    /thanx Joel
    When running the script the output looks like this:
    CREATE MAPPING 'XXX_1_IN'... DONE
    DEFAULT_OPERATING_MODE={SET BASED FAIL OVER TO ROW BASED}
    ALTER MAPPING PROPERTIES FOR 'T_A_TEST_XXX_1_IN'...
    OMB02902: Error setting property DEFAULT_OPERATING_MODE of T_A_TEST_XXX_1_IN: MMM1034: Property DEFAULT_OPERATING_MODE does not exist.
    -- ALL DONE --
    The script:
    set temp_module "TMP"
    set tmp_table1 "XXX_1"
    set tmp_table2 "XXX_2"
    set map_name "XXX_1_IN"
    puts -nonewline "CREATE MAPPING '$map_name'... "
    OMBCREATE MAPPING '$map_name' \
    ADD TABLE OPERATOR '$tmp_table1' BOUND TO TABLE '../$temp_module/$tmp_table1' \
    ADD TABLE OPERATOR '$tmp_table2' BOUND TO TABLE '../$temp_module/$tmp_table2' \
    ADD CONNECTION \
    FROM GROUP 'INOUTGRP1' OF OPERATOR '$tmp_table1' \
    TO GROUP 'INOUTGRP1' OF OPERATOR '$tmp_table2'
    OMBCOMMIT
    puts "DONE"
    set prop [OMBRETRIEVE MAPPING '$map_name' GET PROPERTIES (DEFAULT_OPERATING_MODE) ]
    puts "DEFAULT_OPERATING_MODE=$prop"
    puts -nonewline " ALTER MAPPING PROPERTIES FOR '$map_name'... "
    OMBALTER MAPPING '$map_name' \
    SET PROPERTIES (DEFAULT_OPERATING_MODE) \
    VALUES ('SET BASED')
    OMBCOMMIT
    puts "-- ALL DONE --"
    puts ""
    OMBDISCONNECT

    Hi, don't look at the script it was copied and pasted from an old thread. The problem is the error I get when trying to execute:
    OMBALTER MAPPING 'map_name' \
    SET PROPERTIES (DEFAULT_OPERATING_MODE) \
    VALUES ('SET BASED')
    OMB02902: Error setting property DEFAULT_OPERATING_MODE of map_name: MMM1034: Property DEFAULT_OPERATING_MODE does not exist.
    //Joel

  • Mojarra doesn't implement setting properties on declared converters?

    Hi,
    I tried to register a custom converter in faces-config, by means of the following declaration:
    <converter>
              <description>Formats a number with exactly two fractional digits.</description>
              <converter-id>numberformat.two</converter-id>
              <converter-class>javax.faces.convert.NumberConverter</converter-class>
              <property>
                   <property-name>maxFractionDigits</property-name>
                   <property-class>java.lang.Integer</property-class>
                   <default-value>2</default-value>
              </property>
              <property>
                   <property-name>minFractionDigits</property-name>
                   <property-class>java.lang.Integer</property-class>
                   <default-value>2</default-value>
              </property>
         </converter>I've used this kind of code before a long time ago when using MyFaces, and this always Just Worked. However, with Mojarra it just doesn't work.
    I used the converter on my view like this:
    <h:outputText value="#{bb.someVal}">
         <f:converter converterId="numberformat.two"/>
    </h:outputText>By putting a breakpoint in javax.faces.convert.NumberConverter, I can check that the converter is being called, but the properties just aren't set on the instance.
    I hunted the Mojarra source code, but I also can't find any code that is supposed to set these properties.
    For instance, the ApplicationImp.createConverter method consists of this code:
    public Converter createConverter(String converterId) {
            if (converterId == null) {
                String message = MessageUtils.getExceptionMessageString
                    (MessageUtils.NULL_PARAMETERS_ERROR_MESSAGE_ID, "convertedId");
                throw new NullPointerException(message);
            Converter returnVal = (Converter) newThing(converterId, converterIdMap);
            if (returnVal == null) {
                Object[] params = {converterId};
                if (logger.isLoggable(Level.SEVERE)) {
                    logger.log(Level.SEVERE,
                            "jsf.cannot_instantiate_converter_error", converterId);
                throw new FacesException(MessageUtils.getExceptionMessageString(
                    MessageUtils.NAMED_OBJECT_NOT_FOUND_ERROR_MESSAGE_ID, params));
            if (logger.isLoggable(Level.FINE)) {
                logger.fine(MessageFormat.format("created converter of type ''{0}''", converterId));
            return returnVal;
        }So without all the error checking, the method basically boils down to just this:
    return (Converter) newThing(converterId, converterIdMap);The heart of newThing consists of this:
    try {
                result = clazz.newInstance();
            } catch (Throwable t) {
                throw new FacesException((MessageUtils.getExceptionMessageString(
                      MessageUtils.CANT_INSTANTIATE_CLASS_ERROR_MESSAGE_ID,
                      clazz.getName())), t);
            return result;So there's no code that's supposed to set these properties in sight anywhere.
    Also the converter tag (com.sun.faces.taglib.jsf_core.ConverterTag) nor any of its base classes seems to contain such code.
    Either I'm doing something very wrong, or Mojarra has silently removed support for setting properties on custom converters, which would seem awkward.
    Any help would be greatly appreciated.

    rlubke wrote:
    Mojarra has never supported such functionality, so it hasn't been silently removed.Thanks for explaining that. Like I said, the silently removed option thus was the less likely of the two ;)
    The documentation for this converter sub-element states:
    <xsd:element name="property"
    type="javaee:faces-config-propertyType"
    minOccurs="0"
    maxOccurs="unbounded">
    <xsd:annotation>
    <xsd:documentation>
    Nested "property" elements identify JavaBeans
    properties of the Converter implementation class
    that may be configured to affect the operation of
    the Converter.  This attribute is primarily for
    design-time tools and is not specified to have
    any meaning at runtime.
    </xsd:documentation>
    </xsd:annotation>
    </xsd:element>
    That documentation is quite clear indeed. I now notice that the project I was working on still had a JSF 1.1 faces-config DTD, and that documentation said this:
    Element : property
    The "property" element represents a JavaBean property of the Java class represented by our parent element.
    Property names must be unique within the scope of the Java class that is represented by the parent element,
    and must correspond to property names that will be recognized when performing introspection against that
    class via java.beans.Introspector.
    Content Model : (description*, display-name*, icon*, property-name, property-class, default-value?,
    suggested-value?, property-extension*)So there it actually says nothing about the design time aspect.
    I do have to mention that I think this entire difference between design time and run time could maybe have been a bit more officially formalized. Don't get me wrong, I think JSF and the whole of Java EE is a really good spec that has helped me tremendously with my software development efforts, but this particular thing might be open for some improvements. A similar thing also happens in the JPA spec, where some attributes on some annotations are strictly for design time tools and/or code generators, but it's never really obvious which ones that are.
    More on topic though, wouldn't it actually be a good idea if those properties where taken into account at run-time? That way you could configure a set of general converters and make them available using some ID. In a way this wouldn't be really different in how we're configuring managed beans today.

  • [JS CS3]setting properties of inline rectangle

    Hi,
    This doesn't seem to work for somes reason...
    myLibItem = myLib.assets.item("Steunvraag");
    var myIP = myFrame.texts.item(0).insertionPoints.item(-1);
    myLibItem = myLibItem.placeAsset(myIP);
    myLibItem.anchoredObjectSettings.anchoredPosition = AnchorPosition.anchored;
    So I've placed a library asset in an insertion point - so far so good - but when i want to set properties of the result (a rectangle), I get an error about the object not supporting the method anchoredObjectSettings. I use the same construction elsewhere in the script with a textframe created from scratch, and that works fine.
    Any suggestions?
    thnx

    placeAsset returns an array (even for this case where there can only ever be one item). So:
    myLibItem = myLibItem.placeAsset(myIP)[0];
    Dave

  • OMBPLUS - Setting properties of objects in Collection.

    Hi All,
    I am trying to set the Deployable property of objects in a collection in order to automate our deployment process. Basically, we use collections for our releases, and I want to set the property as above before running our deployment script which looks for objects that are marked as deployable.
    see below my attempt at this:
    #logging file
    set OMBLOG C:\\CORT_BAUV_13\\OMB\\omblog.txt
    set fParams [open Params.lst r]
    gets $fParams OwbUsername
    gets $fParams OwbPasswd
    gets $fParams Hostname
    gets $fParams Port
    gets $fParams Database
    gets $fParams StgUsername
    gets $fParams OdsUsername
    gets $fParams ClnUsername
    gets $fParams DwhCrtUsername
    gets $fParams DwhLdwUsername
    gets $fParams CtlUsername
    gets $fParams DwhAdmUsername
    gets $fParams Passwd
    gets $fParams resetAll
    gets $fParams Collection
    close $fParams
    #REPOSITORY CONNECTION
    set reposConnection $OwbUsername/$OwbPasswd@$Hostname:$Port:$Database
    #CONSTANTS
    set projectName MI_HEAD
    puts "Connecting to: $reposConnection"
    OMBCONNECT $reposConnection
    puts "Connected to Repository..."
    OMBCC '/$projectName/'
    OMBCONNECT CONTROL_CENTER
    set dtaList [OMBRETRIEVE COLLECTION '$Collection' GET DATA_AUDITOR REFERENCES   ]
    puts "Resetting Data Auditors $dtaList"
    foreach dtaName $dtaList {
    OMBALTER DATA_AUDITOR '$dtaName' SET PROPERTIES (DEPLOYABLE) VALUES (1)
    OMBCOMMIT
    OMBDISC
    Currrently, I get this error:
    OMB01004: Current context is not an Oracle module context.
    Any ideas?

    thanks david...
    the main problem is getting the module to switch context to..
    the result of the puts "Resetting Data Auditors $dtaList" is as follows:
    Resetting Data Auditors /MI_HEAD/TGT_STAGE/VALID_BUSINESS_AREA_AUDIT
    /MI_HEAD/TGT_STAGE/VALID_DRAWDOWN_AUDIT /MI_HEAD/TGT_STAGE_LD/VALID_LD_CONNECTION_AUDIT
    the result above does show the module of each object but how do i dynamically change context to each module
    i.e
    foreach dtaName $dtaList {
    OMBCC $dtaName
    OMBALTER DATA_AUDITOR '$dtaName' SET PROPERTIES (DEPLOYABLE) VALUES (1)
    i tried OMBCC$dtaName
    OMBCC '..'
    to get into the context of the module that holds the object, but that still did not work...
    thanks,
    Olu

  • Setting properties

    hi,
    is it possible to set properties on one java class and then acess them from another?
    setting on one
    <jsp:useBean id="employee" class="com.Database.Employee scope="page"/>
                                           <jsp:setProperty name="employee" property="forename" value="Helen"/>
                                           <jsp:setProperty name="employee" property="surname" value="McArthur"/>
                                  </jsp:useBean>setting on another:
         <jsp:useBean id="empskill" class="com.Database.EmployeeSkill" scope="page">
             <jsp:setProperty name="empskill" property="sname" value="Java"/>
         </jsp:useBean>
         so that i may call this?:
    public ArrayList getReport()
            System.out.println("calling getEmployeeSkills(ename, sname, yearsexp");
            ArrayList employeeSkillDetails = new ArrayList();
            try
                JDBCConn conection = new JDBCConn();
                this.con = conection.Connect();
                stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
                StringBuffer sb = new StringBuffer();
                sb.append("SELECT Forename, Surname, SkillName, SkillLevel, YearsExperience  " +
                        "FROM TB_Employee, TB_Skill, TB_EmpSkill " +
                        "WHERE TB_EmpSkill.EmpID = TB_Employee.EmpID  " +
                        "AND TB_EmpSkill.SkillID = TB_Skill.SkillID ");
                if (Employee.forename != null)
                    sb.append("AND forename = '" +Employee.forename+ "' ");   
                if (Employee.surname !=null)
                    sb.append("AND forename = '" +Employee.surname+ "' ");   
                if (this.yearsexperience != null)
                    sb.append("AND YearsExperience = '" +this.yearsexperience+ "' ");
                System.out.println(sb.toString());
                rs = stmt.executeQuery(sb.toString());
                while (rs.next())
                    EmployeeSkill empSkill = new EmployeeSkill();
                    Employee.forename = rs.getString(1);
                    Employee.surname = rs.getString(2);
                    empSkill.skilllevel = rs.getString(4);
                    empSkill.yearsexperience = rs.getString(5);
                    employeeSkillDetails.add(empSkill);
            catch (Exception e)
                e.printStackTrace();
            return employeeSkillDetails;
        }or do all the varables have to be in the same class

    all iget when i do this is:
    org.apache.jasper.JasperException: /main.jsp(34,73) equal symbol expected
         org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:512)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    root cause
    org.apache.jasper.JasperException: /main.jsp(34,73) equal symbol expected
         org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39)
         org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:405)
         org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:86)
         org.apache.jasper.compiler.Parser.parseAttribute(Parser.java:193)
         org.apache.jasper.compiler.Parser.parseAttributes(Parser.java:143)
         org.apache.jasper.compiler.Parser.parseUseBean(Parser.java:1014)
         org.apache.jasper.compiler.Parser.parseStandardAction(Parser.java:1240)
         org.apache.jasper.compiler.Parser.parseElements(Parser.java:1576)
         org.apache.jasper.compiler.Parser.parse(Parser.java:126)
         org.apache.jasper.compiler.ParserController.doParse(ParserController.java:211)
         org.apache.jasper.compiler.ParserController.parse(ParserController.java:100)
         org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:155)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:295)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:276)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:264)
         org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:563)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:305)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

  • Coding Multiple TDMS Set Properties Efficientl​y

    I am trying to save some test settings as TDMS properties.  I have figured out the mechanics of saving individual properties to the file, but I have 25 or so properties to write to the file.  What is the most efficient way to code this in LV, so that I don't have to use the "TDMS Set Properties" block 25 different times?  I have tried sending the block arrays, but it doesn't like that.  Is there some kind of loop I can use?
    Steve
    Solved!
    Go to Solution.

    Another idea is this:
    Ton
    Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
    Nederlandse LabVIEW user groep www.lvug.nl
    My LabVIEW Ideas
    LabVIEW, programming like it should be!

  • TDMS Set Properties fails

    Hi.
    I am currently developing an application which writes some data into a TDMS file.
    I have used the TDMS Set Properties VI to add some special properties as meta data.
    Basically it works, but only once. Now I would like to know why: The error message is:
    "LabVIEW:  An input parameter is invalid. For example if the input is a path, the path might contain a character not allowed by the OS such as ? or @. "
    I attached two files. One of them works (the one where only a single Set Properties VI is actually used), the other doesn't - it returns the error above.
    Why is that so?
    Attachments:
    works.jpg ‏85 KB
    doesntwork.jpg ‏87 KB

    Hi Wolfgang
    I am sorry that I can't provide any VIs, because I stopped working for the company (this was just some bonus project to do something). I don't have the VIs here, I also do not have 8.2 here, so I can't build a sample application anymore.
    As soon as I connected the second wire to MF (or LF, it didn't matter), the VI gave me an error (I don't remember the error code, sorry) directly after the VI where I connected. If only one
     was connected, everything worked fine.

  • NPE setting properties with CustomEvent

    Hello, I am trying out CustomEvents, but there is something strange setting properties. I try to do a
    public class CustomEvents extends VBean {
       private ID myEvent = ID.registerProperty("MY_EVENT");
       private ID myData = ID.registerProperty("MY_DATA");
       private IHandler handler = null;
       private void log(String message) {
          System.out.println(message);
       public CustomEvents() {
          log("Constructor");
       public final void init(IHandler handler) {  
          this.handler = handler;
          super.init(handler);
          log("Init");
          try {
             CustomEvent customEvent = new CustomEvent(handler, myEvent);
             if ( (myEvent == null) || (myData == null) || (handler == null) || (customEvent == null) ) {
                log("There be nulls");
             handler.setProperty(myData, "hep");
             dispatchCustomEvent(customEvent);
          } catch (Exception e) {
             e.printStackTrace();
          log("done");
    }but end up with an
    Constructor
    Init
    java.lang.NullPointerException
         at oracle.forms.handler.JavaContainer.setProperty(Unknown Source)
         at fi.affecto.webmarela.forms.CustomEvents.init(CustomEvents.java:31)
         at oracle.forms.handler.UICommon.instantiate(UICommon.java:2984)
         at oracle.forms.handler.UICommon.onCreate(UICommon.java:1040)
         at oracle.forms.handler.JavaContainer.onCreate(Unknown Source)
         at oracle.forms.engine.Runform.onCreateHandler(Runform.java:2254)
         at oracle.forms.engine.Runform.processMessage(Runform.java:3347)
         at oracle.forms.engine.Runform.processSet(Runform.java:3491)
         at oracle.forms.engine.Runform.onMessageReal(Runform.java:3099)
         at oracle.forms.engine.Runform.onMessage(Runform.java:2857)
         at oracle.forms.engine.Runform.sendInitialMessage(Runform.java:5635)
         at oracle.forms.engine.Runform.startRunform(Runform.java:1207)
         at oracle.forms.engine.Main.createRunform(Unknown Source)
         at oracle.forms.engine.Main.start(Unknown Source)
         at sun.applet.AppletPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    done
    */any suggestions? myData is not null but has it failed to hook on to something during initialization? I decompiled JavaContainer and it only has null checks for top-level incoming parameters and the stack trace doesn't give any more detail. Or am I misunderstanding the usage of Custom Events completely?
    Thankful for help,
    -Nik

    Nicklas,
    the problem is that Forms does not have a property
    handler.setProperty(myData, "hep");
    You need to override
    public boolean setProperty(ID ID, Object object)
    in your Java implementation. Then within this method you evaluate if the ID is "myData" and if, do something. If no ID match can be found then you call
    return super.setProperty(_ID, _object);
    Thsi way all custom properties are handled by you and all Forms properties are passed to Forms.
    Frank

  • How to set properties in a loop in jsp

    I have a problem to set properties for beans in jsp
    this is part of my code:
    <jsp:useBean id="searchHandler" class="searchHandler.class"
    scope="session">
    </jsp:useBean>
    <%
    String[] tempStr={"hello","you","happy"};
    for(int i=0; i<tempStr.length; i++)
    %>
    <jsp:setProperty name="searchHandler" property="beanStr" value="<%= tempStr[i] %>" />
    <%
    %>
    it doesn't work well.
    something wrong?

    Hi,
    why do you use the print-tag in your setProperty-Tag.
    Try it without <%=tempStr%>.
    Try <%tempStr%>
    or only tempStr.

  • Oracle9i Intermedia cannot set properties

    hai, i want to ask why Oracle9i in my server cant set properties for mp3 or wav (audio length can be recognized, but the value of mimetype and format is ???). but when i use another Oracle9i in another computer, i can. when i check with System.out.println (Java), the file uploaded with servlet, i use method OrdHttpUploadFile.getMimeType() its work (the output is "audio/mpeg") but when OrdAudio.getMimeType() its output is "???"
    any idea

    no exception at all
    i'm using Java servlet for upload and retrieve media, with JBoss as Application Server,
    this code is for upload:
    oracle.jdbc.driver.OracleCallableStatement insertAudio =
    (oracle.jdbc.driver.OracleCallableStatement)
    conn.prepareCall("BEGIN "+
    "INSERT INTO audiotab VALUES(1,:1,:2,:3,:4,:5,SYSDATE," +
    "ORDSYS.ORDAudio.init(),:6,:7,:8) " +
    "RETURN audioid INTO :9 ; END;");
    ... (fill bind variable)
    insertAudio.executeUpdate();
    oracle.jdbc.driver.OraclePreparedStatement selectAudio=
    (oracle.jdbc.driver.OraclePreparedStatement)
    conn.prepareStatement(
    "SELECT * FROM audiotab WHERE audioid=? FOR UPDATE ");
    ... (fill bind variable)
    oracle.jdbc.driver.OraclePreparedStatement updateAudio=
    (oracle.jdbc.driver.OraclePreparedStatement)
    conn.prepareStatement(
    "UPDATE audiotab SET audiofile=:1 WHERE audioid=:2");
    .... (fill bind variable)
    OracleResultSet rs=(OracleResultSet)selectAudio.executeQuery();
    if(rs.next())
    OrdAudio ord=(OrdAudio)rs.getCustomDatum(8,OrdAudio.getFactory());
    data.loadAudio(ord);
    formData.release();
    updateAudio.setCustomDatum(1,ord);
    updateAudio.setLong(2,audioid);
    updateAudio.executeUpdate();
    conn.commit();
    there is one thing that maybe weird (for me), when i'm using Toad from Quest Software, i look the ORDAudio, THERE IS audio/mpeg as its MIME type, and other properties was right, so what happen with this?? is it because of Java, Oracle, or web server, i'm using tomcat 4 before JBoss 4, and the result was same.
    and there is one thing that disturbing me, why method getCustomDatum() from OracleResultSet was deprecated, although it works but its annoying, is there other method to get the ORDAudio and other ORD.

Maybe you are looking for

  • Macbook w/ whole slew of problems...Won't Start Up, Disk Utility Can't Repair Disk, Horizontal Lines on Screen, Etc.

    I purchased my Macbook in the summer of 2011 and before it went berserk it was running Mavericks. 3 years later, it's finally seemed to have run its course. It won't start up normally and it won't start up on safe boot. Attempting to use disk utility

  • HELP A COMPLETE NOOB! Java Switch Statement?

    Hi, I am trying to use a simple switch statement and I just cant seem to get it to work?; import java.util.Scanner; public class Month { public static void main(String[] args) { String message; Scanner scan = new Scanner(System.in); System.out.printl

  • Imovie HD don't  detect camera

    iMovie HD 6 does not detect camera and it does not capture what I can do? Sorry my misspelling, and thank youu!!

  • INFO about new 80GB ipod video

    Hi, i'have (may be) a very stupid question about the 80gb ipod, but i'm a new ipod customer so...i don't know Well: the real capacity of the ipod 80 gb's hardisk is pratically 74 gb? and not 80 gb? Sorry for the basically question! Bye G4   Mac OS X

  • How to increase legibility of printng in display

    HELP! I replaced my 5-year-old eMAC with a 20" iMAC. Printing on the iMAC screen (Help, eMail Discussions. etc.) is so small and dim that I can hardly read it without a magnifying glass There was provision on the eMAC to make print larger when needed