Como "converter" componentes form, input do html para jsf+primefaces?

1 resposta
felipehts

Boa tarde pessoal !!
tenho um form para pesquisa no google, e gostaria de utilizar componentes do jsf + primefaces, porém não estou conseguindo fazer essa “conversão”, alguém poderia ajudar??? vlwwwww

COMPONENTE EM HTML:

<form action="busca.xhtml" id="cse-search-box" class="busca">
	    <input type="hidden" name="cx" value="014802881257091924387:smzt-thsc9m" />
	    <input type="hidden" name="cof" value="FORID:10" />
	    <input type="hidden" name="ie" value="UTF-8" />
	    <input class="campo_rounded" type="text" name="q" size="31" tabindex="1" />
	    <input type="image" class="botao" style="border: 0px;" src="img/button.png" tabindex="2"/>
     </form>
         
    <script type="text/javascript" src="http://www.google.com.br/coop/cse/brand?form=cse-search-box&amp;lang=en"></script>

QUERO UTILIZAR AQUI:

<h:form>
      <p:inputText style=" padding: 5px;" />
     <p:commandButton  style="height: 50px" value="Buscar"/>
     </h:form>

SCRIPT UTILIZADO:

(function() {
var f = document.getElementById('cse-search-box');
if (!f) {
f = document.getElementById('searchbox_demo');
}
if (f && f['q']) {
var q = f['q'];
var n = navigator;
var l = location;
var su = function (n, t, v, l) {
if (!encodeURIComponent || !decodeURIComponent) {
return;
}
var u = document.createElement('input');
var regexp = new RegExp('(?:[?&]' + n + '=)([^&#]*)');
var existing = regexp.exec(t);
if (existing) {
v = decodeURIComponent(existing[1]);
}
var delimIndex = v.indexOf('://');
if (delimIndex >= 0) {
v = v.substring(delimIndex + '://'.length, v.length);
}
u.name = n;
var v_sub = v.substring(0, l);
while (encodeURIComponent(v_sub).length > l) {
v_sub = v_sub.substring(0, v_sub.length - 1);
}
u.value = v_sub;
u.type = 'hidden';
f.appendChild(u);
};
var append = false;
if (n.appName == 'Microsoft Internet Explorer') {
var s = f.parentNode.childNodes;
for (var i = 0; i < s.length; i++) {
        if (s[i].nodeName == 'SCRIPT' &&
            s[i].attributes['src'] &&
            s[i].attributes['src'].nodeValue == unescape('http:\x2F\x2Fwww.google.com.br\x2Fcoop\x2Fcse\x2Fbrand?form=cse-search-box\x26amp\x3Blang=en')) {
          append = true;
          break;
        }
      }
    } else {
      append = true;
    }
    if (append) {
      
      var loc = document.location.toString(); var ref = document.referrer;
      su('siteurl', loc, loc, 250);
      su('ref', loc, ref, 750);
    }

    
    if (n.platform == 'Win32') {
      q.style.cssText = 'border: 1px solid #7e9db9; padding: 2px;';
    }

    
    if (window.history.navigationMode) {
      window.history.navigationMode = 'compatible';
    }

    var b = function() {
      if (q.value == '') {
        q.style.background = '#FFFFFF url(http:\x2F\x2Fwww.google.com.br\x2Fcse\x2Fintl\x2Fen\x2Fimages\x2Fgoogle_custom_search_watermark.gif) left no-repeat';
      }
    };

    var f = function() {
      q.style.background = '#ffffff';
    };

    q.onfocus = f;
    q.onblur = b;

    
    if (!/[&?]q=[^&]/.test(l.search)) {
      b();
    }
  }
})();

1 Resposta

diogozero

Seu formulário sem componentes JSF está funcionando?
Se sim, qual seria o motivo de utilizar um componente JSF no lugar dele?

Criado 23 de maio de 2012
Ultima resposta 24 de mai. de 2012
Respostas 1
Participantes 2