Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8716093
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T05:59:34+00:00 2026-06-13T05:59:34+00:00

I am getting my current page HTML using Jquery’s .html() method like this. <h:outputScript

  • 0

I am getting my current page HTML using Jquery’s .html() method like this.

<h:outputScript name="js/jquery-1.7.2.js" />
<h:outputScript>
   function getHtml(){
        $('#next').click(function(){  
           htmlString=$('#wrapper').html();
           alert(htmlString);
       command({param:htmlString});
          });
        }
</h:outputScript>

My XHTML page

<div id="wrapper">
 <form prependId="false">
 // My HTML form with some input fields
<h:commandButton id="next" value="Submit" action=#{bean.formvalues} onCick="getHtml();">
    <h:commandButton>
<p:remoteCommand name="command" actionListener="#{bean.getjs}" />
</form>
</div>

My Bean

    @ManagedBean
    @sessionScoped
    public class bean{

       private String formvalues; // getters and settes

      public String getformValues(){
       String htmlString = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("htmlString");
    return htmlString;
    }
}

public void getjs(){
     String value = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("param");
          System.out.println("**************** The Javascirpt is "+value);
    }

But I am not able to get the "htmlString" which has my page HTML source in the bean when I use this primefaces remoteCommand tag.How can get it into the bean.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T05:59:35+00:00Added an answer on June 13, 2026 at 5:59 am

    You should call remoteCommand like this;

    <h:outputScript>
       function getHtml(){
           $('#next').click(function(){  
               htmlString=$('#wrapper').html();
               alert(htmlString);
               command([{name:'param',value:htmlString}]); //This is important
           });
        }
    </h:outputScript>   
    

    and you can get value of param in getJs method:

    public void getjs(){
      FacesContext context = FacesContext.getCurrentInstance();
      Map<String, String> map = context.getExternalContext().getRequestParameterMap();
      String value = (String) map.get("param");
      System.out.println("**************** The Javascript is " + value);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm just getting started with the Play Framework 2.0 (using current trunk 2.1-SNAPSHOT, Scala)
i keep getting this error, The current value 'String.Empty' type is not compatible with
Can anyone help me getting started with this? We have a current keygen for
I am successfully using RJS to implement AJAX on a page.replace.html create.js.rjs. I am
I have an index page for listing products. From this page I would like
When I am using @item.BodyText I am getting the raw html output - with
The image property is not getting updated. I am using this.user.setImage(a) to set the
I'm using Django+Appengine on a page that has both a normal HTML request to
I am using Jquery to paginate some divs on my page. At the moment
I am implementing an application related to getting current music track information. I am

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.