H:outputLink problem

Hi,
I am trying to use the h:outputLink component to provide links to an external app.
My page contains a text field. The user enters a url and clicks on save. The url is then displayed as an anchor which the user can click and open the desired application.
Following is the sample code i used to get this running
<h:outputLink target="_new" value="#{TestBean.url}">
<h:outputText value="#{TestBean.url}" />
</h:outputLink> .
This works fine but some times the outputLink component behaves abnormally
when the user enters a url like http://testapp:8080/ and saves
the url is displayed as anchor and when the user clicks on it it opens in a new window properly
but when the user enters a url without the http prefix then some how the link has my application context attached as prefix
ex: if the user enters a url www.yahoo.com then the final anchor generated is http://localhost:8080/MyApp/www.yahoo.com.
Can anyone please help me figure out what this means??

I think the problem is in the way browser interprets the HREF attribute for anchor tag - if the value does ntos tart with the protocol, then it is treated as a relative URL and therefor you application context is added.

Similar Messages

  • Problem with h:outputLink value

    Hi All,
    I have an h:outputLink and the value has to be taken from the properties file.
    For example, if i have the property as :
    linkValue=http://www.google.com/and my outputLink looks like this in my jsp.
    <h:outputLink value="#{lbl.linkValue}" id="link1">
          <h:outputText id="text1" value="Google Link"></h:outputText>
    </h:outputLink>The code is working fine, but the final link that gets generated looks like this.
    http://localhost:8080/MyApp/http://www.google.com/ whereas, it should just look like
    http://www.google.com/Can anyone help.
    Thanks and Regards,
    Anitha.

    Hi Pachan,
    Thanks for your response. But my requirement is to take the value from the properties file. I do not have to use the managed bean. Is there any straight forward solution to this problem?
    Thanks and Regards,
    Anitha.

  • Open File from Filesystem with OutputLink

    I have implemented an UploadForm with JSF. With this form a File is uploaded to my filesystem and some data (link to filename, filename itself and so on) are written to the Database.
    No I display these data from the database in a datatable and I want to implement a link, that the user can open the file from the filesystem. I have tried a outputlink with something like that:
    <h:outputLink value="file:C:\Entwicklung\IDE\eclipse\readme.txt" target="_blank">
                   <f:verbatim>
                        Test
                   </f:verbatim>
    </h:outputLink>
    I'm not sure if the file: Command is the right...
    The problem is, that nothing happens. When I try to save the file, pressing the right button and choose "Save as..." the file is correctly saved.
    How can I implement a link to open a file from the filesystem?
    Regards,
    Andy

    No the file won't be a html file..
    I will be some kind of pdf or doc?
    So how to launch them? Do I need an Outputstream?
    Has anyone experiences with that?Any file could go as an href value.
    Issue is not file type, but a proper URI that the server could resolve.

  • Tomahawk t:inputDate problem in IE

    I am using t:inputDate with popupCalendar attribute set to "true". It works perfectly in Firefox but the calendar can't popup in IE. Would anyone please help me? Thanks very much!
    Note: I have already added extension filters and I'm using tomahawk version 1.1.5
    Here is my JSP source code:
    <html>
         <head>
              <title>Stock Management System</title>
         </head>
         <body>
              <f:view>
                   <h:form>
                        <t:outputText value="Welcome "/>
                        <t:outputText value="#{account.engName}!"/>
                        <p>
                        <t:panelGrid columns="3">
                             <t:commandLink tabindex="100" value="Save" action="#{transactionHandler.insert}"/>
                             <t:commandLink tabindex="101" value="Cancel" action="main" immediate="true"/>
                             <h:outputLink tabindex="102" value="#{facesContext.externalContext.request.contextPath}/pages/logout.jsp">
                                  <t:outputText value="Logout"/>
                             </h:outputLink>
                        </t:panelGrid>
                        <p>
                        <t:panelGrid id="main" columns="3">
                             <t:outputText value="Buy / Sell"/>
                             <t:selectOneMenu tabindex="1" id="action" value="#{transaction.action}" required="true">
                                  <f:selectItem itemValue="B" itemLabel="Buy"/>
                                  <f:selectItem itemValue="S" itemLabel="Sell"/>
                             </t:selectOneMenu>
                             <t:message for="action"/>
                             <t:outputText value="Date"/>
                             <t:inputDate id="date" type="date" popupCalendar="true" value="#{transaction.date}"/>
                             <t:message for="date"/>
                             <t:outputText value="Stock Code"/>
                             <t:inputText tabindex="5" id="stockCd" value="#{transaction.stockCd}" size="4" dir="RTL" required="true">
                                  <f:validateLongRange maximum="9999" minimum="1"/>
                             </t:inputText>
                             <t:message for="stockCd"/>
                             <t:outputText value="Quantity" />
                             <t:inputText tabindex="6" id="qty" value="#{transaction.qty}" size="8" dir="RTL" required="true">
                                  <f:validateDoubleRange minimum="0"/>
                             </t:inputText>
                             <t:message for="qty"/>
                             <t:outputText value="Unit Price" />
                             <t:inputText tabindex="7" id="unitPrice" value="#{transaction.unitPrice}" size="8" dir="RTL" required="true">
                                  <f:convertNumber pattern="$#,##0.000"/>
                                  <f:validateDoubleRange minimum="0"/>
                             </t:inputText>
                             <t:message for="unitPrice"/>
                             <t:outputText value="Brokerage" />
                             <t:inputText tabindex="8" id="brokerage" value="#{transaction.brokerage}" size="8" dir="RTL">
                                  <f:convertNumber pattern="$#,##0.00"/>
                                  <f:validateDoubleRange minimum="0"/>
                             </t:inputText>
                             <t:message for="brokerage"/>
                             <t:outputText value="Levy Fee" />
                             <t:inputText tabindex="9" id="levy" value="#{transaction.levy}" size="8" dir="RTL">
                                  <f:convertNumber pattern="$#,##0.00"/>
                                  <f:validateDoubleRange minimum="0"/>
                             </t:inputText>
                             <t:message for="levy"/>
                             <t:outputText value="Stamp Duty" />
                             <t:inputText tabindex="10" id="stampDuty" value="#{transaction.stampDuty}" size="8" dir="RTL">
                                  <f:convertNumber pattern="$#,##0.00"/>
                                  <f:validateDoubleRange minimum="0"/>
                             </t:inputText>
                             <t:message for="stampDuty"/>
                             <t:outputText value="Trading Fee" />
                             <t:inputText tabindex="11" id="tradingFee" value="#{transaction.tradingFee}" size="8" dir="RTL">
                                  <f:convertNumber pattern="$#,##0.00"/>
                                  <f:validateDoubleRange minimum="0"/>
                             </t:inputText>
                             <t:message for="tradingFee"/>
                             <t:outputText value="Investment Compensation Levy" />
                             <t:inputText tabindex="12" id="invCompLevy" value="#{transaction.invCompLevy}" size="8" dir="RTL">
                                  <f:convertNumber pattern="$#,##0.00"/>
                                  <f:validateDoubleRange minimum="0"/>
                             </t:inputText>
                             <t:message for="invCompLevy"/>
                             <t:outputText value="Handling Charge" />
                             <t:inputText tabindex="13" id="handlingChrg" value="#{transaction.handlingCharge}" size="8" dir="RTL">
                                  <f:convertNumber pattern="$#,##0.00"/>
                                  <f:validateDoubleRange minimum="0"/>
                             </t:inputText>
                             <t:message for="handlingChrg"/>
                             <t:outputText value="Deposit Charge" />
                             <t:inputText tabindex="14" id="depositChrg" value="#{transaction.depositCharge}" size="8" dir="RTL">
                                  <f:convertNumber pattern="$#,##0.00"/>
                                  <f:validateDoubleRange minimum="0"/>
                             </t:inputText>
                             <t:message for="depositChrg"/>
                        </t:panelGrid>
                   </h:form>
              </f:view>
         </body>     
    </html>
    Here is the generated HTML results:
    <html>
         <head>
    <link rel="stylesheet" href="/Stock/faces/myFacesExtensionResource/org.apache.myfaces.renderkit.html.util.MyFacesResourceLoader/11796022/calendar.HtmlCalendarRenderer/WH/theme.css" type="text/css" />
    <link rel="stylesheet" href="/Stock/faces/myFacesExtensionResource/org.apache.myfaces.renderkit.html.util.MyFacesResourceLoader/11796022/calendar.HtmlCalendarRenderer/DB/theme.css" type="text/css" />
    <script type="text/javascript" src="/Stock/faces/myFacesExtensionResource/org.apache.myfaces.renderkit.html.util.MyFacesResourceLoader/11796022/prototype.PrototypeResourceLoader/prototype.js"><!--
    //--></script>
    <script type="text/javascript" src="/Stock/faces/myFacesExtensionResource/org.apache.myfaces.renderkit.html.util.MyFacesResourceLoader/11796022/calendar.HtmlCalendarRenderer/date.js"><!--
    //--></script>
    <script type="text/javascript" src="/Stock/faces/myFacesExtensionResource/org.apache.myfaces.renderkit.html.util.MyFacesResourceLoader/11796022/calendar.HtmlCalendarRenderer/popcalendar.js"><!--
    //--></script>
              <title>Stock Management System</title>
         </head>
         <body>
                   <form id="_idJsp0" name="_idJsp0" method="post" action="/Stock/pages/add_transaction.jsf" enctype="application/x-www-form-urlencoded">
                        Welcome
                        Tsang Shiu Ching!
                        <p>
                        <table><tbody><tr><td><script type="text/javascript"><!--
         function oamSetHiddenInput(formname, name, value)
              var form = document.forms[formname];
              if(typeof form.elements[name]=='undefined')
                   var newInput = document.createElement('input');
                   newInput.setAttribute('type','hidden');
                   newInput.setAttribute('name',name);
                   newInput.setAttribute('value',value);
                   form.appendChild(newInput);
              else
                   form.elements[name].value=value;
         function oamClearHiddenInput(formname, name, value)
              var form = document.forms[formname];
              if(typeof form.elements[name]!='undefined')
                   form.elements[name].value=null;
         function oamSubmitForm(formName, linkId, target, params)
              var clearFn = 'clearFormHiddenParams_'+formName.replace(/-/g, '\$:').replace(/:/g,'_');
              if(typeof eval('window.'+clearFn)!='undefined')
                   eval('window.'+clearFn+'(formName)');
              if(typeof window.getScrolling!='undefined')
                   oamSetHiddenInput(formName,'autoScroll',getScrolling());
              var oldTarget = '';
              if((typeof target!='undefined') && target != null)
                   oldTarget=document.forms[formName].target;
                   document.forms[formName].target=target;
              if((typeof params!='undefined') && params != null)
                   for(var i=0; i<params.length; i++)
                        oamSetHiddenInput(formName,params[0], params[i][1]);
              oamSetHiddenInput(formName,formName +':'+'_idcl',linkId);
              if(document.forms[formName].onsubmit)
                   var result=document.forms[formName].onsubmit();
                   if((typeof result=='undefined')||result)
                        document.forms[formName].submit();
              else
                   document.forms[formName].submit();
              if(oldTarget==null) oldTarget='';
              document.forms[formName].target=oldTarget;
              if((typeof params!='undefined') && params != null)
                   for(var i=0; i<params.length; i++)
                        oamClearHiddenInput(formName,params[i][0], params[i][1]);
              oamClearHiddenInput(formName,formName +':'+'_idcl',linkId);return false;
    //--></script>Save
    <input type="hidden" name="autoScroll" />
    </td><td>Cancel</td><td><a id="_idJsp0:_idJsp6" name="_idJsp0:_idJsp6" href="/Stock/pages/logout.jsp" tabindex="102">Logout</a></td></tr>
    </tbody></table>
                        <p>
                        <table id="_idJsp0:main"><tbody><tr><td>Buy / Sell</td><td><select id="_idJsp0:action" name="_idJsp0:action" size="1" tabindex="1">     <option value="B">Buy</option>     <option value="S">Sell</option></select></td><td></td></tr>
    <tr><td>Date</td><td>
    <span id="_idJsp0:date"><input id="_idJsp0:date.day" name="_idJsp0:date.day" size="2" maxlength="2" /><select id="_idJsp0:date.month" name="_idJsp0:date.month" size="1"><option value="-1" selected="selected"></option>          <option value="1">&#19968;&#26376;</option>          <option value="2">&#20108;&#26376;</option>          <option value="3">&#19977;&#26376;</option>          <option value="4">&#22235;&#26376;</option>          <option value="5">&#20116;&#26376;</option>          <option value="6">&#20845;&#26376;</option>          <option value="7">&#19971;&#26376;</option>          <option value="8">&#20843;&#26376;</option>          <option value="9">&#20061;&#26376;</option>          <option value="10">&#21313;&#26376;</option>          <option value="11">&#21313;&#19968;&#26376;</option>          <option value="12">&#21313;&#20108;&#26376;</option></select><input id="_idJsp0:date.year" name="_idJsp0:date.year" size="4" maxlength="4" /><span id="_idJsp0:dateSpan"></span><script type="text/javascript"><!--
    var _5FidJsp0_3AdateCalendarVar=new org_apache_myfaces_PopupCalendar();
    _5FidJsp0_3AdateCalendarVar.initData.imgDir = "/Stock/faces/myFacesExtensionResource/org.apache.myfaces.renderkit.html.util.MyFacesResourceLoader/11796022/calendar.HtmlCalendarRenderer/DB/";
    _5FidJsp0_3AdateCalendarVar.initData.monthName = new Array("\u4E00\u6708","\u4E8C\u6708","\u4E09\u6708","\u56DB\u6708","\u4E94\u6708","\u516D\u6708","\u4E03\u6708","\u516B\u6708","\u4E5D\u6708","\u5341\u6708","\u5341\u4E00\u6708","\u5341\u4E8C\u6708");
    _5FidJsp0_3AdateCalendarVar.initData.dayName = new Array("\u65E5","\u4E00","\u4E8C","\u4E09","\u56DB","\u4E94","\u516D");
    _5FidJsp0_3AdateCalendarVar.initData.startAt = 0;
    _5FidJsp0_3AdateCalendarVar.dateFormatSymbols.weekdays = new Array("\u661F\u671F\u65E5","\u661F\u671F\u4E00","\u661F\u671F\u4E8C","\u661F\u671F\u4E09","\u661F\u671F\u56DB","\u661F\u671F\u4E94","\u661F\u671F\u516D");
    _5FidJsp0_3AdateCalendarVar.dateFormatSymbols.shortWeekdays = new Array("\u65E5","\u4E00","\u4E8C","\u4E09","\u56DB","\u4E94","\u516D");
    _5FidJsp0_3AdateCalendarVar.dateFormatSymbols.shortMonths = new Array("1\u6708","2\u6708","3\u6708","4\u6708","5\u6708","6\u6708","7\u6708","8\u6708","9\u6708","10\u6708","11\u6708","12\u6708");
    _5FidJsp0_3AdateCalendarVar.dateFormatSymbols.months = new Array("\u4E00\u6708","\u4E8C\u6708","\u4E09\u6708","\u56DB\u6708","\u4E94\u6708","\u516D\u6708","\u4E03\u6708","\u516B\u6708","\u4E5D\u6708","\u5341\u6708","\u5341\u4E00\u6708","\u5341\u4E8C\u6708");
    _5FidJsp0_3AdateCalendarVar.dateFormatSymbols.eras = new Array("\u897F\u5143\u524D","\u897F\u5143");
    _5FidJsp0_3AdateCalendarVar.dateFormatSymbols.ampms = new Array("\u4E0A\u5348","\u4E0B\u5348");
    _5FidJsp0_3AdateCalendarVar.init(document.getElementById('_idJsp0:dateSpan'));
    //--></script><input type="button" onclick="_5FidJsp0_3AdateCalendarVar._popUpCalendarForInputDate('_idJsp0:date','yy'&#24180;'M'&#26376;'d'&#26085;'');" value="..." /></span></td><td></td></tr>
    <tr><td>Stock Code</td><td><input id="_idJsp0:stockCd" name="_idJsp0:stockCd" type="text" value="0" size="4" dir="RTL" tabindex="5" /></td><td></td></tr>
    <tr><td>Quantity</td><td><input id="_idJsp0:qty" name="_idJsp0:qty" type="text" value="0.0" size="8" dir="RTL" tabindex="6" /></td><td></td></tr>
    <tr><td>Unit Price</td><td><input id="_idJsp0:unitPrice" name="_idJsp0:unitPrice" type="text" value="$0.000" size="8" dir="RTL" tabindex="7" /></td><td></td></tr>
    <tr><td>Brokerage</td><td><input id="_idJsp0:brokerage" name="_idJsp0:brokerage" type="text" value="$0.00" size="8" dir="RTL" tabindex="8" /></td><td></td></tr>
    <tr><td>Levy Fee</td><td><input id="_idJsp0:levy" name="_idJsp0:levy" type="text" value="$0.00" size="8" dir="RTL" tabindex="9" /></td><td></td></tr>
    <tr><td>Stamp Duty</td><td><input id="_idJsp0:stampDuty" name="_idJsp0:stampDuty" type="text" value="$0.00" size="8" dir="RTL" tabindex="10" /></td><td></td></tr>
    <tr><td>Trading Fee</td><td><input id="_idJsp0:tradingFee" name="_idJsp0:tradingFee" type="text" value="$0.00" size="8" dir="RTL" tabindex="11" /></td><td></td></tr>
    <tr><td>Investment Compensation Levy</td><td><input id="_idJsp0:invCompLevy" name="_idJsp0:invCompLevy" type="text" value="$0.00" size="8" dir="RTL" tabindex="12" /></td><td></td></tr>
    <tr><td>Handling Charge</td><td><input id="_idJsp0:handlingChrg" name="_idJsp0:handlingChrg" type="text" value="$0.00" size="8" dir="RTL" tabindex="13" /></td><td></td></tr>
    <tr><td>Deposit Charge</td><td><input id="_idJsp0:depositChrg" name="_idJsp0:depositChrg" type="text" value="$0.00" size="8" dir="RTL" tabindex="14" /></td><td></td></tr>
    </tbody></table>
                   <input type="hidden" name="_idJsp0_SUBMIT" value="1" /><input type="hidden" name="_idJsp0:_link_hidden_" /><input type="hidden" name="_idJsp0:_idcl" /><script type="text/javascript"><!--
         function clear__5FidJsp0()
              clearFormHiddenParams__idJsp0('_idJsp0');
         function clearFormHiddenParams__idJsp0(currFormName)
              var f = document.forms['_idJsp0'];
              f.elements['_idJsp0:_link_hidden_'].value='';
              f.elements['_idJsp0:_idcl'].value='';
              f.target='';
         clearFormHiddenParams__idJsp0();
    //--></script><input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="rO0ABXVyABNbTGphdmEubGFuZy5PYmplY3Q7kM5YnxBzKWwCAAB4cAAAAAN0AAIxM3B0ABovcGFnZXMvYWRkX3RyYW5zYWN0aW9uLmpzcA==" /></form>
         <!-- MYFACES JAVASCRIPT -->
    <script type="text/javascript"><!--
         function getScrolling()
              var x = 0; var y = 0;if (self.pageXOffset || self.pageYOffset)
                   x = self.pageXOffset;
                   y = self.pageYOffset;
              else if ((document.documentElement && document.documentElement.scrollLeft)||(document.documentElement && document.documentElement.scrollTop))
                   x = document.documentElement.scrollLeft;
                   y = document.documentElement.scrollTop;
              else if (document.body)
                   x = document.body.scrollLeft;
                   y = document.body.scrollTop;
              return x + "," + y;
    //--></script>
    </body>     
    </html>

    i am having the same problem
    I have a page with three use of input date tomahawk
    2 of them sometimes work as expected (i.e. the calendar appear beside the icon), 1 of them never work (the calendar shows up like 1/2 screen below the icon)

  • Problem to open URL link within hx:outputLinkEx

    Hello,
    I have a problem to open a URL with the following code, I can see that url output string is "www.lalalala.com" , but after I click it, the new opened browser window is point to "http://localhost:9081/.../www.lalalala.com" ??
    Can someone help me why?
    Thanks a lot!
    <odc:bfPanel
                        name="URL" showFinishCancelButton="false">
              <hx:panelBox>
                  <hx:outputLinkEx styleClass="outputLinkEx"
                        value="#{pc_UrlWebsite.url}" target="_blank">
                        <h:outputText   value="#{pc_UrlWebsite.url}"></h:outputText>
                  </hx:outputLinkEx>                                                            
              </hx:panelBox>
           </odc:bfPanel>

    External links are links which goes outside your web container root.
    Imagine you're sitting in http://example.com/webapp/page.jsf, then the webroot is http://example.com/webapp.
    If you specify a link without a protocol (http, https, ftp, file, etc), then the client will always assume that you're linking to a resource in your web container. So when page.jsf links to a resource called "www.google.com", without the protocol, then the client will assume that you're referring to http://example.com/webapp/www.google.com. If you prefix it with a valid protocol, e.g. "http://www.google.com", then the client will assume that you're referring to http://www.google.com.
    After all .. In your case this is not applicable. You're using commandlinks instead of outputlinks. Why are you asking this? Which problems are you occurring? Do you want to submit to an external URL or so?

  • Problem with Non JSF Request to JSF Page

    Hi All,
    I am working on dynamic controls generation based on the request come from non jsf page
    For the first request, pageworks perfectly. but when we go for second request, it is not rendering and I am getting same old page.
    What I have identified is if I have 2 pages as JSF, application is not giving any problem.
    For this I have written small test application contains both JSF pages only.
    page1 contains 3 submit buttons.
    When submit buttons are clicked based on the request, I get, am able to see the dynamic controls.
    SO there is no problem with JSF PAGE to JSF Page Communication
    Now I have done some changes in First JSF page. Instead of submitting directly I am submitting the page through JavaScript which is nonb JSF request. There I am facing the problem and based on requested qaction I am not able to see correct rendered page based on the requested action.
    Any Idea why it is giving problem for non JSF requests??
    Thanks
    Sudhakar

    For Your Convenience in understanding the problem
    I am pasting entire test code
    Page 1 -- (here page2 is Page1 and Page1 is page2 - some naming convention errors :) )
    <?xml version="1.0" encoding="UTF-8"?>
    <jsp:root version="1.2" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:jsp="http://java.sun.com/JSP/Page">
        <jsp:directive.page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"/>
        <jsp:text><![CDATA[
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    ]]></jsp:text>
        <f:view>
            <html lang="en-US" xml:lang="en-US">
                <head>
                    <meta content="no-cache" http-equiv="Cache-Control"/>
                    <meta content="no-cache" http-equiv="Pragma"/>
                    <title>Page2 Title</title>
                    <link href="resources/stylesheet.css" rel="stylesheet" type="text/css"/>
                </head>
                <body style="-rave-layout: grid">
                    <h:form binding="#{Page2.form1}" id="form1">
    <!-- Non JSF REquests -->
                        <h:commandButton action="#{Page2.button1_action}" binding="#{Page2.button1}" id="button1" style="left: 48px; top: 48px; position: absolute" value="Submit" onclick="document.forms['form1'].action='faces/Page2.jsp?id=1'; document.forms['form1'].submit(); return false;"/>
                        <h:commandButton action="#{Page2.button2_action}" binding="#{Page2.button2}" id="button2" style="left: 48px; top: 96px; position: absolute" value="Submit" onclick="document.forms['form1'].action='faces/Page2.jsp?id=2'; document.forms['form1'].submit(); return false;"/>
                        <h:commandButton action="#{Page2.button3_action}" binding="#{Page2.button3}" id="button3" style="left: 48px; top: 144px; position: absolute" value="Submit" onclick="document.forms['form1'].action='faces/Page2.jsp?id=3'; document.forms['form1'].submit(); return false;"/>
    <!-- this  is JSF request -->
                        <!--
                        <h:commandButton action="#{Page2.button1_action}" binding="#{Page2.button1}" id="button1" style="left: 48px; top: 48px; position: absolute" value="Submit" />
                        <h:commandButton action="#{Page2.button2_action}" binding="#{Page2.button2}" id="button2" style="left: 48px; top: 96px; position: absolute" value="Submit" />
                        <h:commandButton action="#{Page2.button3_action}" binding="#{Page2.button3}" id="button3" style="left: 48px; top: 144px; position: absolute" value="Submit" />-->
                    </h:form>
                </body>
            </html>
        </f:view>
    </jsp:root>Page1 Bean
    * Page2.java
    * Created on June 25, 2005, 11:08 AM
    * Copyright user
    package webapplication8;
    import javax.faces.*;
    import com.sun.jsfcl.app.*;
    import javax.faces.component.html.*;
    import javax.faces.context.ExternalContext;
    import javax.faces.context.FacesContext;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import javax.servlet.http.HttpSession;
    public class Page2 extends AbstractPageBean {
        // <editor-fold defaultstate="collapsed" desc="Creator-managed Component Definition">
        private int __placeholder;
        private HtmlForm form1 = new HtmlForm();
        public HtmlForm getForm1() {
            return form1;
        public void setForm1(HtmlForm hf) {
            this.form1 = hf;
        private HtmlCommandButton button1 = new HtmlCommandButton();
        public HtmlCommandButton getButton1() {
            return button1;
        public void setButton1(HtmlCommandButton hcb) {
            this.button1 = hcb;
        private HtmlCommandButton button2 = new HtmlCommandButton();
        public HtmlCommandButton getButton2() {
            return button2;
        public void setButton2(HtmlCommandButton hcb) {
            this.button2 = hcb;
        private HtmlCommandButton button3 = new HtmlCommandButton();
        public HtmlCommandButton getButton3() {
            return button3;
        public void setButton3(HtmlCommandButton hcb) {
            this.button3 = hcb;
        // </editor-fold>
        public Page2() {
            // <editor-fold defaultstate="collapsed" desc="Creator-managed Component Initialization">
            try {
            } catch (Exception e) {
                log("Page2 Initialization Failure", e);
                throw e instanceof javax.faces.FacesException ? (FacesException) e: new FacesException(e);
            // </editor-fold>
            // Additional user provided initialization code
        protected webapplication8.ApplicationBean1 getApplicationBean1() {
            return (webapplication8.ApplicationBean1)getBean("ApplicationBean1");
        protected webapplication8.SessionBean1 getSessionBean1() {
            return (webapplication8.SessionBean1)getBean("SessionBean1");
         * Bean cleanup.
        protected void afterRenderResponse() {
        public String button1_action()  throws Exception{
            // TODO Following code was replaced by static navigation
           getSessionBean1().setId(1);       
          /* ExternalContext ctx=(ExternalContext)FacesContext.getCurrentInstance().getExternalContext();
           HttpServletRequest req=(HttpServletRequest)ctx.getRequest();
           HttpServletResponse res=(HttpServletResponse)ctx.getResponse();
           res.sendRedirect("http://localhost:18080/webapplication8/faces/Page2.jsp");
           return null;*/
            return "case1";
        public String button2_action()  throws Exception{
            // TODO Following code was replaced by static navigation
                getSessionBean1().setId(2);
          /*  ExternalContext ctx=(ExternalContext)FacesContext.getCurrentInstance().getExternalContext();
           HttpServletRequest req=(HttpServletRequest)ctx.getRequest();
           HttpServletResponse res=(HttpServletResponse)ctx.getResponse();
           res.sendRedirect("http://localhost:18080/webapplication8/faces/Page2.jsp");
           return null;*/
            return "case2";
        public String button3_action() throws Exception{
            // TODO Following code was replaced by static navigation
                getSessionBean1().setId(3);
            /*    ExternalContext ctx=(ExternalContext)FacesContext.getCurrentInstance().getExternalContext();
           HttpServletRequest req=(HttpServletRequest)ctx.getRequest();
           HttpServletResponse res=(HttpServletResponse)ctx.getResponse();
           res.sendRedirect("http://localhost:18080/webapplication8/faces/Page2.jsp");
            return null;*/
            return "case3";
    }page 2
    <?xml version="1.0" encoding="UTF-8"?>
    <jsp:root version="1.2" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:jsp="http://java.sun.com/JSP/Page">
        <jsp:directive.page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"/>
        <jsp:text><![CDATA[
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    ]]></jsp:text>
        <f:view>
            <html lang="en-US" xml:lang="en-US">
                <head>
                    <meta content="no-cache" http-equiv="Cache-Control"/>
                    <meta content="no-cache" http-equiv="Pragma"/>
                    <title>Page1 Title</title>
                    <link href="resources/stylesheet.css" rel="stylesheet" type="text/css"/>
                </head>
                <body style="-rave-layout: grid">
                    <h:form binding="#{Page1.form1}" id="form1">
                        <h:panelGrid binding="#{Page1.gridPanel1}" id="gridPanel1" style="left: 96px; top: 48px; position: absolute"/>
                        <f:selectItems binding="#{Page1.radioButtonList1SelectItems1}" id="radioButtonList1SelectItems1"/>
                        <h:commandButton action="#{Page1.button1_action}" binding="#{Page1.button1}" id="button1"
                            style="left: 384px; top: 120px; position: absolute" value="Submit"/>
                        <h:commandButton action="#{Page1.button1_action}" binding="#{Page1.button1}" id="button1" style="left: 384px; top: 72px; position: absolute" value="Submit"/>
                        <h:outputLink binding="#{Page1.hyperlink1}" id="hyperlink1" style="left: 480px; top: 216px; position: absolute" value="http://www.sun.com/jscreator">
                            <h:outputText binding="#{Page1.hyperlink1Text}" id="hyperlink1Text" value="Hyperlink"/>
                        </h:outputLink>
                        <h:commandLink binding="#{Page1.linkAction1}" id="linkAction1" style="left: 456px; top: 264px; position: absolute">
                            <h:outputText binding="#{Page1.linkAction1Text}" id="linkAction1Text" value="Link Action"/>
                        </h:commandLink>
                    </h:form>
                </body>
            </html>
        </f:view>
    </jsp:root>page2 bean
    * Page1.java
    * Created on June 25, 2005, 10:52 AM
    * Copyright user
    package webapplication8;
    import javax.faces.*;
    import com.sun.jsfcl.app.*;
    import com.sun.jsfcl.data.DefaultSelectItemsArray;
    import java.util.Vector;
    import javax.faces.component.UIComponent;
    import javax.faces.component.UISelectItems;
    import javax.faces.component.html.*;
    import javax.faces.context.ExternalContext;
    import javax.faces.context.FacesContext;
    import javax.faces.el.ValueBinding;
    import javax.faces.model.SelectItem;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    public class Page1 extends AbstractPageBean {
        // <editor-fold defaultstate="collapsed" desc="Creator-managed Component Definition">
        private int __placeholder;
        private HtmlForm form1 = new HtmlForm();
        public HtmlForm getForm1() {
            return form1;
        public void setForm1(HtmlForm hf) {
            this.form1 = hf;
        private HtmlPanelGrid gridPanel1 = new HtmlPanelGrid();
        public HtmlPanelGrid getGridPanel1() {
            return gridPanel1;
        public void setGridPanel1(HtmlPanelGrid hpg) {
            this.gridPanel1 = hpg;
        private HtmlCommandButton button1 = new HtmlCommandButton();
        public HtmlCommandButton getButton1() {
            return button1;
        public void setButton1(HtmlCommandButton hcb) {
            this.button1 = hcb;
        private HtmlOutputLink hyperlink1 = new HtmlOutputLink();
        public HtmlOutputLink getHyperlink1() {
            return hyperlink1;
        public void setHyperlink1(HtmlOutputLink hol) {
            this.hyperlink1 = hol;
        private HtmlOutputText hyperlink1Text = new HtmlOutputText();
        public HtmlOutputText getHyperlink1Text() {
            return hyperlink1Text;
        public void setHyperlink1Text(HtmlOutputText hot) {
            this.hyperlink1Text = hot;
        private HtmlCommandLink linkAction1 = new HtmlCommandLink();
        public HtmlCommandLink getLinkAction1() {
            return linkAction1;
        public void setLinkAction1(HtmlCommandLink hcl) {
            this.linkAction1 = hcl;
        private HtmlOutputText linkAction1Text = new HtmlOutputText();
        public HtmlOutputText getLinkAction1Text() {
            return linkAction1Text;
        public void setLinkAction1Text(HtmlOutputText hot) {
            this.linkAction1Text = hot;
        // </editor-fold>
        public Page1() {
            // <editor-fold defaultstate="collapsed" desc="Creator-managed Component Initialization">
            try {
                ExternalContext ctx=(ExternalContext)FacesContext.getCurrentInstance().getExternalContext();
                HttpServletRequest req=(HttpServletRequest)ctx.getRequest();
                HttpServletResponse res=(HttpServletResponse)ctx.getResponse();
                String id=req.getParameter("id");
                if(id!=null)
                    getSessionBean1().setId(Integer.parseInt(id));
                if (getSessionBean1().getId()==1) {
                    addTextBox();
                else if (getSessionBean1().getId()==2) {
                    addCheckBox();
                    addRadio();
                else if (getSessionBean1().getId()==3) {
                    addRadio();
                   // addCheckBox();
            } catch (Exception e) {
                log("Page1 Initialization Failure", e);
                throw e instanceof javax.faces.FacesException ? (FacesException) e: new FacesException(e);
            // </editor-fold>
            // Additional user provided initialization code
        protected webapplication8.ApplicationBean1 getApplicationBean1() {
            return (webapplication8.ApplicationBean1)getBean("ApplicationBean1");
        protected webapplication8.SessionBean1 getSessionBean1() {
            return (webapplication8.SessionBean1)getBean("SessionBean1");
         * Bean cleanup.
        protected void afterRenderResponse() {
        private void addRadio() {
            HtmlPanelGrid gridPanel = new HtmlPanelGrid();
            UIComponent parent = gridPanel1;
            HtmlOutputText outputText = new HtmlOutputText();
            outputText.setValue("Some Desc");
            outputText.setId("somedesc2");
            HtmlSelectOneRadio checkBox = new HtmlSelectOneRadio();
            checkBox.setBorder(0);
            checkBox.setLayout("pageDirection");
            checkBox.setId("a3");
            UISelectItems items = new UISelectItems();
            DefaultSelectItemsArray objArray =new DefaultSelectItemsArray();
            vectDefaultSelectItemsArray.add(objArray);
            arrays=(DefaultSelectItemsArray[])vectDefaultSelectItemsArray.toArray(new DefaultSelectItemsArray[vectDefaultSelectItemsArray.size()]);
            int size =arrays.length;
            arrays[size - 1].clear();
            for (int i =0;i<10;i++) {
                arrays[size - 1].add(new SelectItem(""+i+"",""+i));
            // array.setItems(new String[] {"Yes","No" });
            items.setValueBinding("value",getValueBinding("#{Page1.arrays["+(size-1)+"]}"));
            checkBox.getChildren().add(items);
            gridPanel.getChildren().add(outputText);
            gridPanel.getChildren().add(checkBox);
            parent.getChildren().add(gridPanel);
        private void addCheckBox() {
            HtmlPanelGrid gridPanel = new HtmlPanelGrid();
            UIComponent parent = gridPanel1;
            HtmlOutputText outputText = new HtmlOutputText();
            outputText.setValue("Some Desc");
            outputText.setId("somedesc1");
            HtmlSelectManyCheckbox checkBox = new HtmlSelectManyCheckbox();
            checkBox.setBorder(0);
            checkBox.setLayout("pageDirection");
            checkBox.setId("a2");
            UISelectItems items = new UISelectItems();
            DefaultSelectItemsArray objArray =new DefaultSelectItemsArray();
            vectDefaultSelectItemsArray.add(objArray);
            arrays=(DefaultSelectItemsArray[])vectDefaultSelectItemsArray.toArray(new DefaultSelectItemsArray[vectDefaultSelectItemsArray.size()]);
            int size =arrays.length;
            arrays[size - 1].clear();
            for (int i =0;i<10;i++) {
                arrays[size - 1].add(new SelectItem(""+i+"",""+i));
            // array.setItems(new String[] {"Yes","No" });
            items.setValueBinding("value",getValueBinding("#{Page1.arrays["+(size-1)+"]}"));
            checkBox.getChildren().add(items);
            gridPanel.getChildren().add(outputText);
            gridPanel.getChildren().add(checkBox);
            parent.getChildren().add(gridPanel);
        private void addTextBox() {
            HtmlPanelGrid gridPanel = new HtmlPanelGrid();
            UIComponent parent = gridPanel1;
            HtmlOutputText outputText = new HtmlOutputText();
            outputText.setValue("Some Description for Control Text Box");
            outputText.setId("somedesc");
            HtmlInputText textField = new HtmlInputText();
            //  textField.setId("textField_"+control.getId());
            textField.setId("a1");
            HtmlOutputText outputText1 = new HtmlOutputText();
            hyperlink1Text.setValue(" ");
            hyperlink1Text.setStyleClass("bodyText");
            textField.setStyleClass("frmObjects");
            gridPanel.setColumns(3);
            gridPanel.getChildren().add(outputText);
            gridPanel.getChildren().add(hyperlink1Text);
            gridPanel.getChildren().add(textField);
            parent.getChildren().add(gridPanel);
        private DefaultSelectItemsArray array = new DefaultSelectItemsArray();
        public DefaultSelectItemsArray getArray() {
            return array;
        public void setArray(DefaultSelectItemsArray dsia) {
            this.array = dsia;
        private Vector vectDefaultSelectItemsArray = new Vector();
        private DefaultSelectItemsArray[] arrays = new DefaultSelectItemsArray[10];
        public DefaultSelectItemsArray[] getArrays() {
            return arrays;
        public void setArrays(DefaultSelectItemsArray[]dsia) {
            this.arrays = dsia;
        private UISelectItems radioButtonList1SelectItems1 = new UISelectItems();
        public UISelectItems getRadioButtonList1SelectItems1() {
            return radioButtonList1SelectItems1;
        public void setRadioButtonList1SelectItems1(UISelectItems uisi) {
            this.radioButtonList1SelectItems1 = uisi;
        private ValueBinding getValueBinding(String expression) {
            return     FacesContext.getCurrentInstance().getApplication().createValueBinding(expression);
        public String button1_action() {
            // TODO Replace with your code
            return "case1";
    }my navigation.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN"
                                  "http://java.sun.com/dtd/web-facesconfig_1_0.dtd">
    <faces-config>
        <navigation-rule>
            <from-view-id>/Page2.jsp</from-view-id>
            <navigation-case>
                <from-outcome>case1</from-outcome>
                <to-view-id>/Page1.jsp</to-view-id>
            </navigation-case>
            <navigation-case>
                <from-outcome>case2</from-outcome>
                <to-view-id>/Page1.jsp</to-view-id>
            </navigation-case>
            <navigation-case>
                <from-outcome>case3</from-outcome>
                <to-view-id>/Page1.jsp</to-view-id>
            </navigation-case>
        </navigation-rule>
        <navigation-rule>
            <from-view-id>/Page1.jsp</from-view-id>
            <navigation-case>
                <from-outcome>case1</from-outcome>
                <to-view-id>/Page2.jsp</to-view-id>
            </navigation-case>
        </navigation-rule>
    </faces-config>my managed beans xml
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN"
                                  "http://java.sun.com/dtd/web-facesconfig_1_0.dtd">
    <faces-config>
        <managed-bean>
            <managed-bean-name>Page1</managed-bean-name>
            <managed-bean-class>webapplication8.Page1</managed-bean-class>
            <managed-bean-scope>request</managed-bean-scope>
        </managed-bean>
        <managed-bean>
            <managed-bean-name>SessionBean1</managed-bean-name>
            <managed-bean-class>webapplication8.SessionBean1</managed-bean-class>
            <managed-bean-scope>session</managed-bean-scope>
        </managed-bean>
        <managed-bean>
            <managed-bean-name>ApplicationBean1</managed-bean-name>
            <managed-bean-class>webapplication8.ApplicationBean1</managed-bean-class>
            <managed-bean-scope>application</managed-bean-scope>
        </managed-bean>
        <managed-bean>
            <managed-bean-name>Page2</managed-bean-name>
            <managed-bean-class>webapplication8.Page2</managed-bean-class>
            <managed-bean-scope>request</managed-bean-scope>
        </managed-bean>
        <managed-bean>
    </faces-config>

  • Html outputlink  in datatble

    Hi, in JSF,in a datatable i am using <h:outputLink> for a column..
    and i am using some events for security purpose..
    For example
    <h:commandButton id="btn4grpnam" value="Group Name"
         action="masterfaqsublist" event="faq.addgroup"
         styleClass="submitBtn"/>
    if user have access to next page where this particular command button leads to,the command button will be displayed..or else button won't get displayed..
    the same i tried to use for <h:outputLink> (if user have acces label will be displayed with hyperlink or else simply label will get displayed)
    <h:outputLink id="faq_html_id" event="faq.update"
         value="masterfaqadd.jsp">
    but it is not working... is event attribute does not support for outputlink????
    and if inplace of <h:outputlink> if i use <h:commandlink> its working
    with event but the problem is <h:commandlink is not supporting actions.
    can anybody suggest alternate???????
    thanks in advance,
    saranya

    Use the rendered attribute.
    But: "h:commandlink is not supporting actions". It supports.
    What is the problem? <h:commandLink action="masterfaqadd.jsp"> should work.

  • Problems in Opening Any File in IE 5.5?

    The problem is that if you run on IE, what you will see is that when the user clicks on an Excel/Word/any file to open it. The excel file opens directly in the browser. This 'emulation' of excel... in the
    browser does not work. In other words, it seems to me that, in Netscape, by default, it uses an "External Viewer" to open files according to the following code (namely, files can be opened completely in a separate window!). The very same code in IE 5.5, however, uses an "Internal Viewer" to open the files (namely, only open inside a frame, not in a separate window. So half way only!). How to fix the code slightly to make it work equally well in IE 5.5?
    Thanks millions! The code is attached here.
    Helena
    function drawFolder(leftSide)
    if (browserVersion == 2) {
    if (!doc.yPos)
    doc.yPos=8
    doc.write("<layer id='folder" + this.id + "' top=" + doc.yPos + " visibility=hiden>")
    doc.write("<table ")
    if (browserVersion == 1)
    doc.write(" id='folder" + this.id + "' style='position:block;' ")
    doc.write(" border=0 cellspacing=0 cellpadding=0>")
    doc.write("<tr><td>")
    doc.write(leftSide)
    this.outputLink()
    doc.write("<img name='folderIcon" + this.id + "' ")
    doc.write("src='" + this.iconSrc+"' border=0></a>")
    doc.write("</td><td valign=middle nowrap>")
    if (USETEXTLINKS)
    this.outputLink()
    doc.write(this.desc + "</a>")
    else
    doc.write(this.desc)
    doc.write("</td>")
    doc.write("</table>")
    if (browserVersion == 2) {
    doc.write("</layer>")
    if (browserVersion == 1) {
    this.navObj = doc.all["folder"+this.id]
    this.iconImg = doc.all["folderIcon"+this.id]
    this.nodeImg = doc.all["nodeIcon"+this.id]
    } else if (browserVersion == 2) {
    this.navObj = doc.layers["folder"+this.id]
    this.iconImg = this.navObj.document.images["folderIcon"+this.id]
    this.nodeImg = this.navObj.document.images["nodeIcon"+this.id]
    doc.yPos=doc.yPos+this.navObj.clip.height
    function outputFolderLink()
    if (this.hreference)
    doc.write("<a href='" + this.hreference + "' TARGET=\"main\" ")
    if (browserVersion > 0)
    doc.write("onClick='javascript:clickOnFolder("+this.id+")'")
    doc.write(">")
    else
    doc.write("<a>")
    // doc.write("<a href='javascript:clickOnFolder("+this.id+")'>")
    }

    It's like this:
    Nothing you do in the HTML or JavaScript in the browser or on the server will change what the browser does with a given file type. Any browser will do one of 3 things, in this order, with any given file:
    1) Determine if the browser can display the file itself, such as for HTML files or certain image types. If so, it displays it.
    2) Else, determine if there is a registered plug-in to handle that specific file type. If so, load the plug-in and give it the file.
    3) Else, ask the user to save the file or select an external application to view the file, or cancel (don't download).
    Using blank as a target for links does nothing to change this behavior.  All blank targets do is tell the browser to open a new browser window and "open" the link URL in that new browser window, as opposed to opening in the same window. It still goes thru the same 3 steps, regardless.
    Later versions of Excel and Word will, in effect, register as plug-ins for IE, but not for Netscape. Because of this, those file types will open in Excel or Word inside the browser window, as a plug-in. This plug-in mode is still the same as the standalone version of the program. Unless there are settings in Excel or Word to unregister this plug-in mode, then there's nothing you can do. But these settings would not be changeable by the web server or web page, the user would have to change it themselves, if they can/want.
    The ONLY other option is to rename the file extension (cuz IE often ignores mime-type and uses extension) and use "application/octet-stream" as the mime-type of the file, from the server. The effect is that the browser will ask the user to save it, where they would have to rename it to the right extension.
    My recommended solution:
    I'm assuming that foremost, you don't want the user to have to leave the page the links are on. This is why you use the _blank target.  This will pass the file or link to a new browser window.  Beyond that, you have no other control what happens.  Are you assuming/enforcing somehow that all users are using IE, and they have Excel or Word installed in the first place?  Or that they are newer versions which even have this plug-in capability.  There's no true way to enforce what I think you think you want to do.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         

  • H:outputLink tag whitespace

    Hello,
    I've found that the <h:outputLink> tag, when rendering HTML, follows the closing </a> with lots of whitespace - some line breaks and tabs. I'm not sure if this problem is specific to the particular JSF implementation I'm using (WebSphere Portal v5.1 JSF Portlet).
    This is a problem because we need some of our links to be immediately followed by a period. With any whitespace there, the browser renders a single space between the link and the period.
    Any ideas on how to fix this?
    Thanks

    Adding the CSS style of "whitespace: normal;" doesn't really do anything, since it's the normal way the browser interprets whitespace - multiple continguous whitespace in the HTML gets rendered as a single space. What I need is to not have any spaces rendered.
    It's too bad there isn't a CSS style that makes whitespace in the HTML completely ignored.
    I'm still looking for a solution here. I could probably take out the h:outputLink tag and just use an <a href=" in my JSP, but I would much prefer to use a JSF tag if possible. Especially since this kind of situation appears in many places in our application.

  • JSF PROBLEM With Weblogic

    hello All,
    If I Put this Code in Our JSF File then Weblogic Server Will Go Down.i don't know what the problem in this Code .
    if Any one know please reply me.
    thanks
    reetesh
    <h:panelGroup style="width:30%">
                                  <t:div styleClass="recommendationListDiv">
                                       <h:outputLink styleClass="listicon-book" value="#">
                                            <f:verbatim>Business Plans Made Simple</f:verbatim>
                                       </h:outputLink>
                                       <t:htmlTag value="br"></t:htmlTag>
                                       <h:outputLabel value="#{appMsg.author}" styleClass="subheader"
                                            rendered="true"></h:outputLabel>
                                       <h:outputLabel value="reetesh1 yadav">
                                       </h:outputLabel>
                                       <t:htmlTag value="br"></t:htmlTag>     
                                       <jsp:include page="help.jsp"></jsp:include>
                                       <h:outputLabel value="#{appMsg.publisher}" styleClass="subheader"
                                            rendered="true"></h:outputLabel>
                                       <h:outputLabel value="reetesh1 yadav">
                                       </h:outputLabel>
                                       <h:outputLabel value="#{appMsg.publisher}" styleClass="subheader"
                                            rendered="true">
                                       </h:outputLabel>
                                       <h:outputLabel value="reetesh1 yadav">
                                       </h:outputLabel>
                                  </t:div>
                             </h:panelGroup>

    Logs?

  • Page navigation problems

    Hi all,
    I am new to JSF, and I am trying to implement a simple page navigation which displays some values that the user entered. The values are stored in a managed bean. It's a simple login form. I am using NetBeans as my IDE. My page navigation is set up as follows:
    <?xml version="1.0" encoding="UTF-8"?>
    <faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
    <navigation-rule>
    <from-view-id>/index.jsp</from-view-id>
    <navigation-case>
    <from-outcome>login</from-outcome>
    <to-view-id>/login.jsp</to-view-id>
    </navigation-case>
    </navigation-rule>
    </faces-config>
    And my JSF page is setup as follows:
    <?xml version="1.0" encoding="UTF-8"?>
    <jsp:root version="1.2" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:webuijsf="http://www.sun.com/webui/webuijsf">
    <jsp:directive.page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"/>
    <f:view>
    <webuijsf:page binding="#{index.page1}" id="page1">
    <webuijsf:html binding="#{index.html1}" id="html1">
    <webuijsf:head binding="#{index.head1}" id="head1">
    <webuijsf:link binding="#{index.link1}" id="link1" url="/resources/stylesheet.css"/>
    </webuijsf:head>
    <webuijsf:body binding="#{index.body1}" id="body1" style="-rave-layout: grid">
    <webuijsf:form binding="#{index.form1}" id="form1">
    <webuijsf:staticText binding="#{index.staticText1}" id="staticText1" style="position: absolute; left: 144px; top: 72px" text="Enter user name:"/>
    <webuijsf:staticText binding="#{index.staticText2}" id="staticText2" text="Enter password:" />
    <h:inputText binding="#{user.name}" id="txtUsername" />
    <h:inputText binding="#{user.password}" id="txtPass" />
    <h:commandButton action="login" binding="#{index.btnLogin}" id="btnLogin" value="Log in"/>
    <h:inputText binding="#{index.txtUsername}" id="txtUsername"/>
    <h:inputText binding="#{index.txtPass}" id="txtPass"/>
    </webuijsf:form>
    </webuijsf:body>
    </webuijsf:html>
    </webuijsf:page>
    </f:view>
    </jsp:root>
    The web application compiles and deploys with no problem. However, when I click the btnSubmit button, it does not redirect me to the page specified in the faces-config.xml file. Can anyone tell me what I'm doing wrong? Thanks for any help you can provide.

    I'm not sure what you are trying to do here.
    Are you trying to map the commandButton's action="login" to your rule <from-outcome>login</from-outcome>?
    I think you want the commandButton to map to a method in your backing bean. E.g. action="#{bean.goToLogin}" .
    The method goToLogin() should then return the string, "login" . This will be caught by your navigation rule <from-outcome>.
    <from-outcome> maps to a specific string returned from a method called in that page.
    But in this case if you just want redirection, it should be easier just an outputLink pointing to login.jsp.
    Hope this helps!

  • How to add mailto using outputLink

    Hi,
    I am creating a dynamic Table where Email address field is getting added dynamically.I need to know how can i add mailto with the email address.
    I am doing following steps but it is appending the complete URL of the application before mailto:emailadress.
    <h:outputLink value="mailto:#{emp.jobInfo.email}" id="emailLink">
    <h:outputText value="#{emp.jobInfo.email}" />
    </outputLink>
    The output comes as http://servername:port/context path/mailto:emailadress
    Looks like outputLink default adds the context path to the URL and to remove the context path we can add forward slash to remove the same.
    I did some testing and found if i add 3 forward slashes infront of mailto the output i received is much better. http:///mailto:emailaddress . But still http:/// is still coming with the mailto and email part.I wanted to remove this also.Pls suggest. h:outputLink value="///mailto:#{emp.jobInfo.email}" id="emailLink">
    If somebody has any solution to this problem pls respond.
    Thanks, -Ritu

    It seems strange, but when I do the same, I don't have such problems. I use myFaces implementation of jsf, may be you use another...
    I can suggest not very beutiful solution, but still solution: you can just write
    <h:outputText value="<a href='mailto:#{emp.jobInfo.email}'>#{emp.jobInfo.email}</a>" escape="false" />

  • Encode URL with h:outputLink

    Hi All,
    I have used an output Link to access a servlet.
    But the problem lies in i want to encode my URL. something like
    href='<%= renderResponse.encodeURL(renderRequest.getContextPath() + "/theme/exestyle.css") %>'
    I am currently using the url in the following manner.     
    <h:outputLink value="#{facesContext.externalContext.requestContextPath}/RProcessorServlet" >

    Hi,
    Thanks for replying.
    At a plain jsf level this does not pose a problem at all for me.
    But in our project we use WSRP Portlets.Which has a producer and consumer framework.So any url we hit for file downloading hits the proxy servlet first which rewrites the URL and hits the actual servlet.
    At a higher level this is the architecture we support.
    Its a very simple requirement there is a pdf icon onclick of that i need to download the report from the database.
    I can actually invoke a javascript to handle the url in the following way.
    String encodedURL_dtd = response.encodeURL(request.getContextPath()+ "/DownloadServlet");
    But here i fail to send the row data to the javascript to be send as request parameters.
    So based on a similar post before i used <h:outputLink> in the following manner.
    <h:datatable var="item" value="databean.list" >
    <h:outputLink rendered="#{(item.strreportFormat == 'P') onclick="<context-path>/DownloadServlet">
    <h:graphicImage value="/images/icon/icon_small_pdf.gif" alt="View Reports"></h:graphicImage>
    <f:param id="id1" value="item.id" />
    <f:param id="sys1" value="item.sysName" />
    </h:outputLink>
    </h:datatable>
    I hope i could explain my query...
    Given me a chance i would stick to my jsf application running in the test environment.But things don't work when they go to the framework level.

  • H:outputLink etc strange URL encoding

    If I have an h:outputLink with a value containing spaces, it is rendered with the spaces converted to +.
    It seems to me that if it is going to convert this at all, it should do so correctly, i.e. to %20. Alternatively it should leave it alone and let it fail as originally supplied.
    Am I missing something here?
    I have a legacy content database where the document index provides URLs contain spaces. I can change that, and probably will, but maybe this is a bug and will get fixed the way I would like?
    Comments welcome, especially from @Ed Burns :-)

    Hm, it must be tied to the usage of URLEncoder under the hood.
    http://download.oracle.com/javase/6/docs/api/java/net/URLEncoder.html
    Quote:
    The space character " " is converted into a plus sign.
    Note: this is an assumption on my part that URLEncoder is used; I didn't see any code. But say I am correct, the question would really become: why does URLEncoder do it? Is there even really a problem that + is used over %20?

  • Include file problem

    Hi guys
    i have very stupid kinf of problem , on every page of our application we are including a header
    in ther header file we have a table and a <t:outputText> to show information
    but information jumps out of table
    <table><tr><td>
    <h:outputLink value="manageusers.jsf"> <t:outputText onclick="manageusers.jsf" style="color:black" rendered="#{userbean.nurse.userId == 'admin'}" value="Manage Users" />
    </td></tr></table>
    i have no idea why this is not working

    Hello,
    Questions (not sure about it):
    - is it correct to declare onclick event in outputText and would it not be better to declare it in outputLink itself?
    - end tag </h:outputLink> after .... "Manage Users" /> ?
    Best regards.

Maybe you are looking for

  • IDOC- XI- FILE(s) 1..n mapping problem

    I am working on a IDOC->XI->FILES scenario and am stuck on mapping of idoc segments to output structure. IDOC structure is as following, WBBDLD05 (1..1)      IDOC (1..1)           EDI_DC40 (1..1)           E1WBB01 (1..10000) ... so the idoc being sen

  • Custimizing website name

    Hi, I got the name www.crea-dvd.com from godaddy, and I want that name for my iweb. but dont know where to start. Can anyone help me

  • Regarding the usage of HR_INFOTYPE_OPERATIONS function module in ECM badi i

    Hi All, We have requirement where we need to update the infotype 0015 while implementing the badi 'HRECM00_ACTIVATION'. To achieve this functionality we are calling the HR_INFOTYPE_OPERATION function module to update the infotype 15. But we are getti

  • TV tuner card for G4 digital audio?

    Hi everyone or anyone, I just want a simple PCI card that I can screw my cable into and watch TV on my monitor at a max of 1080i. Seems everything I google is a PC (Windows) card. Isn't there an inexpensive quality card out there that is made for a M

  • Adobe Flash, keep getting "failed to initialize"

    I have done all the recommended things on the blog. I have tried to remove any Adobe Flash that was in the machine(I wonder!). The processes are very complexed so I do wonder. My system is XP 3. I choose to run FireFox. I went through My Juno to no a