Strange behaviour: "undefined method" error

Hello!
I am trying to build a simple webpage.
I created a class UserData with some functions, two of them are getUsername and getLastname. I created a HTML form, with the fields username and lastname (written exactly like this), a JSP (signup2.jsp) with the following code:
<jsp:useBean id="user" class="phil.UserData" scope="session"/>
<jsp:setProperty name="user" property="*"/>
<jsp:forward page="signup3.jsp"/>and another JSP (signup3.jsp) with the following code:
<jsp:useBean id="user" class="phil.UserData" scope="session"/>
Lastname:
<%=user.getLastname()%>Ok. My problem is: when i submit the form, the signup3.jsp raise me a strange error:
"The method getLastname() is undefined for the type UserData". If I replace <%=user.getLastname()%> with <%=user.getUsername()%> ... well... it works!! It shows me the username I submitted.
So basically, my script "sees" a function within a class, but it raises an error when trying to call another function in the same class.
The listing of this "famous" class is:
package phil;
public class UserData {
    public String username;
    public String firstname;
    public void setUsername(String value){
         username = value;
    public void setFirstname(String value){
         firstname = value;
    public String getUsername() {
         return username;
    public String getFirstname() {
         return firstname;
}Anyone has any idea what this error is? I was clear enough? I don't even know how to explain it better....
I am using Windows XP, Apache with Tomcat 5.5.0, JRE 1.5.0u4 and JDK J2SE 1.5.0u4
Thanks!

"The method getLastname() is undefined for the type UserData"
If I replace <%=user.getLastname()%> with <%=user.getUsername()%> it worksOk, In your class I can see methods
public String getUsername() {
public String getFirstname() { I don't see any method
public String getLastname() { Add that method to your UserData class and try again.

Similar Messages

  • Undefined method error in custom package even with proper import

    I edited the title of this thread to be a little more descriptive about the help I need.
    The background: I have a multi-file Flash application that allows users to navigate through multiple pages (similar to a website). I realized yesterday that with each mouse click, I'm loading a page into memory, but not unloading it. After navigating through several pages, my memory really starts to take a hit. So, I want to define a custom package that loads each page and unloads the previous page.
    I've gotten as far as defining the pageLoad function, but I keep getting an error that doesn't make sense to me (unless I'm importing the wrong flash packages).
    When I test the Flash, I consistently get the following error:
    dtutils.as – 1180: Call to a possibly undefined method addChild. – addChild(pageLoader);
    Everything I have found indicates that to import the addChild method, I need to import flash.display.Sprite, which I'm doing, but I am still getting the error.
    You'll have to forgive me as I'm not extremely familiar with objects or actionscript. I'm more of a hacker, but I grasp things quickly and can build on what I've already learned. This might be obvious to others, but I can't find anything that indicates that I'm doing anything wrong with my code, so any help you can give is greatly appreciated!!
    My package code:
    package com.clientname.demo
        import flash.display.Sprite;
        import flash.display.Loader;
        import flash.events.MouseEvent;
        import flash.net.URLRequest;
        public class dtutils
            //Properties
            public var pageLoader:Loader = new Loader();
            public var pagePath:URLRequest;
            //Constructor
            public function loadPage(url:String)
                pagePath = new URLRequest(url);
                pageLoader.load(pagePath);
                addChild(pageLoader);
    I've also attempted to replace the four import lines in my package with the following 3 import lines, but I still get the same error message:
    import flash.display.*;
    import flash.events.*;
    import flash.net.*;
    The code I'm using to import my package and call the function in my flash file is:
    import com.clientname.demo.dtutils;
    dtutils.loadPage("../filepath/filename.swf");
    I appreciate any help anyone can give me.

    Thanks for the feedback. Being fairly new with actionscript (and an object approach, in general), and not being a real developer, I often struggle with naming conventions. Didn't even realize there was a specific convention for what is considered a utility and what isn't. However, I appreciate your feedback and will rename my package so that it isn't confusing to any other real developers that may need to do something with this code in the future.
    Thanks!

  • 1180: Call to a possibly undefined method error for DEFINED method

    Hi,
    I have Document Class  main.Core  that in package main
    In the first frame of the .fla I have:
    stop();
    startGame();
    public function startGame():void {
           world = new World();
            world.startWorld();
    World is class in package world.
    I use import world.World;
    When I am tryng to export I get the error:
    1180: Call to a possibly undefined method startWorld.
    Can someone tell me why?
    Thanks.

    what's the following show:
    package world {
    import flash.display.MovieClip;
         public class World extends MovieClip {
              public function World():void {
    trace(this);         
              public function startWorld():void {
                   trace("b");

  • Using Click Functions Inside ItemRenderers Causing "Undefined Method" error

    I have a tilelist which has an item renderer and the item renderer has a small button in it which intentionally should remove the specific item once the button is clicked making each item removable from the tilelist by clicking the little button on each item within the tilelist. However when I try to apply my removeProduct() function, which I've already defined, to the button I get the error "Call to a possibly undefined method" but this function can be applied to other buttons fine so I know it has been defined correctly. It just seems to throw this error when I try to apply it to the button inside the itemrenderer of my tilelist. Anyone else had this problem? Is it to do with it being within a item renderer?
    Here's my code for the function:-
    public function removeProduct():void { 
    var item:Object = cartTilelist.selectedItem; 
    var idx:int = shoppingCartAC.getItemIndex(item);shoppingCartAC.removeItemAt(idx);

    forst create custom Event:
    public class MyItemEvent extends Event
            public static const MY_ITEM_REMOVE:String = "MyItemEventRemove";
            private var _myItemClicked:Object;
            public function get myItem() : Object{
                return this._myItemClicked;
            public function MyItemEvent(type:String,itemParam:Object, bubbles:Boolean=true, cancelable:Boolean=false)
                super(type, bubbles, cancelable);
                this._myItemClicked = itemParam;
            override public function clone():Event{
                return new MyItemEvent(this.type,this._myItemClicked,this.bubbles,this.cancelable); // bubbling support inside
    inside you Item renderer create util function (you dont have to, but its cleaner) :
    private function removeItem() : void {
                    this.dispatchEvent(new MyItemEvent (MyItemEvent .MY_ITEM_REMOVE,this.data,true,true));
    and then third step (again inside Item renderer)  asign that function as click event handler to button:
    <mx:LinkButton id="removeButton" label="X" fontSize="8"  paddingLeft="0" paddingRight="0" paddingTop="0" paddingBottom="0" cornerRadius="6" color="#FF0000" click="removeItem()"  x="1" y="-2"/>
    now wherever you have your  tilelist add listiner to it following way , (or any other way you find it fit )
    yourTileListComponent.addEventListener(MyItemEvent .MY_ITEM_REMOVE,
                         function(e:MyItemEvent):void
                            trace(this + "ItemTo Remove is: " + e.myItem);

  • Strange behaviour backingContext methods

    Hi,
    we are facing this (strange) problem
    In the method preRender() of a portlet backing file we try to get the pageLabel of a page of which we know the title.
    The page is inside a book, son of the mainpagebook.
    We first get the desktopBackingContext, then we get the mainPageBook backing context and then we iterate on its children.
    The strange thing is that sometimes the iteration doesn't occour because the list of children returned by getPages() is empty.
    We saw that getPages() is deprecated, and then we used getPageBackingContexts().
    It didn't succeed,and furthermore we noticed that getPageBackingContexts() sometimes returns even less children than getPages().
    Can anyone help us?
    Peraphs this information may help: the calling portlet is placed inside the header (of the shell).
    Thanks in advance for any hints

    That's what I thought, and I tried duplicating the first line of the showFields method, hoping to replicate the error while I navigate through Next button that calls showFileds.
    private void showFields(){
    // displays data from ResultSet rs in the text fields
    try{
    jTextFieldCustNo.setText(Integer.toString(rs.getInt(1)));
    jTextFieldCustNo.setText(Integer.toString(rs.getInt(1)));
    jTextFieldCustName.setText(rs.getString(2));
    No error in that case.
    Moreover, I then commented out the calls to getString(2) and so on, hoping that I can et an error out of reading the current record only partially - again no error.

  • Question about undefined method error

    method in CalculatorMethods.java
    public static Date setStartDate(int leaveYr,String feb,String apr,String may)throws java.text.ParseException
    return startDate;
    }     advancedOptions.jsp
    startDate = CalculatorMethods.setStartDate(leaveYr,startMonthFeb,startMonthApr,startMonthMay);now i get this error
    org.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: 38 in the jsp file: /al/jsp/advancedOptions.jsp
    Generated servlet error:
    The method setStartDate(int, String, String, String) is undefined for the type CalculatorMethods
    An error occurred at line: 38 in the jsp file: /al/jsp/advancedOptions.jsp
    Generated servlet error:
    The method setEndDate(int, String, String, String) is undefined for the type CalculatorMethods
         org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
         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)

    ok, im an idiot, but i suspected that anyway,
    eclispe wasent highlighting the Message class name, which i hadnt imported, therefore the method was not being reconised!
    Sorry :)
    Edited by: Sir_Dori on Nov 4, 2009 1:55 PM

  • "call to a possibly undefined method" error.

    I've been working my way through the tutorials in Gary Rosenzweig's "Flash Game University" book. Working on the "paddle ball" game tutorial, I changed the name of the file from "PaddleBall.fla" to "MyPaddleBall.fla", and changed the name of the .as file and the class definition accordingly. After I do this, I get the above error when calling the initialization function ("startPaddleBall()") The target for the .as file is set correctly. I tried using the original file to test it; it compiles fine as long as it's called "PaddleBall", but as soon as I change the name to "MyPaddleBall" (or anything else), it breaks. I commented out all the other code and replaced it with a trace statement inside the startPaddleBall() function to see if there was something else causing the problem, but I got the same result. When all the other functionality is stripped out, the file still works, but only when called "PaddleBall".
    Any help would be appreciated, thanks.
    -- Mark

    Thanks, in fact I did that. It's also one reason why I commented / stripped out all the other code.
    Here is the code in the .as file as it stands right now in its entirety:
    package {
    import flash.display.*;
    import flash.events.*;
    public class PaddleBall extends MovieClip {
    public function startMyPaddleBall() {
    trace("Started");
    This code, combined with the file PaddleBall.fla (containing the function call "startMyPaddleBall()") works. When I change it to "public class MyPaddleBall" and also change the names of the .fla and .as files to MyPaddleBall, it breaks.

  • Strange behaviour in ORacle Forms Webutil 106 / Error message WUC-14 WUC-12

    This is to inform you about a strange behaviour in Webutil V1.0.6
    Hosting environment is Oracle Application Server 10.1.2.0.2 on Unix Solaris 10
    Oracle Server 10.2.0.4.0 Enterprise Edition
    Client-envionment : Windows 2000, IE 6
    I created an Forms based application which reads in certain text files into the database using
    Webutil. The data will get changed using the application with logic and lateron a different textfile
    will be transmitted using either ftp or it may be created on the client side (again with Webutil).
    This solution worked perfect for some time (a year or so) using CLIENT_TEXT_IO...
    Hoewever, during the week, I recognized users coming up with the statement that the download
    to the local client does not worked anymore in certain situations. The system is producing an error-msg
    on the Form in the following sequence :
    WUC-14 [getFromObjectCache] ...
    WUC-14 [getFromObjectCache] ...
    WUC-12 [FileFunctions.newLine()] ...
    I traced the session and traced WebUtil, was able to reproduce the problem but could not find out the source
    of it in the first place.
    Hoewever, it came out, that part of the file being created on the client is a "¿" sign : hex :$BF
    This was already part of the file being read in the first place, so the value is stored in the database.
    There is no problem when reading a file having a content like this with CLIENT_TEXT_IO but there obviously is one
    when writing it to the local client.
    The file is getting processed on the client and gets closed with CLIENT_TEXT_IO.FCLOSE.
    After the FCLOSE statement is getting processed, the above errors occurs, The length of the produced file is then : 0 bytes ^^
    Whenever facing a problem like this check the content of the file you are trying to create.
    Workaround was :
    - set workingDirectory in formsweb.cfg
    - using Forms based TEXT_IO rather than CLIENT_TEXT_IO to create the file on the backend side (Apps-server)
    - implement WEBUTIL_FILE_TRANSFER.AS_To_Client_With_Progress to download the file to the client
    In order to make it a little bit "colourful" I implemented a bean with progressbar when creating the file on the back end side
    Works perfect... and looks nice :)

    XeM wrote:
    Hi Andreas,
    install.syslib.location.client.0=webutil\syslibi found the above line over google but when i check my webutility configuration file i didn't found it there. I added this line after the line i have mentioned in previous post but this also not worked. And then i worked on changing permission over folder.
    HI XeM
    Your adding location is ok. But i suggest try something different. Change the above line to
    /* i'm confuse with the \ or / *\
    install.syslib.location.client.0=\webutil
    or
    install.syslib.location.client.0=/webutilAnd do the following work In the client
    1. Close ALL open browsers.
    2. On the client machine search all directories for webutil.*properties and delete all instances of that file.
    3. Delete d2kwut60.dll, JNIsharedstubs.dll, and jacob.dll from the JRE\bin directory.
    4. Clear the JRE jar cache. This can be done several ways, but using the Java Control Panel is likely the easiest and safest.
    Now stop the OC4J instance and start again and try at client...
    Hope this works...
    If works... please post the solutions.
    Hamid

  • Image + 1180 error + possibly undefined method

    Below is a piece of code I've written and getting an "1180: Call to possibly undefined method test".
    <mx:Script>
    <![CDATA[
    public function testDC(): void {
        Alert.show("Testing");
    ]]>
    </mx:Script>
    <mx:Panel id='Test' title = 'Test' width = '100%' height = '100%' creationPolicy="all" backgroundColor="white" backgroundAlpha=".01">
    <mx:VBox label = 'Topology View' showEffect = '{wipe_left}' width='100%' height='100%'
    cornerRadius="5" paddingBottom="15" paddingLeft="5" paddingRight="5" paddingTop="15" clipContent="true">
                <adobe:SpringGraph id="springgraph" width="100%" height="95%" bottom="0" top="40"
                right="0" left="0" clipContent="true">
                <adobe:itemRenderer>
                <mx:Component>
                <mx:Image width="24" height="24"
                                    source="{(data.id==null)?'': (data.id.search('\\.') > 0) ? 'assets/icons/teacher.png' : 'assets/icons/student.png'}"
                                    toolTip="{data.data}" doubleClickEnabled="true" doubleClick="testDC()"/>
                </mx:Component>
                </adobe:itemRenderer>
    </adobe:SpringGraph>
    </mx:VBox>
    </mx:Panel>
    If I do not call the method, I don't get the error, but I need to perform some operations on the clicking the image.
    1. I've also tried to use icon, but with no success.
    2. I've tried to remove the <adobe:itemRenderer> and the <mx:Component> tags, in this case the images don't get loaded and the screen looks bad.
    Any help?

    I put the script tag within the image tag and it worked.

  • Error 1180: Call to a possibly undefined method class_name

    hi,
    i am new AS 3.0. When i try to compile my file it show the following error.
    1180: Call to a possibly undefined method ClassA.                                 var obj =new ClassA(10,10);
    My class file contains...
    class ClassA {
        public var Avg:Number = 0;
        public function ClassA(a, b) {
            Addit(a,b);
        public function Addit(aval:Number, bval:Number):Number {
            Avg = aval+bval;
            trace("Average - "+Avg);
            return Avg;
    i have called in flash file....
    import ClassA;
    var obj =new ClassA(10,10);
    Any help Pls....
    Ayathas

    i have modified my AS file as
    package TestPackage{
        import flash.display.Sprite;
    public class ClassA extends Sprite {
        public var Avg:Number = 0;
        public function ClassA(a, b) {
            Addit(a,b);
        public function Addit(aval:Number, bval:Number):Number {
            Avg = aval+bval;
            trace("Average - "+Avg);
            return Avg;
    i have included the document path in the properties panel as, TestPackage.ClassA
    now it show's following error message....
    ArgumentError: Error #1063: Argument count mismatch on AS::ClassA$iinit(). Expected 2, got 0.
    When i modifiy ClassA construnctor as follows, it works fine.
      public function ClassA() {
            var a = 10;
            var b = 10;
            Addit(a,b);
    how can i get input values from the user..........
    Thanks in Advance,
    Ayathas
    Message was edited by: ayathas

  • Fatal error: Call to undefined method tNG_fields::tNG_fields() in C:

    Hi
    I've just installed Xampp 1.7.2 locally with PHP Version 5.3.0 and Apache 2.2.12 on a Windows platform
    and I now I'm really in a big trouble !!!
    My home pages wich have a Login forms do not work anymore !!! They give me back this error:
    Fatal error: Call to undefined method tNG_fields::tNG_fields() in C:\xampp\htdocs\MySite\includes\tng\tNG_custom.class.php on line 30
    I think it's probably the new PHP version 5.3.0 and I'm really worried because I have many sites around made with ADD and if the servers will be as probably be updated to the new PHP version all my sites will stop working !!!
    What can I do? I'm really desperated and fell abandoned....PLEASE HELP !!!
    Monikka

    Yes, it almost surely is version 5.3.0 of PHP.  Any version below will work with ADDT,with 5.3.0, ADDT breaks.
    The only real solution is to not use 5.3.0 and use a less recent version.  With Xamp, the package is bundled, PHP and MySQL. I  had this exact same issue and someone, I think Gunter, suggested moving to WAMP which allows you to run different versions of PHP and MySQL as you desire.  This worked.
    The most disturbing thing for me was the "writing on the wall"...the ADDT life clock is ticking.  Remaining on CS4 and PHP 5.2 extends the useful life - but at some point, we will be forced by something to upgrade (like our ISP), then big problems.
    Jim

  • Error 1180 : undefined method stop and gotoAndStop

    Error 1180 : undefined method stop and gotoAndStop
    i don't know why
    Here ,, it's my code is file [.as] and i use as3
    package {
              import flash.display.*;
              import flash.events.*;
              import flash.text.*;
              import flash.utils.Timer;
              import flash.media.Sound;
        import flash.media.SoundChannel;
              import flash.net.URLRequest;
              public class MemoryGame extends Sprite {
                        static const numLights:uint = 5;
                        private var lights:Array; // list of light objects
                        private var playOrder:Array; // growing sequence
                        private var repeatOrder:Array;
                        // timers
                        private var lightTimer:Timer;
                        private var offTimer:Timer;
                        var gameMode:String; // play or replay
                        var currentSelection:MovieClip = null;
                        var soundList:Array = new Array(); // hold sounds
                        public function MemoryGame() {
                                  //soundBG.load(new URLRequest("soundBG.mp3"));
                                  //soundBG.addEventListener(Event.COMPLETE,loadSoungBgComplete);
                                  stop();
                                  StartBtn.addEventListener(MouseEvent.CLICK, clickStart);
                                  function clickStart(e:MouseEvent){
                                            gotoAndStop("startPage");
                                  // load the sounds
                                  soundList = new Array();
                                  for(var i:uint=1;i<=5;i++) {
                                            var thisSound:Sound = new Sound();
                                            var req:URLRequest = new URLRequest("note"+i+".mp3");
                                            thisSound.load(req);
                                            soundList.push(thisSound);
                                  // make lights
                                  lights = new Array();
                                  for(i=0;i<numLights;i++) {
                                            var thisLight:Light = new Light();
                                            thisLight.lightColors.gotoAndStop(i+1); // show proper frame
                                            thisLight.x = i*90+100; // position
                                            thisLight.y = 175;
                                            thisLight.lightNum = i; // remember light number
                                            lights.push(thisLight); // add to array of lights
                                            addChild(thisLight); // add to screen
                                            thisLight.addEventListener(MouseEvent.CLICK,clickLight); // listen for clicks
                                            thisLight.buttonMode = true;
                                  // reset sequence, do first turn
                                  playOrder = new Array();
                                  gameMode = "play";
                                  nextTurn();
                        // add one to the sequence and start
                        public function nextTurn() {
                                  // add new light to sequence
                                  var r:uint = Math.floor(Math.random()*numLights);
                                  playOrder.push(r);
                                  // show text
                                  textMessage.text = "Watch and Listen.";
                                  textScore.text = "Sequence Length: "+playOrder.length;
                                  // set up timers to show sequence
                                  lightTimer = new Timer(1000,playOrder.length+1);
                                  lightTimer.addEventListener(TimerEvent.TIMER,lightSequence);
                                  // start timer
                                  lightTimer.start();
                        // play next in sequence
                        public function lightSequence(event:TimerEvent) {
                                  // where are we in the sequence
                                  var playStep:uint = event.currentTarget.currentCount-1;
                                  if (playStep < playOrder.length) { // not last time
                                            lightOn(playOrder[playStep]);
                                  } else { // sequence over
                                            startPlayerRepeat();
                        // start player repetion
                        public function startPlayerRepeat() {
                                  currentSelection = null;
                                  textMessage.text = "Repeat.";
                                  gameMode = "replay";
                                  repeatOrder = playOrder.concat();
                        // turn on light and set timer to turn it off
                        public function lightOn(newLight) {
                                  soundList[newLight].play(); // play sound
                                  currentSelection = lights[newLight];
                                  currentSelection.gotoAndStop(2); // turn on light
                                  offTimer = new Timer(500,1); // remember to turn it off
                                  offTimer.addEventListener(TimerEvent.TIMER_COMPLETE,lightOff);
                                  offTimer.start();
                        // turn off light if it is still on
                        public function lightOff(event:TimerEvent) {
                                  if (currentSelection != null) {
                                            currentSelection.gotoAndStop(1);
                                            currentSelection = null;
                                            offTimer.stop();
                        // receive mouse clicks on lights
                        public function clickLight(event:MouseEvent) {
                                  // prevent mouse clicks while showing sequence
                                  if (gameMode != "replay") return;
                                  // turn off light if it hasn't gone off by itself
                                  lightOff(null);
                                  // correct match
                                  if (event.currentTarget.lightNum == repeatOrder.shift()) {
                                            lightOn(event.currentTarget.lightNum);
                                            // check to see if sequence is over
                                            if (repeatOrder.length == 0) {
                                                      nextTurn();
                                  // got it wrong
                                  } else {
                                            textMessage.text = "Game Over!";
                                            gameMode = "gameover";
    and i don't push any code
    at fla file
    why i got that help me plss
    that is my homework and i must send it today TT

    can you write how to use ?
    i write
    "import the flash.display.MovieClip; "
    still error ahhh
    i try to change extends MovieClip instead Spirt
    and not error stop(); and gotoAndStop Already
    but
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
              at MemoryGame/nextTurn()
              at MemoryGame/clickStart()
    i got thissssssss TT
    import flash.display.Sprite;
    import flash.events.*;
    import flash.text.*;
    import flash.utils.Timer;
    import flash.media.Sound;
    import flash.media.SoundChannel;
    import flash.net.URLRequest;
    import flash.display.MovieClip;
    that i import

  • Invalid character 0 ... error in xmlparsing??? strange behaviour

    Hello Everyone,
    I am experience a strange behaviour with XML processing in oracle. I have a xml that contains HTML as CDATA
    as the content of a node.
    When the HTML size is greater than 51 KB (or 51. something KB i was not able to find the exact boundary)
    it's giving an error.
    XML Parsing Failer
    LPX-00216: invalid character 0 (0x0)
    I tried to search for null character (chr(0)) but couldn't find one.
    The strangest part is when i am trying with HTML size as 48 KB/24 KB (anyting less than 51 KB) it's getting passed and
    the large HTML ( > 52KB ) is being build manually by copy pasting the small xml again and again. So if the small HTML
    is getting parsed what's wrong with the large html which consist of nothing but the small html again and again?
    When the HTML size is greater than 64KB oracle is throwing error saying node size cannot exceed 64KB which is fine.
    First i thought that it was a character set encoding problem. The HTML is encoded in UTF-8 and the database is in
    WE8MSWIN1252, but it seems that it is not the problem as i have explained above?
    Can anyone help me what am i missing in here?
    Thanks,
    Ru

    What database version are you on?
    Can you provide us an example of XML you are using?
    Can you show us the code you are using to parse it?
    Can you tell us what you are expecting as output?
    Based on your current description all we know is you have some XML and you're getting an error when you parse it. By itself that's pretty meaningless.

  • Strange behaviour on text insert into a HTML pane

    Hi all,
    I am trying to fix a problem on inserting a span tag into an existing html page (in an EDITABLE JEditorPane).
    The behaviour:
    Assuming the cells in a table (3 rows, 2 columns) are numbered from 1 to 6, with cell one being the top left most, cell 2 top right, cell 3 middle left, etc.
    1. Inserting the text "<span></span>" in cell 4 causes during any attempt to later type into cell 5 the characters to be appended instead into cell 4, directly after the close span tag.
    2. The insertion in the first place behaves strange. If I have the caret positioned for cell 5 so that I can insert there
    (via the function void javax.swing.text.html.HTMLEditorKit.insertHTML(HTML Document doc, int offset, String html, int popDepth, int pushDepth, Tag insertTag) )
    even though the caret position is visible in cell 5, the insertion seems to take place in cell 4.
    I can sort of compensate for this by adding 1 to the offset. However, then when inserting into a line of text, for example, "the quick red fox jumped over the lazy dog"
    I insert directly before the 'j' in 'jumped', the insertion looks like this "the quick red fox j<span>..</span>umped over the lazy dog"
    So that is no solution.
    IMPORTANT! Just to prove it is not the span tag causing the trouble, if this span tag already exists in a cell on 'Load' of the html file, the strange behaviour is not observed.
    Something is going wrong here. It is me? Or is it a bug?
    Please help!!
    Here is a test app, and the test html you can use (place in current directory).
    Please test like this:
    1. run application (the html should be loaded into the pane)
    2. the span tag is programmed to automatically insert at cell 4 (by using the +1 method on the insert)
    3. another span tag was already existing in the html file, at cell 8
    4. Attempt to type into cell 5
    result: the text appears instead at cell 4
    5. Type into cell 9
    result: the text correctly is entered into cell 9
    See the difference!!
    Help!
    The test java app:
    package small.test;
    import java.awt.BorderLayout;
    import java.awt.Container;
    import java.io.File;
    import java.io.FileReader;
    import java.io.IOException;
    import java.io.StringReader;
    import javax.swing.JEditorPane;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.SwingUtilities;
    import javax.swing.text.JTextComponent;
    import javax.swing.text.html.HTML;
    import javax.swing.text.html.HTMLDocument;
    import javax.swing.text.html.HTMLEditorKit;
    import javax.swing.text.html.parser.ParserDelegator;
    public class HtmlInsertTest extends JEditorPane
         public HtmlInsertTest()
         public static void main(String args[])
              JFrame frame = new JFrame("Loading/Saving Example");
              Container content = frame.getContentPane();
              frame.setSize(600, 600);
              final HtmlInsertTest editorPane = new HtmlInsertTest();
              editorPane.setEditable(true);
              JScrollPane scrollPane = new JScrollPane(editorPane);
              content.add(scrollPane, BorderLayout.CENTER);
              editorPane.setEditorKit(new HTMLEditorKit());
              JPanel panel = new JPanel();
              content.add(panel, BorderLayout.SOUTH);
              frame.setSize(600, 600);
              doLoadCommand(editorPane);
              editorPane.insertHTML("<span>inserted text</span>", 84);
              frame.setVisible(true);
         public static String getHTML()
              return
              "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">"+
              "<HTML>"+     "<HEAD>"+
              "     <META HTTP-EQUIV=\"CONTENT-TYPE\" CONTENT=\"text/html; charset=utf-8\">"+
              "     <TITLE></TITLE>"+          
              "</HEAD>"+
              "<BODY LANG=\"en-AU\" DIR=\"LTR\">"+
              "<P STYLE=\"margin-bottom: 0cm\">This is a test xhtml document. "+
         "     </P>"+
         "     <P STYLE=\"margin-bottom: 0cm\">"+
         "     </P>"+
         "     <P STYLE=\"margin-bottom: 0cm\">Here is a table:</P>"+
         "     <P STYLE=\"margin-bottom: 0cm\">"+
         "     </P>"+
         "     <p></p>"+
               "     <TABLE WIDTH=100% BORDER=1 BORDERCOLOR=\"#000000\" CELLPADDING=4 CELLSPACING=0>"+
         "          <TR VALIGN=TOP>"+
         "               <TD WIDTH=50%>"+
         "                    <P>It has</P>"+
         "               </TD>"+
         "               <TD WIDTH=50%>"+
         "                    <P>2 columns</P>"+
         "               </TD>"+
         "          </TR>"+
         "          <TR VALIGN=TOP>"+
         "               <TD WIDTH=50%><P>And 4 rows</P></TD>"+
         "               <TD WIDTH=50%><P></P></TD>"+
         "          </TR>"+
         "          <TR VALIGN=TOP>"+
         "               <TD WIDTH=50%><P></P></TD>"+
         "               <TD WIDTH=50%><P></P></TD>"+
         "          </TR>"+
         "          <TR VALIGN=TOP>"+
         "               <TD WIDTH=50%><P></P></TD>"+
         "               <TD WIDTH=50%><P><span>existing text</span></P></TD>"+
         "          </TR>"+
         "          <TR VALIGN=TOP>"+
         "               <TD WIDTH=50%><P></P></TD>"+
         "               <TD WIDTH=50%><P></P></TD>"+
         "          </TR>"+
         "     </TABLE>"+
         "     <P STYLE=\"margin-bottom: 0cm\">"+
         "     </P>"+
         "     <P STYLE=\"margin-bottom: 0cm\">"+
         "     </P>"+
         "     <P STYLE=\"margin-bottom: 0cm\">"+
         "     </P>"+
         "     <P STYLE=\"margin-bottom: 0cm\">We will test the drag and drop"+
         "     functionality with this document. "+
         "     </P>"+
         "     <P STYLE=\"margin-bottom: 0cm\">It will be loaded with the hlml editor.</P>"+
         "     <P STYLE=\"margin-bottom: 0cm\">"+
         "     </P>"+
         "     <P STYLE=\"margin-bottom: 0cm\">"+
         "     </P>"+
         "     </BODY>"+
         "     </HTML>";
         public static void doLoadCommand(JTextComponent textComponent)
              StringReader reader = null;
              try
                   System.out.println("Loading");
                   reader = new StringReader(getHTML());
                   // Create empty HTMLDocument to read into
                   HTMLEditorKit htmlKit = new HTMLEditorKit();
                   HTMLDocument htmlDoc = (HTMLDocument)htmlKit.createDefaultDocument();
                   // Create parser (javax.swing.text.html.parser.ParserDelegator)
                   HTMLEditorKit.Parser parser = new ParserDelegator();
                   // Get parser callback from document
                   HTMLEditorKit.ParserCallback callback = htmlDoc.getReader(0);
                   // Load it (true means to ignore character set)
                   parser.parse(reader, callback, true);
                   // Replace document
                   textComponent.setDocument(htmlDoc);
                   System.out.println("Loaded");
              catch (Exception exception)
                   System.out.println("Load oops");
                   exception.printStackTrace();
              finally
                   if (reader != null)
                        reader.close();
         public void insertHTML(String text, int offset)
              SwingUtilities.invokeLater(new insertAction(this, text, offset));
         class insertAction implements Runnable
              String text = "";
              int offset = 0;
              JEditorPane jEditorPane1 = null;
              public insertAction(JEditorPane _jEditorPane1, String _text, int _offset)
                   jEditorPane1 = _jEditorPane1;
                   text = _text;
                   offset = _offset;
              @Override
              public void run()
                   HTMLDocument doc = (HTMLDocument)jEditorPane1.getDocument();
                   HTMLEditorKit kit = (HTMLEditorKit)jEditorPane1.getEditorKit();
                   try
                        System.out.println("reading from string reader");
                        kit.insertHTML(     doc,
                                          offset,//+1
                                          text,
                                          0,//0
                                          0,//0
                                          HTML.Tag.SPAN);
                        System.out.println(jEditorPane1.getText());
                   catch (Exception e)
                        System.out.println("error inserting html: " + e);
    }Edited by: svaens on Jul 16, 2009 6:34 PM
    fix another stuffed up attempt at a SSCCE.

    Well, I know nothing about HTML in JEditorPanes. I have never been able to figure out how insertions work.
    My comment was a warning to others. Some people (like me) avoid answering posting of this type for reasons given in the JavaRanch link. Others will answer anyway. Other might first check the other site to see if they are wasting there time, but they can only do that if a link was posted with the original question.
    The only suggestion I have is to repost the question, (since this posting is now completely off topic) making sure to then respond to this posting stating that a fresh question has been asked so you don't get a discussion going on in two places.

  • Strange behaviour BOXI R2

    Post Author: Ermakov Alexey
    CA Forum: .NET
    using System;using System.Data;using System.Configuration;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.HtmlControls;using System.Web.UI.WebControls;using CrystalDecisions.Enterprise;using BusinessObjects.ReportEngine;using BusinessObjects.Enterprise.Desktop;using System.IO;using System.Runtime.InteropServices;using System.Collections;namespace BusinessObjectsInteroperation{     public class BusinessObjectsInterop     {          public void GetBinaryReportByName(string NameOfTheReport, Stream StreamForDataBeWritten, BOConfigs BOCfg, OutputFormatType OutputFormat, Hashtable PromptValues)          {               EnterpriseSession enterpriseSession = null;               ReportEngines reportEngines = null;               SessionMgr sessionMgr = new SessionMgr();               try               {                    enterpriseSession = sessionMgr.Logon(BOCfg.BO_LoginName, BOCfg.BO_Password, BOCfg.BO_MachineToConnect, BOCfg.BO_LoginType);               }               catch (COMException exc)               {                    int HRESULT = exc.ErrorCode;                    switch (HRESULT)                    {                         case -2147210751:                              throw new ArgumentException(" BO_MachineToConnect");                         case -2147211005:                              throw new ArgumentException(" BO_LoginName");                         case -2147211006:                              throw new ArgumentException(" BO_Password");                         case -2147210653:                              throw new ArgumentException(" BO_LoginType");                         default:                              throw new ArgumentException("");                    }               }               InfoStore iStore = (InfoStore)enterpriseSession.GetService("InfoStore");               UserInfo userInfo = enterpriseSession.UserInfo;               if (enterpriseSession != null)               {                    if (reportEngines == null)                    {                         int iMinuteNumber = 1;                         int iLogonNumber = 1;                          string strToken = enterpriseSession.LogonTokenMgr.CreateWCAToken("", iMinuteNumber, iLogonNumber);                         reportEngines =  new ReportEngines(strToken);                    }               }                              IReportEngine reportEngine = reportEngines.getService(ReportEngineType.FC_ReportEngine);               FullClient ReportToPrint = (FullClient)getReport(iStore, NameOfTheReport, CrystalDecisions.Enterprise.InfoStore.CeKind.FullClient);               IDocumentInstance doc = null;               try               {                    doc = reportEngine.OpenDocument(ReportToPrint.ID); //ERROR Happens here               }               catch(Exception e)               {                    Console.Write(e.StackTrace);               }                              doc.Refresh();               IPrompts prompts = doc.GetPrompts();               foreach (IPrompt ip in prompts)               {                    string OnlyOneValue="";                    try                    {                         OnlyOneValue = (string)PromptValues&#91;ip.Name&#93;;                    }                    catch(IndexOutOfRangeException exc)                    {                         throw new ArgumentException(String.Format("Отчет {0} имеет необходимый параметр , который не был предоставлен.", NameOfTheReport, ip.Name), exc);                    }                    string&#91;&#93; vlArr = ; //Почему одному IPrompt надо передавать массив значений остается загадкой.                    ip.EnterValues(vlArr);               }               doc.SetPrompts();               IBinaryView docBinaryView = (IBinaryView)doc.GetView(OutputFormat);               docBinaryView.WriteContent(StreamForDataBeWritten);               doc.CloseDocument();                              reportEngine.Close();               reportEngines.Close();               iStore.Dispose();               enterpriseSession.Logoff();               enterpriseSession.Dispose();                                        }                    private InfoObject getReport(InfoStore iStore, string Name, string Kind)          {               InfoObjects list = null;               string query = String.Format(@"                SELECT                     SI_ID,                     SI_NAME,                          SI_PARENTID,                         SI_KIND,                          SI_INSTANCE,                          SI_DESCRIPTION                     FROM                         CI_INFOOBJECTS                     WHERE                          SI_KIND='{0}' AND                         SI_NAME=''", Kind, Name);                list = iStore.Query(query);               if (list.Count == 0)               {                    throw new Exception(String.Format("На сервере не существует отчета с именем {0}, его необходимо создать. Либо у вас нет на него прав.", Name));               }               if (list.Count > 1)               {                    throw new Exception(String.Format("На сервере существует более одного отчета с именем {0}, удалите неверный.", Name));               }               foreach (InfoObject obj in list)               {                    return obj;               }               return null;          }          public void ReportInPdfToHTTPResponse(string NameOfTheReport, params Par&#91;&#93; Prompts)          {               Hashtable PromptValues = new Hashtable();               foreach (Par p in Prompts)               {                    PromptValues.Add(p.Key, p.Value);               }               HttpResponse Response = HttpContext.Current.Response;               Response.Clear();               Response.ContentType = "application/pdf";               Response.AddHeader("Content-Type", "application/pdf");               Response.Expires = 0;               GetBinaryReportByName(NameOfTheReport, Response.OutputStream, new BOConfigs(), OutputFormatType.Pdf, PromptValues);               Response.Flush();               Response.End();          }          public void ReportInXlsToHTTPResponse(string NameOfTheReport, params Par&#91;&#93; Prompts)          {               Hashtable PromptValues = new Hashtable();               foreach (Par p in Prompts)               {                    PromptValues.Add(p.Key, p.Value);               }               HttpResponse Response = HttpContext.Current.Response;               Response.Clear();               Response.ContentType = "application/vnd.ms-excel";               Response.AddHeader( "Content-Type", "application/vnd.ms-excel");               Response.Expires = 0;               GetBinaryReportByName(NameOfTheReport, Response.OutputStream, new BOConfigs(), OutputFormatType.Xls, PromptValues);               Response.Flush();               Response.End();          }               }     } I have this code, but it has strange behaviour.When I restart IIS and run this function first time, I get an ArgumentOutOfRangeException in reportEngine.OpenDocument(ReportToPrint.ID);But the most strange thing is that Visual Studia shows me exception dialog and if I press Continue, then it works good.On more strange thing I get about this Code. From time to time server shows me such error:An unhandled exception of type 'BusinessObjects.ThirdParty.OOC.OB.AssertionFailed' occurred in businessobjects.enterprise.sdk.netmodule Additional information: ORBacus encountered an internal error

    Post Author: Ermakov Alexey
    CA Forum: .NET
         mscorlib.dll!System.String.LastIndexOf(char value, int startIndex) + 0x13 bytes           log4net.dll!log4net.Repository.Hierarchy.Hierarchy.UpdateParents(log4net.Repository.Hierarchy.Logger log = {log4net.Repository.Hierarchy.DefaultLoggerFactory.LoggerImpl}) + 0x1cf bytes           log4net.dll!log4net.Repository.Hierarchy.Hierarchy.GetLogger(string name = ".cctor", log4net.Repository.Hierarchy.ILoggerFactory factory = {log4net.Repository.Hierarchy.DefaultLoggerFactory}) + 0x12b bytes           log4net.dll!log4net.Repository.Hierarchy.Hierarchy.GetLogger(string name = ".cctor") + 0x46 bytes           log4net.dll!log4net.Core.LoggerManager.GetLogger(System.Reflection.Assembly repositoryAssembly = {System.Reflection.Assembly}, string name = ".cctor") + 0x94 bytes           log4net.dll!log4net.LogManager.GetLogger(System.Reflection.Assembly repositoryAssembly = {System.Reflection.Assembly}, string name = ".cctor") + 0x1b bytes           log4net.dll!log4net.LogManager.GetLogger(string name = ".cctor") + 0x1e bytes           businessobjects.enterprise.sdk.netmodule!BusinessObjects.Enterprise.Lib.Tracing.CELogger.CELogger(string name = ".cctor") + 0x20 bytes           businessobjects.enterprise.sdk.netmodule!BusinessObjects.Enterprise.Lib.Tracing.TraceManager.LoggerFactoryHelper.makeLogger(string name = ".cctor") + 0x35 bytes           businessobjects.enterprise.sdk.netmodule!BusinessObjects.Enterprise.Lib.Tracing.TraceManager.getLogger(string name = ".cctor") + 0x4a bytes           businessobjects.enterprise.sdk.netmodule!BusinessObjects.Enterprise.Infostore.Internal.AbstractSchedulableObject..cctor() + 0x23 bytes           businessobjects.enterprise.sdk.netmodule!BusinessObjects.Enterprise.Infostore.Internal.SchedulableInfoObject.SchedulableInfoObject() + 0xf bytes           businessobjects.enterprise.sdk.netmodule!BusinessObjects.Enterprise.Infostore.Internal.InfoObjects.newInfoObject(System.Object plgKey = ) + 0xbb bytes           businessobjects.enterprise.sdk.netmodule!BusinessObjects.Enterprise.Infostore.Internal.InfoObjects.continueUnpack(BusinessObjects.Enterprise.OcaFramework.Oca.InfoStore.info_wire_ob3&#91;&#93; wireObjs = {Length=0x1}) + 0x40a bytes           businessobjects.enterprise.sdk.netmodule!BusinessObjects.Enterprise.Infostore.Internal.InfoObjects.startUnpack(BusinessObjects.Enterprise.Security.Internal.ISecuritySession session = {BusinessObjects.Enterprise.Security.Internal.SecuritySession}, BusinessObjects.Enterprise.Infostore.IInfoStore infoStore = {BusinessObjects.Enterprise.Infostore.Internal.InfoStore}, BusinessObjects.Enterprise.OcaFramework.Oca.InfoStore.info_wire_ob3&#91;&#93; wireObjs = {Length=0x1}) + 0x9b bytes           businessobjects.enterprise.sdk.netmodule!BusinessObjects.Enterprise.Infostore.Internal.InfoStore.queryHelper(string query = "SELECT SI_MACHINE, SI_MACHINECHOICE from CI_INFOOBJECTS WHERE SI_ID=2762", BusinessObjects.Enterprise.Infostore.Internal.InfoObjects objs = {BusinessObjects.Enterprise.Infostore.Internal.InfoObjects}) + 0x149 bytes           businessobjects.enterprise.sdk.netmodule!BusinessObjects.Enterprise.Infostore.Internal.InfoStore.Query(string query = "SELECT SI_MACHINE, SI_MACHINECHOICE from CI_INFOOBJECTS WHERE SI_ID=2762") + 0x2f bytes           businessobjects.enterprise.sdk.netmodule!BusinessObjects.Enterprise.Ras21.RASConnection.initServerSpec(BusinessObjects.Enterprise.OcaFramework.ServerSpec serverSpec = {BusinessObjects.Enterprise.OcaFramework.ServerSpec}) + 0x30d bytes           businessobjects.enterprise.sdk.netmodule!BusinessObjects.Enterprise.Ras21.RASConnection.init(BusinessObjects.Enterprise.Ras21.IRASConnectionInitService i_initService = <undefined value>) + 0x422 bytes           businessobjects.enterprise.sdk.netmodule!BusinessObjects.Enterprise.Ras21.RASConnection.RASConnection(string i_sServerKind = "dpscacheFullClient", BusinessObjects.Enterprise.Ras21.Messages.GetConnection i_getConnection = {BusinessObjects.Enterprise.Ras21.Messages.GetConnection}, System.IO.Stream i_documentStream = <undefined value>, BusinessObjects.Enterprise.Ras21.IRASConnectionInitService i_initService = <undefined value>, BusinessObjects.Enterprise.Ras21.Serialization.IServerDeserializerFactory i_deserializerFactory = {BusinessObjects.Enterprise.Ras21.RASConnectionFactory.RASConnectionServerSerializationFactory}, BusinessObjects.Enterprise.Ras21.Serialization.IServerSerializerFactory i_serializerFactory = {BusinessObjects.Enterprise.Ras21.RASConnectionFactory.RASConnectionServerSerializationFactory}) + 0x18a bytes           businessobjects.enterprise.sdk.netmodule!BusinessObjects.Enterprise.Ras21.RASConnectionFactory.getRASConnection(string i_sServerKind = "CrystalEnterprise.FullClient", System.Globalization.CultureInfo i_locale = {System.Globalization.CultureInfo}, BusinessObjects.Enterprise.Security.Internal.ISecuritySession i_secSession = {BusinessObjects.Enterprise.Security.Internal.SecuritySession}, BusinessObjects.Enterprise.Ras21.Messages.GetConnection.DocumentId i_documentId = {BusinessObjects.Enterprise.Ras21.Messages.GetConnection.DocumentId}, System.IO.Stream i_documentStream = <undefined value>, BusinessObjects.Enterprise.Ras21.IRASConnectionInitService i_initService = <undefined value>) + 0x156 bytes           businessobjects.enterprise.sdk.netmodule!BusinessObjects.Enterprise.Ras21.RASConnectionFactory.getRASConnectionObjectId(string i_sServerKind = "CrystalEnterprise.FullClient", System.Globalization.CultureInfo i_locale = {System.Globalization.CultureInfo}, BusinessObjects.Enterprise.Security.Internal.ISecuritySession i_secSession = {BusinessObjects.Enterprise.Security.Internal.SecuritySession}, int i_nObjectId = 0xaca) + 0x108 bytes           businessobjects.reportengine.fc.dll!BusinessObjects.ReportEngine.FC.ras21.XMLviaRAS21Encode.newSession(BusinessObjects.ReportEngine.FC.ras21.RAS21SessionID i_occaSession = {BusinessObjects.ReportEngine.FC.ras21.RAS21SessionID}, string i_sLocale = "en-US", int i_nDocId = 0xaca, string s_iConnID = "1") + 0x107 bytes           businessobjects.reportengine.fc.dll!BusinessObjects.ReportEngine.FC.ras21.RAS21ReportEngineComAdapter.InitRAS21Connection(BusinessObjects.ReportEngine.FC.ras21.RAS21SessionID i_occaSession = {BusinessObjects.ReportEngine.FC.ras21.RAS21SessionID}, string i_sLocale = "", bool i_bNewDoc = false, int i_nDocId = 0xaca, string i_sConnID = "1") + 0x1d bytes           businessobjects.reportengine.fc.dll!BusinessObjects.ReportEngine.FC.ras21.RAS21ReportEngineComAdapter.openDocument(BusinessObjects.ReportEngine.Internal.Utilities.Storage.IStorageManager storageManager = {BusinessObjects.ReportEngine.Internal.Utilities.Storage.ClusterStorageManager}, string sLocale = "", int docID = 0xaca) + 0xde bytes           businessobjects.reportengine.fc.dll!BusinessObjects.ReportEngine.FC.ReportEngineImpl.OpenDocument(int docID = 0xaca) + 0x107 bytes     >     businessobjectinteroperation.dll!BusinessObjectsInteroperation.BusinessObjectsInterop.GetBinaryReportByName(string NameOfTheReport = "DO_Raport", System.IO.Stream StreamForDataBeWritten = {System.Web.HttpResponseStream}, BusinessObjectsInteroperation.BOConfigs BOCfg = {BusinessObjectsInteroperation.BOConfigs}, BusinessObjects.ReportEngine.OutputFormatType OutputFormat = Pdf, System.Collections.Hashtable PromptValues = {Count=0x3}) Line 80 + 0x22 bytes     C#

Maybe you are looking for

  • Can't read text in Adobe Reader - any suggestions?

    I've used Adobe Reader for years without any problems, but now when I open a .PDF, I get a grey screen with no visible letters. If I select all, there are words higlighted on the screen, but they aren't visible; the text is there, nothing is wrong wi

  • Menu spry bar

    Does anybody know how to modify the spry menus? like changing the background color, the shape, etc. The only thing I figured is how to change to with for the main menu. Is there another way to do drop down menus in DW cs5? Please any help will be gre

  • In Mac OS Leopard, are there any maintenance programs that I could run

    I recently had a failed attempt at installing Final Cut Studio, which has been resolved, but the filed install has left things "weird". The computer crashes ALL the time, there are left over mini-programs that I can't seem to get rid of unless I forc

  • Messages in Mail are gibberish (Mail 2.1, 10.4.7–inbound from Lotus 6.5.1)

    All other messages come thru fine but I'm having issues getting messages from clients using Lotus Notes 6.5.1 We're running 10.4.7's Mail 2.1 and our email server is Communigate Pro. This isn't a font issue as the text actually has a repeatable patte

  • Packing List and Price list

    Hi , Can anyone please let me know how to create packing list?and what is Pricelist , and how can we maintain pricelist ? Please explain with some simple scenarios. Thanks, Kanna.