How to handle similar classes nicely
Suppose I have a function and it should be able to do the same operation to the references. The references can be int[], byte[] or float[]. How can the function to handle this problem nicely? To make it simple, let's say the function will increase each element in the array 1. The best way I can think of is
function(Object array, String key){
if (key.equals("int")){
for (int i = 0; i < ((int[])array).length; i++)
((int[])array)++;
if (key.equals("float")){
for (int i = 0; i < ((float[])array).length; i++)
((float[])array)[i]++;
But that looks silly since each time I am typing array I have to cast it's class. Can I cast it once and use it everywhere? Is there any better way to do that? thanks a lot.
zl2k
Write overloaded methods:function(int[] array) {
for (int i = 0; i < array.length; i++)
array[i]++;
function(float[] array) {
for (int i = 0; i < array.length; i++)
array[i]++;
}Have a look at java.util.Arrays if you want to see a full-blown example of this sort of thing in action.
Similar Messages
-
How java handles package/class names
I am developing a strategy for internationalizing our company's middle-ware product. While I have no problem with the GUI's, exceptions, log files etc, I have no concept of how things like classpaths and packages can be specified in an asian language.
For instance, if I have configuration information of com.abccompany.mypackage.MyClass, what will this look like to the asian user? Will they be able to change it to perhaps com.abccompany.mypackage.MyClass2 by entering localized data in Chinese or Arabic? I don't understand how this part works. On the command-line, will they type English script names? Do they run commands like so: java -cp com.abc.pkg1.jarfile.jar MyClass? Will my english filenames, packages, etc be represented in asian characters?
We have a lot of configuration information that specify java classes as String data. I am concerned about the ability to modify this data and have it work correctly in languages that do not use the ascii character set. Is this something I need to be worried about?
I appreciate any input. Thanks in advance.You do not need to warry about configuration information of com.abccompany.mypackage.MyClass
and command-line no matter what languages used in Asia. Asian users also type in English script names or java -cp com.abc.pkg1.jarfile.jar MyClass as you do so. The only thing you need to note is
that any text strings or messages which you want to show on any panel/dialog/window/frame and so on should be store in a resource file for internationalizing. -
How Java handle duplicated class?
I am trying to send out email using SUN JavaMail. However, an old version of JavaMail was shipped with Oracle AppServer 10 R2. If I package the new JavaMail into the WAR file, the old JavaMail is still functional, and cause problem to my program. Is there a way to tell the AppServer to use the JavaMail in my WAR file instead of the old one shipped with the server?
Thanks very much!
Edited by: huaichen on Nov 6, 2008 2:02 PMHi,
does this help you? It's from an older vesion but might wor kin your case.
How do I setup OC4J to load local classes packaged in my Web Application overriding System classes or classes in the higher level?
OC4J 9.0.3 has a configurable option to load local classes first, overriding classes at a higher level. You have to include the following to directive in the orion-web.xml for your web module to ask OC4J to load local classes:
<web-app-class-loader search-local-classes-first="true" />Timo -
How to handle movielclip of stage by class
i m making three movie Clip A, B, C in Main movieclip on stage .
can u tell me how to handle these movieclip by cleass file in actionscript 3.0.
i dont want to access these movieclip from libaray.For each clip in the library that you want to control from your class you set the linkage properties and give the item a class name. The class name you give it allows you to instantiate it from code.
So, say you have a document class, and want to put clip A on stage in the constructor, and you've given it a class name of LibraryClipA:
package{
class MyDoc{
private var clipA:LibraryClipA;
function MyDoc(){
clipA = new LibraryClipA();
clipA.x = 100;
clipA.y = 100;
addChild(clipA); -
How to handle "xsd:anyAttributes" with jaxb
Need help for how to handling "xsd:anyAttribute" with jaxb!
Here is part of my xml schema.
<xsd:attributeGroup name="DataAttributes">
<xsd:anyAttribute namespace="##local" processContents="lax"/>
</xsd:attributeGroup>
<xsd:element name="Data">
<xsd:complexType>
<xsd:attributeGroup ref="DataAttributes"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="MA_Verify">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="Data" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
<xsd:attributeGroup ref="verifyAttributes"/>
</xsd:complexType>
</xsd:element>
I have an application which only knows the attribute names and values at runtime. (Thest attributes are string.) Therefore, I cannot define attribute names in the schema and have to use xsd:anyAttribute.
I was able to generate all jaxb code. However, the interfaces generated for Data and DataType are basically all empty. The impl classes are empty too, since no get or set methods exist for the attribute.
Some thoughts for handling this case, but do not know if it will work.
(1) write some derive classes on top of the generated jaxb classes.
(2) write customized method to handle the 'Data' element level and its attributes. Similar to parseMethod or printMethod for the javaType.
(if there is a way)
Can anyone give me suggestions, directions or an laternate way to handle the situation?
Your help will be greatly appreciated.
Ruthxsd:anyAttribute is not supported by JAXB.
http://java.sun.com/xml/jaxb/users-guide/jaxb-works.html#unsupported -
How to handle exception CX_SY_REF_IS_INITIAL
hi experts,
im working on a test scenario for abap mapping in SAP XI im getting this error
An exception with the type CX_SY_REF_IS_INITIAL occurred, but was neither handled locally, nor declared in a RAISING clause Dereferencing of the NULL reference
i understand that i need to catch this exception in the abap coding but i'm not familiar with oops concepts
can any one please suggest me how to handle this exception for the following code...
method IF_MAPPING~EXECUTE.
break x1149.
* initialize iXML
TYPE-POOLS: ixml.
class cl_ixml definition load.
** Instances & Variable declaration =======================
* instance main factory
TYPES: BEGIN OF t_xml_line,
data(256) TYPE x,
END OF t_xml_line.
DATA: l_ixml TYPE REF TO if_ixml,
* instance input stream factory
l_streamfactory TYPE REF TO if_ixml_stream_factory,
* instance input stream
l_istream TYPE REF TO if_ixml_istream,
* instance input document
l_document TYPE REF TO if_ixml_document,
* instance parse input document
l_parser TYPE REF TO if_ixml_parser,
* instance for elements within the nodes
node TYPE REF TO if_ixml_node,
*instance of nodemap
nodemap TYPE REF TO if_ixml_named_node_map,
* instance for iterator
iterator TYPE REF TO if_ixml_node_iterator,
name TYPE string,
value TYPE string,
* instance main factory
o_ixml TYPE REF TO if_ixml,
* instance output document
o_document TYPE REF TO if_ixml_document,
* instance output stream
o_istream TYPE REF TO if_ixml_ostream,
* instance parse output document
o_parser TYPE REF TO if_ixml_parser,
* instance fot renderer
renderer type ref to if_ixml_renderer,
irc type i,
l_xml_size TYPE i,
*ROOT ELEMENT
l_element_MT_DEMANDTEC_COST TYPE REF TO if_ixml_element,
*NEXT CHILD ELEMENT FROM THE ABOVE PARENT
l_element_DT_DEMANDTEC TYPE REF TO if_ixml_element,
*CHILDREN1 ELEMENT FOR DT_DEMANDTEC
l_element_DT_WHSE TYPE REF TO if_ixml_element,
*CHILDREN2 ELEMENT FOR DT_DEMANDTEC
l_element_DT_DC TYPE REF TO if_ixml_element,
*CHILDREN3 ELEMENT FOR DT_DEMANDTEC
l_element_DT_PLANT TYPE REF TO if_ixml_element,
*CHILDREN4 ELEMENT FOR DT_DEMANDTEC
l_element_DT_QTY TYPE REF TO if_ixml_element.
*saving the xml document
DATA: l_xml_table TYPE TABLE OF t_xml_line.
types: begin of t_source,
whse(5),
dc(4) ,
plant(4),
qty type i,
end of t_source.
types: tt_source TYPE STANDARD TABLE OF t_source.
data: wa_source type t_source.
data: it_source TYPE tt_source,
ivalue type string.
* Procedures and business logic =======================================
* Creating the main iXML factory
l_ixml = cl_ixml=>create( ).
* Creating a stream factory
l_streamfactory = l_ixml->create_stream_factory( ).
* create input stream
l_istream = l_streamfactory->create_istream_xstring( source ).
* initialize input document
l_document = l_ixml->create_document( ).
* Create a Parser
l_parser = l_ixml->create_parser( stream_factory = l_streamfactory
istream = l_istream
document = l_document ).
* parse input document
l_parser->parse( ).
* Validate a document
l_parser->set_validating( mode = if_ixml_parser=>co_validate ).
* Parse the stream
IF l_parser->parse( ) NE 0.
IF l_parser->num_errors( ) NE 0.
DATA: parseerror TYPE REF TO if_ixml_parse_error,
str TYPE string,
i TYPE i,
count TYPE i,
index TYPE i.
count = l_parser->num_errors( ).
WRITE: count, ' parse errors have occured:'.
index = 0.
WHILE index < count.
parseerror = l_parser->get_error( index = index ).
i = parseerror->get_line( ).
WRITE: 'line: ', i.
i = parseerror->get_column( ).
WRITE: 'column: ', i.
str = parseerror->get_reason( ).
WRITE: str.
index = index + 1.
ENDWHILE.
ENDIF.
ENDIF.
* Process the document
IF l_parser->is_dom_generating( ) EQ 'X'.
refresh : it_source.
node ?= l_document.
CHECK NOT node IS INITIAL.
* create a node iterator
iterator = node->create_iterator( ).
* get current node
node = iterator->get_next( ).
* loop over all nodes
WHILE NOT node IS INITIAL.
CASE node->get_type( ).
WHEN if_ixml_node=>co_node_element.
* element node
name = node->get_name( ).
nodemap = node->get_attributes( ).
WHEN if_ixml_node=>co_node_text.
* text node
value = node->get_value( ).
if name eq 'DT_WHSE'.
wa_source-whse = value.
ELSEIF name eq 'DT_DC'.
wa_source-DC = value.
ELSEIF name eq 'DT_PLANT'.
wa_source-PLANT = value.
ELSEIF name eq 'DT_QTY'.
wa_source-QTY = value.
COLLECT wa_source INto it_source.
CLEAR wa_source.
ENDIF.
endcase.
node = iterator->get_next( ).
endwhile.
ENDIF.
loop at it_source into wa_source .
at first.
* Creating a ixml factory
o_ixml = cl_ixml=>create( ).
* Creating the dom object model
o_document = l_ixml->create_document( ).
endat.
* Build and Fill root node MT_DEMANDTEC_COST
AT FIRST.
l_element_MT_DEMANDTEC_COST =
O_document->create_simple_element(
name = 'MT_DEMANDTEC_COST'
parent = o_document ).
ENDAT.
* Build and Fill Child node DT_DEMANDTEC for parent
* MT_DEMANDTEC_COST
l_element_DT_DEMANDTEC = O_document->create_simple_element(
name = 'DT_DEMANDTEC'
parent = l_element_MT_DEMANDTEC_COST ).
* Build and Fill Child node1 DT_WHSE for parent DT_DEMANDTEC
ivalue = wa_source-WHSE.
l_element_DT_WHSE = O_document->create_simple_element(
name = 'DT_WHSE'
VALUE = ivalue
parent = l_element_DT_DEMANDTEC ).
* Build and Fill Child node2 DT_WHSE for parent DT_DEMANDTEC
ivalue = wa_source-DC.
l_element_DT_DC = O_document->create_simple_element(
name = 'DT_DC'
VALUE = ivalue
parent = l_element_DT_DEMANDTEC ).
* Build and Fill Child node3 DT_WHSE for parent DT_DEMANDTEC
ivalue = wa_source-PLANT.
l_element_DT_PLANT = O_document->create_simple_element(
name = 'DT_PLANT'
VALUE = ivalue
parent = l_element_DT_DEMANDTEC ).
* Build and Fill Child node4 DT_QTY for parent DT_DEMANDTEC
ivalue = wa_source-QTY.
l_element_DT_QTY = O_document->create_simple_element(
name = 'DT_QTY'
VALUE = ivalue
parent = l_element_DT_DEMANDTEC ).
endloop.
* render document ======================================================
* create output stream
o_istream = l_streamfactory->create_ostream_xstring( result ).
* Connect internal XML table to stream factory
o_istream = l_streamfactory->create_ostream_itable( table =
l_xml_table ).
renderer = o_ixml->create_renderer( ostream = o_istream
document = o_document ).
irc = renderer->render( ).
* how do i catch the exception for type CX_SY_REF_IS_INITIAL ...?
endmethod.
full reward points for answers.
Thanks & Regards,
Uday Kumar.
Edited by: UDAY on May 6, 2008 9:32 PMHi Uday,
Its occurs because you're trying to access a objects with null reference. Or you forgot to create an instance or an error occurs during the instance creation. So You should put all your "Procedures and business logic" inside a Try/catch block. as follow.
" Define a class exception object to get error message......
DATA o_exception TYPE REF TO cx_sy_ref_is_initial.
"// Use the statment Try block to catch the error.
TRY.
* Creating the main iXML factory
l_ixml = cl_ixml=>create( ).
* Creating a stream factory
l_streamfactory = l_ixml->create_stream_factory( ).
* create input stream
l_istream = l_streamfactory->create_istream_xstring( source ).
* initialize input document
l_document = l_ixml->create_document( ).
* Create a Parser
l_parser = l_ixml->create_parser( stream_factory = l_streamfactory
istream = l_istream
document = l_document ).
* parse input document
l_parser->parse( ).
* Validate a document
l_parser->set_validating( mode = if_ixml_parser=>co_validate ).
* Parse the stream
IF l_parser->parse( ) NE 0.
IF l_parser->num_errors( ) NE 0.
DATA: parseerror TYPE REF TO if_ixml_parse_error,
str TYPE string,
i TYPE i,
count TYPE i,
index TYPE i.
count = l_parser->num_errors( ).
WRITE: count, ' parse errors have occured:'.
index = 0.
WHILE index < count.
parseerror = l_parser->get_error( index = index ).
i = parseerror->get_line( ).
WRITE: 'line: ', i.
i = parseerror->get_column( ).
WRITE: 'column: ', i.
str = parseerror->get_reason( ).
WRITE: str.
index = index + 1.
ENDWHILE.
ENDIF.
ENDIF.
* Process the document
IF l_parser->is_dom_generating( ) EQ 'X'.
refresh : it_source.
node ?= l_document.
CHECK NOT node IS INITIAL.
* create a node iterator
iterator = node->create_iterator( ).
* get current node
node = iterator->get_next( ).
* loop over all nodes
WHILE NOT node IS INITIAL.
CASE node->get_type( ).
WHEN if_ixml_node=>co_node_element.
* element node
name = node->get_name( ).
nodemap = node->get_attributes( ).
WHEN if_ixml_node=>co_node_text.
* text node
value = node->get_value( ).
if name eq 'DT_WHSE'.
wa_source-whse = value.
ELSEIF name eq 'DT_DC'.
wa_source-DC = value.
ELSEIF name eq 'DT_PLANT'.
wa_source-PLANT = value.
ELSEIF name eq 'DT_QTY'.
wa_source-QTY = value.
COLLECT wa_source INto it_source.
CLEAR wa_source.
ENDIF.
endcase.
node = iterator->get_next( ).
endwhile.
ENDIF.
loop at it_source into wa_source .
at first.
* Creating a ixml factory
o_ixml = cl_ixml=>create( ).
* Creating the dom object model
o_document = l_ixml->create_document( ).
endat.
* Build and Fill root node MT_DEMANDTEC_COST
AT FIRST.
l_element_MT_DEMANDTEC_COST =
O_document->create_simple_element(
name = 'MT_DEMANDTEC_COST'
parent = o_document ).
ENDAT.
* Build and Fill Child node DT_DEMANDTEC for parent
* MT_DEMANDTEC_COST
l_element_DT_DEMANDTEC = O_document->create_simple_element(
name = 'DT_DEMANDTEC'
parent = l_element_MT_DEMANDTEC_COST ).
* Build and Fill Child node1 DT_WHSE for parent DT_DEMANDTEC
ivalue = wa_source-WHSE.
l_element_DT_WHSE = O_document->create_simple_element(
name = 'DT_WHSE'
VALUE = ivalue
parent = l_element_DT_DEMANDTEC ).
* Build and Fill Child node2 DT_WHSE for parent DT_DEMANDTEC
ivalue = wa_source-DC.
l_element_DT_DC = O_document->create_simple_element(
name = 'DT_DC'
VALUE = ivalue
parent = l_element_DT_DEMANDTEC ).
* Build and Fill Child node3 DT_WHSE for parent DT_DEMANDTEC
ivalue = wa_source-PLANT.
l_element_DT_PLANT = O_document->create_simple_element(
name = 'DT_PLANT'
VALUE = ivalue
parent = l_element_DT_DEMANDTEC ).
* Build and Fill Child node4 DT_QTY for parent DT_DEMANDTEC
ivalue = wa_source-QTY.
l_element_DT_QTY = O_document->create_simple_element(
name = 'DT_QTY'
VALUE = ivalue
parent = l_element_DT_DEMANDTEC ).
endloop.
* render document ======================================================
* create output stream
o_istream = l_streamfactory->create_ostream_xstring( result ).
* Connect internal XML table to stream factory
o_istream = l_streamfactory->create_ostream_itable( table =
l_xml_table ).
renderer = o_ixml->create_renderer( ostream = o_istream
document = o_document ).
irc = renderer->render( ).
" The Statement CATCH define a block that catches the exceptions of the
" exception class cx_sy_ref_is_initial
CATCH cx_sy_ref_is_initial INTO o_exception.
" If you need to get the error message text do as follow
DATA errorMsg type string.
" Get the message text
errorMsg = o_exception->GET_TEXT( ).
" Display the error information
MESSAGE errorMsg TYPE 'I'.
ENDTRY.
The TRY block defines a guarded area whose class-based exceptions can be caught in the subsequent CATCH blocks. If no exception occurs in the TRY block and it reaches its end, the system continues the processing after ENDTRY. If a class-based exception occurs in the TRY block, the system searches for an exception handler in the same or an external TRY control structure.
Font: SAP Help
You can see a how to create and use an exception in this example [ ABAP Objects - Defining a Class-based exceptions|https://wiki.sdn.sap.com/wiki/x/19w] .
Best Regards.
Marcelo Ramos -
Duplicate check via BAS (ADDRESS_SEARCH)-- how to handle non-crm customer?
Dear all,
I'm implementing a duplicate check and using the BADI Address_search. Within this BADI I use the method "Address_Search" for calling a third party software tool with customer information. This tool checks whether the entered customer is already available in CRM AND in other system in our company holding.
The method provides me a list of all found duplicates (incl. non-crm customers)
My problem is that I need to fill a export table "ex_t_search_result" (type adkey_indx_tab) of this method which expects ADRC number. For the CRM customer it is not a problem. I can figure them out by table BUT020 and the customer number. But for the non-crm customer I do not have a ADRC number.
I know there are some methods for creating addresses in BAS (function group SZA0), but actually Im not sure how to handle them.
Does anybody of you had faced a similar issue?
Thanks for your help
Firat C.hello,
BP is BDT (Business Data toolset) enabled (you can check it by adding break point in FM BUS_PBO and executing BP transaction). You can add your check directly to standard view (the check will be executed each time when user pushes enter) or you could add you check to appropriate action (during saving etc.) there are number of actions which you could use it depends on your requirements. You can find a lot of info about BDT (if you are not familiar) in Wiki.
br,
dez_ -
How to handle parked message in BPM?
Hi,
I have a scenario that buyer as R3 send PO(same PO number) change idoc multiple times into bpm without receiving PO change confirmation(from seller, non R3) yet, I have a loop in bpm to handle this case, the loop checks the condition whether confirmation matches change request, if not, potential loop repeats. However, if I have multiple change request(same PO number) sent from R3 to BPM, my BPM waiting for my order confirmation, then if the first order confirmation comes into BPM matches with the first change request, then I exit the loop, but I still have several change requests parked at processXXXXX yet to be processed, does anybody came into similar situations? Any good suggestions or examples?
Thanks,
MaggieHi there,
I need to correlate ChangeConfirmation to ChangeRequest with PO number, this is for the purpose of ChangeRequest waiting for Confirmation for the same PO number. However, I don't know how to handle multiple changes come into BPM without confirmation yet, my current design is that I immediately enter a loop in BPM, with condition confirmation Info doese not match change info, thus the change request is bundled with bpm process, once the porcess is finished(response match change request), the queue of my other change requests(the parked ones) now got deleted, does anybody have any good suggestions in handling multiple change request(for same PO number) in bpm? Is there a way I can force bpm to handle one request one response, throw some error message if multiple changes comes together without response yet? Anybody had encountered similar issues?
Thanks,
Magge -
How to handle value change events of select list in custom component?
My HelloUIComp code...How to handle events for "Select"...if i choose option1 from select then one text box is to be displayed in custom component and if i choose another option then some other text box is to be displayed in custom components...
public class HelloUIComp extends UIComponentBase {
public static final String account="custom.account";
public static final String RENDERER_TYPE = null;
HtmlCommandButton button = createButton();
//HtmlSelectOneMenu select=createSelect();
public void processDecodes(FacesContext context) {
Calling the lifecycle method "processDecodes" on the
internal button is absolutely critical to create action events
button.processDecodes(context);
super.processDecodes(context);
private HtmlCommandButton createButton() {
FacesContext context = FacesContext.getCurrentInstance();
HtmlCommandButton newButton = new HtmlCommandButton();
newButton.setId("Add");
newButton.setValue("Add");
newButton.setType("submit");
//newButton.setOnclick("return func_1(this,event);");
MethodBinding binding = context.getApplication().createMethodBinding("#{pc_MyProjectView.go}", null);
newButton.setAction(binding);
newButton.setParent(this);
return newButton;
/* private HtmlSelectOneMenu createSelect()
HtmlSelectOneMenu selectCategory=createSelect();
return selectCategory;
public void encodeBegin(FacesContext context) throws IOException {
String style = (String)getAttributes().get("style");
String startdate = (String)getAttributes().get("startdate");
String enddate = (String)getAttributes().get("enddate");
//String add=(String)getAttributes().get("add");
ResponseWriter writer = context.getResponseWriter();
writer.startElement("table", this);
writer.writeAttribute("border","2","2");
writer.startElement("tbody", this);
writer.startElement("tr", this);
writer.startElement("td", this);
writer.writeText("Account Category", null);
writer.endElement("td");
writer.startElement("td", this);
writer.writeText("Reg-No", null);
writer.endElement("td");
writer.startElement("td", this);
writer.writeText("Account-No", null);
writer.endElement("td");
writer.startElement("td", this);
writer.writeText("", null);
writer.endElement("td");
writer.startElement("td", this);
writer.writeText("Start-Date", null);
writer.endElement("td");
writer.startElement("td", this);
writer.writeText("End-Date", null);
writer.endElement("td");
writer.endElement("tr");
writer.startElement("tr",this);
writer.startElement("td", this);
writer.startElement("select", this);
if (style!=null)
writer.writeAttribute("style", style, null);
writer.writeAttribute("name","category","category");
writer.startElement("option", this);
writer.writeText("Select", null);
writer.endElement("option");
//to access data
Account accountObj;
AccountData accountDataobj;
List listOfAccounts;
int noOfAccounts;
accountDataobj=new AccountData();
listOfAccounts=accountDataobj.getAccounts();
noOfAccounts=listOfAccounts.size();
for(int i=0;i<noOfAccounts;i++)
writer.startElement("option", this);
accountObj=(Account) listOfAccounts.get(i);
writer.writeText(accountObj.getCategory(), null);
writer.endElement("option");
//System.out.println(accountObj.getRegNo());
//System.out.println(accountObj.getAccountNo());
writer.endElement("select");
writer.endElement("td");
writer.startElement("td", this);
writer.startElement("select", this);
if (style!=null)
writer.writeAttribute("style", style, null);
writer.writeAttribute("name","regno","regno");
writer.startElement("option", this);
writer.writeText("Select", null);
writer.endElement("option");
for(int i=0;i<noOfAccounts;i++)
accountObj=(Account) listOfAccounts.get(i);
writer.startElement("option", this);
writer.writeText(""+accountObj.getRegNo(), null);
writer.endElement("option");
writer.endElement("select");
writer.endElement("td");
writer.startElement("td", this);
writer.startElement("select", this);
if (style!=null)
writer.writeAttribute("style", style, null);
writer.writeAttribute("name","accno","accno");
writer.startElement("option", this);
writer.writeText("Select", null);
writer.endElement("option");
for(int i=0;i<noOfAccounts;i++)
accountObj=(Account) listOfAccounts.get(i);
writer.startElement("option", this);
writer.writeText(accountObj.getAccountNo(), null);
writer.endElement("option");
//writer.startElement("option", this);
//writer.writeText("00200155", null);
//writer.endElement("option");
writer.endElement("select");
writer.endElement("td");
writer.startElement("td", this);
button.encodeBegin(context);
button.encodeChildren(context);
button.encodeEnd(context);
writer.endElement("td");
writer.startElement("td", this);
writer.startElement("input", this);
if (style!=null)
writer.writeAttribute("style", style, null);
writer.writeAttribute("type","text","text");
writer.writeAttribute("name","startdate","startdate");
writer.writeAttribute("value",startdate,startdate);
writer.writeAttribute("readonly", "","");
//writer.endElement("input");
writer.endElement("td");
writer.startElement("td", this);
writer.startElement("input", this);
if (style!=null)
writer.writeAttribute("style", style, null);
writer.writeAttribute("type","text","text");
writer.writeAttribute("name","enddate","enddate");
writer.writeAttribute("value",enddate,enddate);
writer.writeAttribute("readonly", "","");
writer.endElement("td");
writer.endElement("tr");
writer.endElement("tbody");
writer.endElement("table");
public String getFamily() {
return "HelloFamily";
}NewEclipseCoder wrote:
How to handle events for "Select"...if i choose option1 from select then one text box is to be displayed in custom component and if i choose another option then some other text box is to be displayed in custom components...Two ways:
1) submit the form to the server and render the desired textbox depending on the option.
or
2) render all textboxes and use Javascript/DOM to display/hide them depending on the option. -
How to get the class name static method which exists in the parent class
Hi,
How to know the name of the class or reference to instance of the class with in the main/static method
in the below example
class AbstA
public static void main(String[] args)
System.out.println(getXXClass().getName());
public class A extends AbstA
public class B extends AbstA
on compile all the class and run of
java A
should print A as the name
java B
should print B as the name
Are there any suggestions to know the class name in the static method, which is in the parent class.
Regards,
Raja Nagendra KumarWell, there's a hack you can use, but if you think you need it,Could you let me the hack solution for this..
you probably have a design flaw and/or a misunderstanding about how to use Java.)May be, but my needs seems to be very genuine..of not repeat the main method contents in every inherited class..
The need we have is this
I have the test cases inheriting from common base class.
When the main method of the test class is run, it is supposed to find all other test cases, which belong to same package and subpackages and create a entire suite and run the entire suite.
In the above need of the logic we wrote in the main method could handle any class provided it knows what is the child class from which this main is called.
I applicate your inputs on a better way to design without replicating the code..
In my view getClass() should have been static as the instance it returns is one for all its instances of that class.
I know there are complications the way compiler handles static vars and methods.. May be there is a need for OO principals to advance..
Regards,
Raja Nagendra Kumar
Edited by: rajanag on Jul 26, 2009 6:03 PM -
How to handle the Exception in GP using executable callabel object.
Hi all,
I handled an exception in GP using Background callable Object. That is working fine.
(Ex: Exception_No_User_Found). The Problem is I am not able to handle the exceptions for normal callable object. I have done the same thing as i did in background callable object except implementing IGPBackgroundCallableObject Class. I have created an WebDynpro DC Project where in getDescription method i declared an Exception and in execute method of component controller I caught the exception if no user found.
Then i created an callable object for this simple DC project. but that is not working i could not catch the exception. when i execute the process it is asking the User ID if i give the wrong userId it is not refreshing back to the user id input form.
But if i test that simple callable object separately it is throwing an Exception when I give the wrong input..
but the same thing is working fine using background callable object.
I couldn't handle the exception for the simple callable object or executable callable object.
Please If anyone bring me the solution that would be appreciated.
Thanks in advance.
Regards,
Malar.Hi Shikhil
Thanks for your reply
Please have a look below for exceptions which i am getting in GP and let me know how to handle these exceptions.
1) "Activity could not be read"
2) "Action has been stopped"
3) error while processing the item can not be displayed
if you give any idea/clue how to handle these exceptions then it would be great help to me
Thanks
Sunil -
How to handle abstract XML elements with XMLBeans
Hello,
I have an xsd that uses abstract elements, and i wanted to ask you how can i create new XML Documents with XMLBeans? My problems is that i don't know how to handle abstaction with XMLBeans.
Let me show you a very simple example to make you understand my problem :
Suppose we have the following schema :
<xsd:schema targetNamespace="http://www.example.org" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.example.org">
<xsd:element name="Customer" type="CustomerType" />
<xsd:complexType name="CustomerType" abstract="true" />
<xsd:complexType name="PremiumCustomerType">
<xsd:complexContent>
<xsd:extension base="CustomerType">
<xsd:sequence>
<xsd:element name="CreditCard" type="xsd:string" />
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
</xsd:schema>I use XMLBeans to create a jar with java classes according the xsd above. Then, in order to create a new xml document i use the following code :
CustomerDocument cd = CustomerDocument.Factory.newInstance();
CustomerType ct = cd.addNewCustomer();
PremiumCustomerType pct = PremiumCustomerType.Factory.newInstance();
ct.changeType(pct.schemaType());With this code i get an XML Document like the following :
<Customer type="PremiumCustomerType" />But after that, i cannot add an element CreditCard into this Customer element. Can anyone help me?In Indesign there is no way you can directly work on the XML-IN footnote, since indesign won't support XML tags in footnote stream.
To achive that you need to have XSLT/Perl/Indesign Scripting.
This task is achievable, you can create a auto footnote for XML workflow projects.
1. Create an XSLT to transform the footnote to the respective places
2. Change all the "<" ">" to some standard names, since indesign won't accept XML tags in the footnote stream.
3. Import it in indesign and using script convert it to autofootnote.
Shaji -
How to handle error while using dbms_sql.execute
Hi,
I am inserting some records by using the following piece of code.
stmt := 'insert into SSI_KPI_GOAL_VALUE_H (KPI_VAL_KPI_ID, KPI_VAL_RM_CDE,'|| v_day_value ||',KPI_VAL_ACT_DLY,'||v_month_val||',KPI_VAL_BIZ_UNIT_CDE) values (:kpi_array,:rm_array,:day1_array,:day1_array,:day1_array,:busnunit_array)';
l := dbms_sql.open_cursor;
dbms_sql.parse(l, stmt, dbms_sql.native);
dbms_sql.bind_array(l, ':kpi_array', col1_ins,1,ins_cnt-1);
dbms_sql.bind_array(l, ':rm_array', col2_ins,1,ins_cnt-1);
dbms_sql.bind_array(l, ':day1_array', col3_ins,1,ins_cnt-1);
dbms_sql.bind_array(l, ':busnunit_array', col4_ins,1,ins_cnt-1);
dummy := dbms_sql.execute(l);
dbms_sql.close_cursor(l);
I am getting an error since any one of the row contains value larger than the column.
How to handle exception handling for those rows which is having errors. I would like insert the records which is having
no errors. Like SAVE EXCEPTIONS for 'forall' is there any option is available to handle exceptional records.
Please help.
Thanks & Regards,
Hari.Hari,
What's oracle version? Are you looking for something similar to this? see following example
DECLARE
TYPE array
IS
TABLE OF my_objects%ROWTYPE
INDEX BY BINARY_INTEGER;
data array;
errors NUMBER;
dml_errors exception;
error_count NUMBER := 0;
PRAGMA EXCEPTION_INIT (dml_errors, -24381);
CURSOR mycur
IS
SELECT *
FROM t;
BEGIN
OPEN mycur;
LOOP
FETCH mycur BULK COLLECT INTO data LIMIT 100;
BEGIN
FORALL i IN 1 .. data.COUNT
SAVE EXCEPTIONS
INSERT INTO my_new_objects
VALUES data (i);
EXCEPTION
WHEN dml_errors
THEN
errors := sql%BULK_EXCEPTIONS.COUNT;
error_count := error_count + errors;
FOR i IN 1 .. errors
LOOP
DBMS_OUTPUT.put_line( 'Error occurred during iteration '
|| sql%BULK_EXCEPTIONS(i).ERROR_INDEX
|| ' Oracle error is '
|| sql%BULK_EXCEPTIONS(i).ERROR_CODE);
END LOOP;
END;
EXIT WHEN c%NOTFOUND;
END LOOP;
CLOSE mycur;
DBMS_OUTPUT.put_line (error_count || ' total errors');
END;Regards
OrionNet -
How to handle 2 or more .jar files with an applet
Hey out there
I have created an ftpClient application that uses "jakarta ftpClient". It works fine as an JFrame application � But when I converted the Application into an JApplet I get the following Exception:
java.lang.NoClassDefFoundError: org/apache/commons/net/ftp/FTPClient
I have bundled the main application into a .jar file (Application,jar). But I don't know how to handle the 2 jakarta .jar files with my JApplet??
I Tried to append the 2 jakarta .jar files to the Application,jar with the following code:
jar cvf Application.jar 1.class 2.class�. commons-net-1.4.1.jar jakarta-oro-2.0.8.jar
But with the same result / Exception (I have signed the Jar file!)
Can anyone help meHi i have a question with your application can you down- or upload more files at the same time? Because i'm having problems with my ftp application.
Here is the link with my problem maybe you can help me. I will be very pleased when you can help me.
http://forum.java.sun.com/thread.jspa?threadID=5162042&tstart=0
Thx
Satanduvel -
How to Handle Too Many js Files?
I making a website and i want to know how to handle too many js in one page.
And i want to add news ticker but js is conflict with someone
<script src="js/ticker/1.8.jquery.min.js"></script>
<script src="js/ticker/all.js"></script>
<script src="js/ticker/jquery.li-scroller.1.0.js"></script>
<script src="js/jquery.slicknav.js"></script>
<script type="text/javascript" src="js/modernizr.custom.js"></script>
<script type='text/javascript' src='js/scrollIt.min.js'></script>
<script type="text/javascript" src="js/jquery.simple-text-rotator.js"></script>
<script type="text/javascript" src="js/jquery.nicescroll.min.js"></script>
<script type="text/javascript" src="js/jquery.appear.js"></script>
<script type="text/javascript" src="js/jquery.bxslider.min.js"></script>
<script type="text/javascript" src="js/jquery.fitvids.js"></script>
<script type="text/javascript" src="js/owl.carousel.min.js"></script>
<script type="text/javascript" src="js/jquery.colorbox.js"></script>
<script type="text/javascript" src="js/jquery.parallax-1.1.3.js"></script>
<script type="text/javascript" src="js/jquery.localscroll-1.2.7-min.js"></script>
<script type="text/javascript" src="js/jquery.scrollTo-1.4.2-min.js"></script>
<script type="text/javascript" src="js/classie.js"></script>
<script type="text/javascript" src="js/cbpAnimatedHeader.min.js"></script>
<script type="text/javascript" src="js/template.js"></script>I trying ti use your code but that's not working,
i want to add one news ticker but that's not work
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
<script type="text/javascript" src="js/jquery.js"></script>
<script type='text/javascript' src='js/scrollIt.min.js'></script>
<script type="text/javascript" src="js/jquery.simple-text-rotator.js"></script>
<script type="text/javascript" src="js/jquery.nicescroll.min.js"></script>
<script type="text/javascript" src="js/jquery.appear.js"></script>
<script type="text/javascript" src="js/jquery.fitvids.js"></script>
<script type="text/javascript" src="js/owl.carousel.min.js"></script>
<script type="text/javascript" src="js/template.js"></script>
Maybe you are looking for
-
We run a software designed to work with Microsoft's ClickOnce technology. I used the add-on FFClickOnce 0.8 with the older version of Firefox but it is not compatible with 5.0.1. Now I am back to IE :(. Is there a new add-on like this to use with the
-
A friend sent a springtime job to my printer but it was not on at the time. When I turned it on it did not print but came up with failed when checked the site. Can it be printed through the site or do I have to get them to send it again. This questi
-
Firefox opens maximized at random on Mac
Hello, I'm using FF 30.0 on OS X 10.9.3. I don't like having my FF fill entire screen (maximized) so I dragged the window to a specific size I like. The problem is, once in a while, FF will not respect the last window size it was set to and open maxi
-
I would like to change my user email address to a different email? I am currently subscribed with [email protected] but would like to change it to [email protected]
-
Artist does not exist in library, but appears in Autocomplete--how to fix?
I had an artist name appearing in all caps in my library. I went through and found every instance of her name in the library, and carefully pasted the proper capitalization. Her name in caps no longer exits in my library at all--yet when I try to fil