Servlet + JSP + XMl

Olá Pessoal, estou precisando de uma ajudinho talves para vcs seje uma coisa simples… bom vamos lá estou tendo que implantar aqui no trabalho um sistema do google onde a propria google nos fornecem, o codigo fonte se que precisamos alterar algumas coisas e como o meu forte não é java estou com um pouco de dificuldade.

O seguinte vou dar o exemplo de uma pagina se conguirem me ajudar acho que consigo resolver as outras…

Intão nessa pagina eu eu chamo um servelt que gera um arquivo XMl e retorna as informações para mesma pagina apos feito isso existe uim botão para eu enviar as informações para um outro frame e assim sucessivamente onde terá um outro botão etc…

O que eu precisa é automatizar isso quando eu acessar essa pagina ela já da esse submit automatico sem que eu precise clicar…

Vou postar o codigo da pagina para vcs terem uma ideia.

[code]<%@page import="util.RequestUtil"%>
<%@page import="java.net.*"%>

<html>
<head>
<meta http-equiv=“content-type” content=“text/html; charset=UTF-8”>
<link href=“global/style.css” type=“text/css” rel=“stylesheet”/>
<title>SAML-based Single Sign-On Service for Google Apps for Your Domain - Test Tool</title>
</head>
<body>
<h1 style=“margin-bottom:6px”>GOOGLE - Service Provider</h1>
<div style=“padding:6px 0px;border-top:solid 1px #3366cc;border-bottom:solid 1px #3366cc”><b>Step 2: Google generates SAML Request</b></div></p>
<p>When an unauthenticated user tries to reach a hosted service, such as Gmail, Google will send a SAML request to the partner, which acts as the identity provider in the SAML transaction. In this step, you can click the <b>Generate SAML Request</b> button, prompting Google to create the SAML request. The request contains four variables:</p>
<p><ul>
<li><b>AUTHN_ID</b> - A 160-bit string containing a string of randomly generated characters.</li>
<li><b>ISSUE_INSTANT</b> - A timestamp indicating the date and time that Google generated the request.</li>
<li><b>PROVIDER_NAME</b> - A string identifying the service provider’s domain (google.com).</li>
<li><b>ACS_URL</b> - The URL that the service provider uses to verify a SAML response. This demo uses the following ACS URL:<br>
<div style=“padding:0px 15px”>https://www.google.com/a/psosamldemo.net/acs</div>
</li>
</ul></p>

&lt;/form&gt;  

<form name="ServiceProviderForm" action="./CreateRequestServlet" method="post">
<input type="hidden" name="txtCR" value="Generate SAML Request">
<input type="hidden" name="returnPage" value="service_provider.jsp">
<p><center><input type="submit" value="Generate SAML Request"></center></form>

&lt;% 
  String error = &#40;String&#41; request.getAttribute&#40;&quot;error&quot;&#41;;
  String authnRequest = &#40;String&#41; request.getAttribute&#40;&quot;authnRequest&quot;&#41;;
  String redirectURL = &#40;String&#41; request.getAttribute&#40;&quot;redirectURL&quot;&#41;;
  if &#40;error != null&#41; &#123;
  %&gt;
    &lt;p&gt;&lt;center&gt;&lt;font color=&quot;red&quot;&gt;&lt;b&gt;&lt;%= error %&gt;&lt;/b&gt;&lt;/font&gt;&lt;/center&gt;&lt;p&gt;
  &lt;%
  &#125; else &#123;
    if &#40;authnRequest != null &amp;&amp; redirectURL != null&#41; &#123;		
  %&gt;
    &lt;p&gt;&lt;div style=&quot;padding&#58;6px 0px;border-top&#58;solid 1px #3366cc;border-bottom&#58;solid 1px #3366cc&quot;&gt;&lt;b&gt;Step 3&#58; Submitting the SAML Request&lt;/b&gt;&lt;/div&gt;&lt;/p&gt;
    &lt;p&gt;You can now review the generated SAML request before submitting it to the identity provider.&lt;/p&gt;
    &lt;p&gt;As noted in the &lt;b&gt;Pre-Transaction Details&lt;/b&gt;, when you install this application, it will send SAML authentication requests to the &lt;b&gt;ProcessResponseServlet&lt;/b&gt;, which is included in the sample code package.&lt;/p&gt;
    &lt;b&gt;Generated SAML XML&lt;/b&gt;&lt;p&gt;
    &lt;input type=&quot;hidden&quot; name=&quot;redirectURL&quot; value=&quot;&lt;%=redirectURL%&gt;&quot;/&gt;
    &lt;div class=&quot;codediv&quot;&gt;&lt;%=RequestUtil.htmlEncode&#40;authnRequest&#41;%&gt;&lt;/div&gt;
    &lt;p&gt;&lt;center&gt;
    
    &lt;input type=&quot;button&quot; value=&quot;Submit AuthnRequest&quot; 
           onclick=&quot;javascript&#58;parent.frames&#91;'identity_provider'&#93;.location = '&lt;%=redirectURL%&gt;';return true;&quot;&gt;
    &lt;/center&gt;
 &lt;%
   &#125;
 &#125;
 %&gt;

</body>
</html> [/code]

Bom pessoal, espero que consigam me ajudar to precisando muito disso…

Falow :wink:

faz assim:

&lt;body onLoad=&quot;javascript&#58; funcaoSubmit&#40;&#41;;&quot;&gt;

aih vc cria uma função JavaScript que faz o submit do form…

espero ter ajudado…

flw

Olá Pedro,

Até funcionou ele me gerou o arquivo xml do primeiro botão mais como essa pagina tem 2 botões o que ta acontecendo eh o seguinte ele esta executando esse 1 submit infinitas vezes e não passa a executar o proximo!

Será que tem alguma forma de resolver?

[]s

eh realmente eh isso q vai acontecer…se o seu Servlet chamado no submit direcionar para a mesma pagina, entra em loop infinito…

o lance eh no metodo do seu Servlet…vc direcionar pra outra pagina…

vc nao vai conseguir fazer o submit de 2 forms simultaneamente…como vc esta falando q o submit tem q ser automatizado…pq vc nao quebra isso em 2 paginas, e 2 metodos no seu Servlet??? ficaria assim…

onLoad da pagina 1 faz o submit do form 1…aih o Servlet direciona pra pagina onde esta o form 2 q no onLoad faz o Submit…e aih direciona pra uma terceira pagina q nao faz nada ou faz o q vc quiser…

espero ter ajudado…

flw

Ok… valeu mesmo Pedro!

Vou ver o que faço aqui então!

Obrigado!