How to add events to a ordinary html tag

How can i add a event to ordinary tag
Ex:
public void encodeBegin(FacesContext context) throws IOException {
ResponseWriter writer = context.getResponseWriter();
writer.startElement("div", this);
writer.writeAttribute("id", getClientId(context), null);
String width = (String)getAttributes().get("width");
String height = (String)getAttributes().get("height");
String style = (String)getAttributes().get("style");
style= (style!=null) ? style + ";" : "";
if (width != null) style += "width:" + width + ";";
if (height != null) style += "height:" + height+ ";";
writer.writeAttribute("style", style, null);
String styleClass = (String)getAttributes().get("styleClass");
if (styleClass!=null)
writer.writeAttribute("class", styleClass, null);
String title = (String)getAttributes().get("title");
if (title!=null)
writer.writeAttribute("title", title, null);
public void encodeEnd(FacesContext context) throws IOException {
ResponseWriter writer = context.getResponseWriter();
writer.write("<input type=\"button\" name=\"but\"/>");
writer.endElement("div");
i want to add event and bean for the <<< writer.write("<input type=\"button\" name=\"but\"/>"); >>>line of code, which is nothing but a button. I can added using JSF concept. but the requirement is like this. I have to add normal html tag for which i have to use bean and events as well.
Can anyone give suggestion for this

I will give a clear example
writer.write("<h:outputText id=\"txt\" value=\"Just a Display\" />");
writer.write("div");
this 2 lines is in endcodeEnd method. The output text wont display the msg.
even i am writing before the end tag
Here is the full code
================
public void encodeBegin(FacesContext context) throws IOException {
ResponseWriter writer = context.getResponseWriter();
writer.startElement("div", this);
writer.writeAttribute("id", getClientId(context), null);
String width = (String)getAttributes().get("width");
String height = (String)getAttributes().get("height");
String style = (String)getAttributes().get("style");
style= (style!=null) ? style + ";" : "";
if (width != null) style += "width:" + width + ";";
if (height != null) style += "height:" + height+ ";";
writer.writeAttribute("style", style, null);
String styleClass = (String)getAttributes().get("styleClass");
if (styleClass!=null)
writer.writeAttribute("class", styleClass, null);
String title = (String)getAttributes().get("title");
if (title!=null)
writer.writeAttribute("title", title, null);
public void encodeEnd(FacesContext context) throws IOException {
ResponseWriter writer = context.getResponseWriter();
writer.write("<h:outputText id=\"txt\" value=\"Just a message\" />");
writer.endElement("div");
writer.write("<h:outputText id=\"txt\" value=\"Just a message\" />");
This line is not executing
kindly reply me..
my mail id is [email protected]

Similar Messages

  • How to add event to calendar?

    how to add event to calendar?  No plus sign at top of window.

    See the user guide:  http://manuals.info.apple.com/en_US/iphone_user_guide.pdf

  • How to add a validator to a custom tag

    Hello,
    I would like to know how to add a validator to my custom tag as an attribute.
    <mytags:custom validator=???/>
    Thanks.
    Sebastien

    Are you wanting to use one of the JSF validators or a home brewed one?

  • How to add events in JTable fields

    Hello friends i m working with file transfer client server project in my college.In my client part i have used JTable with AbstractTableModel.
    In my JTable it list the current directory files and directories under current directory .
    now how can i add events to the the directories that it shows on JTable so that when i click on directory it displays files under that selected directory.
    can anyone help me in that.
    I will send you my code for that project if anyone can help me.
    please help me to do that

    You can handle row selections with selection listener but if you want to handle double clicks you can use something similar to this:
    table.addMouseListener(new MouseAdapter() {
    public void mouseClicked(MouseEvent e)
    int column = table.columnAtPoint(e.getPoint());
    int row = table.rowAtPoint(e.getPoint());
    Object cellValue = table.getValueAt(row, column); 
    // Insert files below clicked row
    });Please, be more patient in the future -you would probably get an answer if you just posted to any of these two forums.

  • How to add event listener?

    i want to add event listener when i click on a button in mxml, the event listener should be added in the action script file, how to do this?
    can anyone help? urgent!!!

    Hi Lakshmi,
    You can do this just put all the script in the mxml block in seperate AS file as shown below... Observe that I have included an AS file named Script.as and removed the script block form mxml and moved to this Script.as file. Place the Script.as file in your src folder ....
    // Main mxml file....
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="onCreationComplete()">
        <mx:Script source="Script.as"/>
    <mx:TextArea id="textArea" width="300" height="100" />
    <mx:Button id="myButton" label="Click ME"/>
    </mx:Application>
    //Script.as file
    import mx.controls.Alert;
                private function onCreationComplete():void
                 myButton.addEventListener(MouseEvent.CLICK, onButtonClick);
                private function onButtonClick(event:MouseEvent):void
                 Alert.show("Button is Clicked");
    Thanks,
    Bhasker

  • How to add event in Date type bean

    Hi,
    I have created two date items - start date and end date.
    now I want to add event in these items?
    how can I add event in date type bean?
    Pls help..
    Thanks
    Amit

    Hi Swati,
    Yes, I have two OAMessageTextInput bean of Type Date.
    How can I set event by --StartDateBean.setEnterClientAction(ClientAction);
    I am unable to pass parameter of type "ClientAction" in .setEnterClientAction.
    how can I do this. If I declare by
    ClientAction DateEvent = null;
    then
    StartDateBean.setEnterClientAction(DateEvent);
    then it doesn't gives me any error but I am unable to initialize the value in "ClientAction" except null.
    How can I do this?
    Pls Help?
    Thanks
    Amit

  • How to add events on calendar

    I used to be able to add events on my calendar and now I can't. Please help! Thank you

    If there is no + sign to add events - go to Settings>iCloud>Calendar>On. Toggle the setting on and off.

  • How to add event handling for a menu?

    hi,
    I have created a menu and few mneu items.
    for eachmenu itme , i did event handling and it is workign fine.
    it was like this
    menuItem = new JMenuItem("Exit",KeyEvent.VK_X);
    menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, ActionEvent.ALT_MASK));
    menuItem.addActionListener(this);
    menu.add(menuItem);
         public void actionPerformed(ActionEvent e)
    JMenuItem source = (JMenuItem)(e.getSource());
    String s = "Action event detected. Event source: " + source.getText();
    System.out.println(s);     
    public void itemStateChanged(ItemEvent e)
    JMenuItem source = (JMenuItem)(e.getSource());
    String s = "Item event detected. Event source: " + source.getText();
    System.out.println(s);
    now int he second menu i don't have any menu item and i want to do the event handling for the menu itself. any ideas how to do it. following is the code for the menu
    //Build the second menu.
    menu2 = new JMenu("Options");
    menu2.setMnemonic(KeyEvent.VK_O);
    menuBar.add(menu2);
    menu2.addActionListener(this);     //this does nto work

    You were on the right track. However, selecting a menu is different from selecting a menu item. MenuItem chucks an ActionEvent and Menu will send an ItemEvent.
    If you pile all action output to one actionPerformed method then be careful of your assumptions on what the source type will be. If by any chance the Menu has sent an ActinoEvent then your code will have caused a ClassCastException.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class MenuTest implements ActionListener, ItemListener {
        JMenuItem menuItem;
        JMenu menu1, menu2;
        JMenuBar menubar;
        JFrame frame;
        public MenuTest() {
            frame = new JFrame("MenuTest");
            frame.setDefaultCloseOperation(frame.EXIT_ON_CLOSE);
            menubar = new JMenuBar();
            frame.setJMenuBar(menubar);
            menu1 = new JMenu("File");
            menu1.setMnemonic(KeyEvent.VK_F);
            menuItem = new JMenuItem("Exit",KeyEvent.VK_X);
            menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, ActionEvent.ALT_MASK));
            menuItem.addActionListener(this);
            menu1.addItemListener(this);
            menu1.add(menuItem);
            menubar.add(menu1);
            //Build the second menu.
            menu2 = new JMenu("Options");
            menu2.setMnemonic(KeyEvent.VK_O);
            menu2.addActionListener(this); //this does not work
            menu2.addItemListener(this); // use this instead
            menubar.add(menu2);
            JPanel panel = new JPanel();
            panel.setPreferredSize(new Dimension(100,100));
            frame.getContentPane().add(panel);
            frame.pack();
            frame.show();
        public void actionPerformed(ActionEvent e)
            String s = "Action event detected. Event source: " + e.getSource();
            System.out.println(s);
        public void itemStateChanged(ItemEvent e)
            String s = "Item event detected. Event source: " + e.getSource();
            System.out.println(s);
        public static void main(String[] args) {
            new MenuTest();
    }

  • Urgent: How to add event listeners to a null object?

    I have an object that is lazy loaded, and therefore starts out null.
    How can I add an event listener onto this null object, so that it fires whenever the object is instantiated?
    WHY does arrayCollection.addEventListener(CollectionEvent.COLLECTION_CHANGED, function) not work??
    Thanks!
    C

    C,
    the answer to your question "WHY does arrayCollection.addEventListener(CollectionEvent.COLLECTION_CHANGED, function) not work??" is that addEventListener is not a static method, ie it has to be attached to an actual instance. I agree that in your situation it would be handy to have it as static, something like ArrayCollection.addEventListener(etc) but I'm not at all sure that is a good plan in general, as usually we want events to fire from an actual instance of the class, not generically. A quick look through the adobe docs has convinced me there are not many static methods at all, and none that appear to help you.
    I take it from your description that you don't know exactly when the collection is instantiated? But presumably though you do have a point where new is called? Or something equivalent like populating it from something else?
    Richard

  • Anyone know how to add a hyperlink to the HTML Gallery template?

    In previous versions, I created a modified HTML template which included a link back to a specific page. This placed the link on ALL of the Index pages. Now I must modify HUNDREDS of indices to accomplish the same thing. There has GOT to be a better way!

    With iOS 5 in the Autumn (from http://www.apple.com/ios/ios5/features.html#more) :
    Even add and delete mailbox folders on the fly.

  • How to add event handler for outlook build in control through programmatically

    Hi,<o:p></o:p>
         There is requirement in my plug in where i need to intercept outlook native attach file method.If user attach more than specified
    exchange limit , i need to perform some operatoin. I found  that there is way to add "Onaction" method for built in control  like this " <command idMso="AttachFile" onAction="CatchExchangeWarning"/> ".
    I have to do the same thing via programmatically .I need to attach this event handler through programmatically since my add is not developed by xml file.
    <o:p>Thanks</o:p>

    Hello,
    It looks like you are interested in the
    BeforeAttachmentAdd event of Outlook items. It is fired before an attachment is added to an instance of the parent object. So, you can analyze the attachment object passed as a parameter and set then Cancel argument - set
    it to true to cancel the operation; otherwise, set to false to allow the Attachment to
    be added.
    Also the Outlook object model provides the
    AttachmentAdd event for Outlook items. It is fired when an attachment has been added to an instance of the parent object. You can also analyze the attachment object passed as a parameter to the event handler. You will not be able to
    cancel the action in that case.

  • How to add events to the Calendar on iPhone in iOS5

    I've got a 3Gs and upgraded to iOS 5 this morning.
    When I access my calendar on the iphone (iCal) I can't add any activities/events to a particular date (in month view). There used to be a + sign when you clicked a date, which is gone now. I tried tapping, double tapping on the date itself, but also at the bottom where it says 'no activities' on a no-activity day.
    I also tried rebooting, but with no result.
    Anyone any ideas?

    I somehow managed to get it to work again.
    I connected the iphone again with itunes and chose to synch the calendar with the ical on my macbook. This imported all calendars from the ical on my macbook to my iphone. And suddenly the + button was back again.
    Also, the tapping on a date to add an event works now. Not sure what or why went wrong the first time, but fortunately it's working now.

  • How to add events into folders without making albums?

    All my events created in iPhoto are exactly the way I want to organise my photos, but I hate the fact that I can't organise them into different folders without making an album out of the event. I don't want 'pointers' of photos in the album, I want the original file that I can delete forever as well. I have organised my photos in continents, like Oceania, Europe, South America etc... Into those folders I just want the events of the different countries, so when I click on a continent I can see the event view of those countries and not see all the 4000 photos at once of all the countries in that continent. I also like to go through events the way they are displayed in the event tab, but when the event becomes an album, they are shown differently.
    I hope I explained it clearly... Is there a way to put just the events into folders and keep them as events?
    On the picture above I want the albums 'Mt Warning', 'Bungyjump' etc, to be become events that contain the original photo files and not just pointers to the original photos. I also want the display of this folder 'Australia 2012 - 2014' to become the same display as when you click on the event tab (so you can see the different events in thumbnails). Is this possible?

    And how can I delete photos permanently (in all of iPhoto as well as on my hard drive)?
    Deleting Photos from an iPhoto Library
    1 - from an Event or the Photos mode: select the photo(s) and use the Delete key to move the photos to the trash bin. Then empty the iPhoto Trash bin as follows:
    2 - from an album, smart album, book, slideshow, card, etc.: select the photo(s) and use the key combination of Command+Option+Delete to move the photos to the trash bin.  Then empty the trash bin as above.
    NOTE: deleting a photo from an album, slideshow, book, etc., with only the Delete key only deletes that photo from that item. Deleting a photo from an Event deletes ALL occurences of that photo in the library.

  • How to add event handler in maximize window

    I need to add code to maximize event... please help

    The listener interface you want is WindowStateListener.
    This is Implemented in WindowAdapter so is used in the following example.import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    public class WindowStateTest extends JFrame
         JLabel label;
         public WindowStateTest()
              super("WindowStateTest");
              setSize(400,400);
              setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
              addWindowStateListener(new WindowAdapter()
                        public void windowStateChanged(WindowEvent e)
                             if(e.getNewState() == Frame.NORMAL)
                                  ((WindowStateTest)e.getSource())
                                       .label.setText("Window is Normal");
                             else if(e.getNewState() == Frame.MAXIMIZED_BOTH)
                                  ((WindowStateTest)e.getSource())
                                       .label.setText("Window is Maximized");
                        public void windowClosing(WindowEvent e)
                             {System.exit(0);}
              label = new JLabel("Window is Normal");
              JPanel p = new JPanel(new FlowLayout());
              p.add(label);
              getContentPane().add(p, BorderLayout.CENTER);
         public static void main(String[] args)
              new WindowStateTest().setVisible(true);
    }

  • How to add event handler to JTable?

    I need an event listener that tells me whenever a cell has been edited. Does anyone have any ideas on how to implement this. There doesn't seem to be much documentation on the subject.
    Thanks in advance..
    dosteov

    Hello,
    It looks like you are interested in the
    BeforeAttachmentAdd event of Outlook items. It is fired before an attachment is added to an instance of the parent object. So, you can analyze the attachment object passed as a parameter and set then Cancel argument - set
    it to true to cancel the operation; otherwise, set to false to allow the Attachment to
    be added.
    Also the Outlook object model provides the
    AttachmentAdd event for Outlook items. It is fired when an attachment has been added to an instance of the parent object. You can also analyze the attachment object passed as a parameter to the event handler. You will not be able to
    cancel the action in that case.

Maybe you are looking for

  • Exporting from Live type as uncompressed

    Does anyone know if it is possible to export from live type with no compression or in different codecs? I have this option in FCP and AE and my graphics and type look great when export using "none" compression or 10 bit uncompressed.

  • Unable to export image from Webi to  excel.

    Hi, Can any one provide solution for export image from webi to excel( 3.1 & 4.0). Thanks, Praveen

  • How to reset password on Satellite U200-181?

    Greetings! Sorry for my English. I have notebook Toshiba Satellite U200-181 and all documents from it (check, warranty). When the computer starts, it demands to enter the BIOS password... I called in the service center in Russia, but they told me the

  • Application system name against the Integration server is missing

    Hello All, In the technical system browser, for exchange infrastructure, I cannot see the application system name against th   View and Define Systems and Servers   Technical Systems      Technical System Type:   Exchange infrastructure    Name      

  • Forms 9i vs Forms 8i?

    I am using Forms 6i for development on Oracle 8i database. However, I'm being encouraged to change 9i but I've not understood the difference in the two platforms. My friend wants to buy the software 9i but I want to be sure because $310 is not a joke