5 Replies Latest reply on Oct 23, 2009 11:11 AM by wouter.oet

    String output

    wouter.oet

      I need to output a String, based on some requestparameters, for a small device that is unable to process webservices.  So I came up with this:


      com.xhtml:



      <h:outputText xmlns:h="http://java.sun.com/jsf/html" value="#{communicator.responce}" /> 



      Communicator.java:



      import org.jboss.seam.annotations.Logger;
      import org.jboss.seam.annotations.Name;
      import org.jboss.seam.annotations.web.RequestParameter;
      import org.jboss.seam.log.Log;
      
      @Name("communicator")
      public class Communicator {
           
           @Logger Log log;
           @RequestParameter String xml;
           
           public String getResponce()
           {
                log.info("communicator.getResponce()", xml);
                // calculation
                return "resultBasedOnRequestParameter";
           }
      }



      However this results in



      resultBasedOnRequestParameter</html>




      How do I remove the </html>?


        • 1. Re: String output
          nickarls

          Umm, are you 100% sure that the tag doesn't come from the view?

          • 2. Re: String output
            wouter.oet

            Yes. com.xhtml only contains the h:outputText tag.

            • 3. Re: String output
              nickarls

              Well, the renderkit produces html so you will probably have some...html in the beginning and end. Since the method clearly doesn't produce it.

              • 4. Re: String output
                wouter.oet

                Unfortunately there is not. There is no more code than what I posted.
                The function just returns resultBasedOnRequestParameter. There is no implementation yet that could produce tags.

                • 5. Re: String output
                  wouter.oet

                  I have found the solution. The renderkit assumes that you're rendering html. Not a bad assumption. So the key is to inform it to render something else.




                  <f:view 
                  xmlns:f="http://java.sun.com/jsf/core" 
                  xmlns:h="http://java.sun.com/jsf/html" contentType="text/xml">
                  <h:outputText value="#{communicator.responce}" />
                  </f:view>