JSF h:commandButton which renders as an html button rather then input

I've been struggling to find a way to create a jsf command button that will render as a <button>. The reason I want to do this is so that I can include content inside my button, as the html <button> tag allows. Is there a way to do this, or is this in plan? I am currently using jsf 1.2.

J-M_T-D wrote:
To further clarify, I want a <button> tag, and NOT an <input> tag.I did this by creating a "custom component" which really was the existing HtmlCommandButton as the component and a new renderer which outputs the button tag. (I am using Facelets so no need for a JSP tag.)

Similar Messages

  • As a JSF Developer, I want to understand technically how the JSF View Components are rendered as html and how there events are binded to Server.I want to know each Java Class that is involved in flow.

    As a JSF Developer, I want to understand technically how the JSF View Components are rendered as html and how there events are binded to Server.I want to know how flows goes to the server and server understands the method which is to be called of managed bean. I know it is with annotation @ManagedBean and method name, but how Call is binded with annotation @ManagedBean.
    In short, i want to know the internal implementation of JSF Framework.

    As a JSF Developer, I want to understand technically how the JSF View Components are rendered as html and how there events are binded to Server.I want to know how flows goes to the server and server understands the method which is to be called of managed bean. I know it is with annotation @ManagedBean and method name, but how Call is binded with annotation @ManagedBean.
    In short, i want to know the internal implementation of JSF Framework.

  • JSF 1.2 and h:commandButton custom renderer problem

    Hi everyone!
    I'm working on my custom h:commandButton renderer for a couple of hours and I cannot solve some issues...
    First of all: what I want to do is to substiute default h:commandButton renderer with my own which will call standard renderer and puts some other tags. After all I will have something like that:
        <div class="leftbackground">     
           <div class="rightbackground">
               <input type="button" value="Ok" />  --- this is defaulty rendered by h:commandButton renderer
           </div>
        </div>So that I've put some lines info faces-config.xml:
    <render-kit>
             <renderer>
                  <component-family>javax.faces.Command</component-family>
                  <renderer-type>javax.faces.Button</renderer-type>
                  <renderer-class>test.MyCommandButtonRenderer</renderer-class>
             </renderer>
        </render-kit>I've written my own renderer which looks like this:
    package test;
    import java.io.IOException;
    import javax.faces.component.UIComponent;
    import javax.faces.context.FacesContext;
    import javax.faces.context.ResponseWriter;
    import javax.faces.render.Renderer;
    import com.sun.faces.renderkit.html_basic.HtmlBasicRenderer;
    public class MyCommandButtonRenderer extends HtmlBasicRenderer{
         public MyCommandButtonRenderer(){
              System.out.println("MyCommandButtonRenderer constructor has been calles");
         public void encodeEnd(FacesContext context, UIComponent component)
                   throws IOException {
              try{
              ResponseWriter writer = context.getResponseWriter();
              writer.startElement("h3", component);
              writer.writeText("Hello from a custom JSF UI Component!", null);          
              writer.endElement("h3");  
              }catch(Exception e){
                   e.printStackTrace();
    }After that, when I try to call h:commandButton on my JSF page:
         <f:view>
              <h:form>
                   <h:commandButton  value="Save"  />
              </h:form>
         </f:view>I can see <h3>Hello from a custom JSF UI Component!</h3>. Unfortunately my <input type="button"> isn't rendered.
    I have tried something like this:
    (in MyCommandRenderer}
    public void encodeEnd(FacesContext context, UIComponent component)
                   throws IOException {
              try{
              ResponseWriter writer = context.getResponseWriter();
              writer.startElement("h3", component);
              writer.writeText("Hello from a custom JSF UI Component!", null);          
              writer.endElement("h3");  
              String family = "javax.faces.Command";
              String renderType = "javax.faces.Button";
              Renderer baseRenderer =
                   context.getRenderKit().getRenderer(family , renderType);
              baseRenderer.encodeEnd(context, component);
              }catch(Exception e){
                   e.printStackTrace();
    }but it obviously only rendered multiple h3 elements until StackOverflowException is being thrown (it calling himself again and again).
    What am I doing wrong? Why my <input type="button"> isn't called? How to call default h:commandButton renderer and told him to render <input type=button> ? Is there any commandButton renderer class I can extend ?Which renderer is used by default by CommandButton component?
    Thanks in advance for any help. I'm really close to leave off my work and stay with something more familiar ;)
    Sorry for my bad English.
    Looking forward to hearing from you,
    Matthew
    Edited by: MatthewPL on Nov 28, 2007 12:42 AM

    To the best of my knowledge, the standard does not specify the default renderer class for any components.
    I would take a wrapper/decorator approach. Add a field to your renderer for the default renderer. Before configuring your renderer, obtain the default renderer and set it on your renderer, then configure it.
    OTOH, there might be easier ways for you to accomplish what you want to do. You could use a PhaseListener to add components to the view whenever a commandButton is encountered in the tree.

  • On the imdb site, ff asks what to do with a file which is a text/html

    when I try to open a link, a window appears instead that says :
    "Opening".
    "You have chosen to open which is a text/html vksji7zemtoiwiug=
    from http://www.imdb.com
    What should Firefox do with this file? etc

    * "Clear the Cache": Tools > Options > Advanced > Network > Offline Storage (Cache): "Clear Now"
    * "Remove the Cookies" from sites that cause problems: Tools > Options > Privacy > Cookies: "Show Cookies"
    Start Firefox in [[Safe Mode]] to check if one of your add-ons is causing your problem (switch to the DEFAULT theme: Tools > Add-ons > Themes).
    See [[Troubleshooting extensions and themes]] and [[Troubleshooting plugins]]

  • How to upload a flat file which is saved as .html format.

    hi techies,
    I have to upload a flat file which is saved in .HTML format. Is there any function moudles seperately to
    upload html flat file or using GUI_UPLOAD.. can we upload it ???
    Please need a suggestion...
    Rgds.,
    subash

    hi gautam,
    this FM is taking html string as input and giving the output, not the file...
    any more suggesstions dude..
    Rgds.,
    subash

  • Bug in rendering UICommand as a button

    I think the RI has a bug when it comes to rendering an UICommand as a submit-button. The problem is that the commandName is rendered as the name of the resulting input type="submit" HTML-element and not the compoundID. The problem now makes itself visible when you have a structure such as
    form
    form/table
    form/table/row1/someoutput
    form/table/row1/someinput
    form/table/row1/acommand commandName="bla"
    form/table/row2/someoutput
    form/table/row2/someinput
    form/table/row2/acommand commandName="bla"
    someoutput and someinput get the right names, but both acommand's get the name "bla". Now when I click on acommand in row2, the acommand in row1 gets the call since it is the first one that is visited and generates the application event. When I now try to find out, from which row the event originated, I always get row2.

    moreover, using compound-ids here will make
    application events dependent on the page namespace in
    which the command buttons exist - which i think is
    undesirable ...I wasn't proposing that the compoundId should be used to trigger the application events. I just said that it would be more consistent to use the compoundIds to connect the generated HTML-elements with the UICommands.
    If I get it right, then the component tree is generated while the JSP is executed. So the UICommand in the tree can hold the commandName while the corresponding HTML-element - here an "input type='submit'" - has the compoundId as its name. When the user now clicks on the button, the UICommand can find this out by searching and finding the request parameter with the compoundId as its name. It then can add a new FormEvent with the commandName it holds.
    Consider the case of a product cataloge as known from amazon.com and various other online shops. Beside each product there is a button such as "Put into cart". When each product with all its information and this mentioned button make a row in a table, there is no real need to give each of those buttons a unique commandName, because you can always find out which table row is the parent of the UICommand that added the FormEvent. And with this you can easily determine which product shall be added to the cart.
    I think in this situation it will make a cleaner code to have many UICommands with the same commandNames "addToCart" than with different ones such as "addToCart2623525", "addToCart4948383", "addToCart002892782" and so on. It's just more object-oriented. Well, at least it feels more object-oriented that way for me.

  • HTML button in the eMail notification sent by Workflow

    I have a workflow which send eMail notification to the users. I want to add 2 HTML buttons for approve and reject on this email notification.
    For this I have embedded the following HTML snippet in the advanced properties (Message Body) of the email action in the workflow -
    <!DOCTYPE html><HTML xmlns="http://www.w3.org/TR/REC-html40" xmlns:v = "urn:schemas-microsoft-com:vml" xmlns:o = "urn:schemas-microsoft-com:office:office" xmlns:w = "urn:schemas-microsoft-com:office:word" xmlns:m = "http://schemas.microsoft.com/office/2004/12/omml"><HEAD><TITLE></TITLE> <META content="text/html; charset=us-ascii" http-equiv=Content-Type> <META name=GENERATOR content="MSHTML 10.00.9200.17183"></HEAD> <BODY> <P><IMG style="TEXT-ALLIGN: left" src="../Site%20Assets/abc_icon.png"></P> <P><STRONG>******************************************<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Styled Workflow eMail<BR>******************************************</STRONG></P> <P><STRONG>Full Name: [%Current Item:FullName%]</STRONG></P><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas> <P></FONT></FONT></FONT><INPUT id=btnApprove type=button value=Approve>&nbsp;&nbsp;<INPUT id=btnReject type=button value=Reject></P></BODY></HTML>
    <!DOCTYPE html><HTML xmlns="http://www.w3.org/TR/REC-html40" xmlns:v = "urn:schemas-microsoft-com:vml" xmlns:o = "urn:schemas-microsoft-com:office:office" xmlns:w = "urn:schemas-microsoft-com:office:word"
    xmlns:m = "http://schemas.microsoft.com/office/2004/12/omml"><HEAD><TITLE></TITLE> <META content="text/html; charset=us-ascii" http-equiv=Content-Type> <META name=GENERATOR content="MSHTML 10.00.9200.17183"></HEAD>
    <BODY> <P><IMG style="TEXT-ALLIGN: left" src="../Site%20Assets/abc_icon.png"></P> <P><STRONG>******************************************<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    Styled Workflow eMail<BR>******************************************</STRONG></P> <P><STRONG>Full Name: [%Current Item:FullName%]</STRONG></P><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2
    face=Consolas><FONT color=#0000ff size=2 face=Consolas> <P></FONT></FONT></FONT><INPUT id=btnApprove type=button value=Approve>&nbsp;&nbsp;<INPUT id=btnReject type=button value=Reject></P></BODY></HTML>
    However when the user receives the mail, the buttons appear as plain text. Moreover the images are also missing.
    Am I  missing any specific configuration? Is there anything more that needs to be done to render a HTML button and images in an email generated from a workflow?
    I would appreciate, if anyone could please help me resolve this issue.

    Hi Arghadip Kar,
    Im glad you liked my name. )
    Anyhoo, you are correct. A Task is used. I checked in SWI1 and the task associated with the mail is TS90000101. (not a ws) Does this help at all?
    In the Business Process, it is the part where the system informs a Training coordinator that a training request by an employee have been approved by his/her manager.
    Do I still check the FM below or are there any other way given the info above?
    Thank you!
    Olekan

  • How to show an HTML file (more then 1MB size) in JEditorPane

    I an trying to show an HTML file (more then 1 MB size ) in JEditorPane
    but getiing OutOfMemory error.
    if i try the same for size less then 1 MB(i tried till 850KB) then it will work fine.
    I am using setPage() method of JEditorPane.
    please provide solution .

    I meet the same question, and even worse.
    I created a html file with frameset, when i point to the link which is an html file larger than 500kb . it fails. and some error "infinite loop in formatting" is thrown
    in javax. swing.text.FlowView. I read the code of this class, and can't tell what's the error of my application.
    Can someone help and give some answer?

  • Html Button Disable/ Template button?

    I am certain that there is a post out here I just cannot find it.
    I have a bunch of users who are remote and have various connection speeds.
    They get inpatient and click my Template Based button multiple times
    Causing multple entries
    I have changed my button to a HTML button and use the
    Optional URL Redirect
    javascript:{this.disabled=true;doSubmit('Create');}
    to disable
    This works but the button is "A html button"
    IS there a way to have the HTML button look like my Template Buttons?
    My background:
    Don't sleep conferences
    Not a Web developer "I know how to spelll HTML"
    I have also attempted to create a new button template using #Button_Attribute# substituted for #link# in template but I cannot get the Button to Disable

    You could create an image that looks like the template button is rendered, and create a custom button template using &lt;input type="image" #BUTTON_ATTRIBUTES#...&gt;, specifying src="image_url" alt="image_alt_text" in the Button Attributes.

  • How can i enable the html:text box when clicking the html:button

    Hi,
    i have a text box which is disabled defaultly and i want to enable it when i click on submit button.
    <html:button property="new" value="new">
    <html:text property="name" disabled="true"/>
    how i will enable that text filed? please tell me?
    Thanks,
    swarupa

    try using javascript onclick attribute:
    onclick="document.form.name.disabled=false"
    m

  • HTML button - button attributes

    I have a 'submit' button on my form that is using the 'HTML' button style.
    I added the following to the 'button attributes' section:
    onclick="doSave();"
    When I view my source, I see 2 'onclicks' which makes the 2nd onclick get ignored.
    <input type="BUTTON" value="Submit" onClick="javascript:this.disabled=true; doSubmit('SUBMIT');" onclick="doSave();">
    What do I need to do to get this formatted correctly?

    Bob,
    Do you need it to do the items in the first on click also?
    You can change the button attributes so that:
    Target is a: URL
    URL Target: javascript:doSave();
    does that work for you?
    Message was edited by:
    TheJosh
    (fixed an error)

  • Deleted html button still visible when published?

    i recentley deleted the html widget from my iweb which contained a twitter follow button and i have a new html code i am using which is a twitter feed, but when the site is pulished the twitter follow button is still visible, when the site is viewed from the home folder all looks fine, when its published to the ftp server the button is visible and not the html code currentley in use? what is the problem?
    take a look here > http://www.shanomusic.com <
    This is how it should look.. vv

    Empty your browser cache before visiting the published site. In Safari do Option/Command/E

  • Html button redirect to page

    Hi,
    I have created an html button and I need to redirect to another page from the application. At the moment it redirects me to the page before altough I made a branche for the page I need
    Thank you

    If your button does not need to submit the page, then:
    Edit the button and enter your redirect information under Action when button pressed. Action will be Redirect to Page in This Application
    If you need to Submit, then the most common method would be to have a Branch that Fires When Button (Your button) is Pressed, and make sure you don't have a branch with a lower sequence number which is firing before your intended branch gets a chance to fire.

  • I updated StumbleUpon which offered a tool bar. Since then I get no URL line, including everything else normally on that line. I have uninstalled Firefox and reinstalled and still get the same. What can I do to correct this without doing a system restore

    I recently updated the add-on StumbleUpon which offered a tool bar. Since then I do not get the line which has the URL space as well as other functions. I am now forced to use IE. I have uninstalled Firefox and reinstalled but get the same startup page. What else can I do short of using system restore to a prior date?
    == This happened ==
    Every time Firefox opened
    == when I last updated add-ons.

    This issue can be caused by the Yahoo! Toolbar extension
    *https://support.mozilla.com/kb/Troubleshooting+extensions+and+themes

  • Every time I try to purchase a song from itunes, it says I have to put in security questions and answer them, which it's never done before. Then after I do the questions, it says that an error occurred and my changes couldn't be saved. HELP!

    Every time I try to purchase a song from itunes, it says I have to put in security questions and answer them, which it's never done before. Then after I do the questions, it says that an error occurred and my changes couldn't be saved. It has been doing this for weeks, and I can't purchase anything! HELP!

    Hi mterry1723, one solution that might be worth trying is this:
    - Close iTunes, if it's open
    - Open Safari and got to 'Preferences'
    - Select 'Security' on the top
    - Untick all the security options in the menu
    - Click the 'Show Cookies' button and look for all the 'apple' entries in the left-hand column.
    - Highlight them (select them collectively) and press 'Remove'
    - Now open iTunes and buy the song as usual.
    - You may be asked to do the same security process as before, so do as asked.
    - Hopefully, the security check will now have accepted your answers and start downloading the song as normal.
    Remember to re-tick all the required security options you had just un-ticked in Safari preferences. You don't need to bother about opening the cookies again.
    I hope this has worked for you and my profoundest apologies if it has not. Worth a go, though!
    I did see this thread: https://discussions.apple.com/message/18259935#18259935 which may be of more help, mainly the last entry by 'c2boyd'
    Message was edited by: Bongomal

Maybe you are looking for

  • Mini + TV = grayscale image?

    I connected my mini with the Apple DVI - S video adaptor to an S video-Scart cable to my TV (PAL- europe) I can only get a gray scale image (no color) Sound is OK. Is this a known problem, what is the solution? Thanks!

  • Problem with 10bit RGB video

    Hello. I'm having a problem with a project which was first edited with a low res proxy; The editor sent me the complete edit, and I switched the source file to the uncompressed file. They are both exactly the same duration, frame size, etc, but the p

  • Should I close this account?

    So I have been thinking about closing my secured card with SDFCU. When I got it, I never thought Id get unsecured cards so quick and never use it anyways. However, I was worried about score dropping. I have no idea what my AAOA is. My credit history

  • Now I get Notifications for Every New Post in Subscribed Topic

    I believe this is a change from the old forums. Used to be I would get only one e-mail notification of new posts in a topic to which I was subscribed and would get no more until I revisited the topic (in a logged in state). Now I get an e-mail each t

  • Will the reserved work item triggers deadline?

    hi, im working on DMS workflow for the transaction CV02N. when i got the work item , i have double clicked and it has taken me to cv02n  transaction. i did not do any thing in the transaction  and came to my business workplace with out saving any thi