2 Replies Latest reply on Sep 18, 2008 9:20 AM by bashan

    calling a servlet with a url different of .seam

    cerdiogenes

      Hi,


      In my application I have a Seam Resource Servlet with the getResourcePath returning /report.pdf, so to access it my url must be http://server:port/mySystem/seam/resource/report.pdf


      The problem is that I want to put a button in my application, son when it's clicked the servlet url is called, but when I click the button the url generated is http://server:port/mySystem/seam/resource/report.seam.


      How can I make the generated url be .pdf? I saw in seam 2.1.0 documentation that it's possible to do url rewriting, there is anything like this in seam 2.0.2 or I must wait for an update?


      I also saw the seam-bay example that does a kind of url on demand, but this doesn't work wiht a seam button.


      Thanks,
      Carlos.

        • 1. Re: calling a servlet with a url different of .seam
          cerdiogenes

          Hi,


          I was able to solve the problem using the a4j:commandButton.


          The solution become this one:


          <h:form>
              <a4j:commandButton value="Resultados da Etapa" title="teste" onclick='location.href="#{facesContext.externalContext.requestContextPath}/seam/resource/report.pdf"'></a4j:commandButton>
          </h:form>



          If someone see any drawback doing this, please, let me know. Oh, I saw one, the button (or the form) broken the line, something that I don't intended.


          Best regards,
          Carlos.

          • 2. Re: calling a servlet with a url different of .seam
            bashan

            It seems ok, though I think you can skip the full url and stay with a relative one:
            take this off:


            #{facesContext.externalContext.requestContextPath}/