JQuery Primefaces RemoteCommand Parameter Issue

Posted on 2011-03-20
Medium Priority
Last Modified: 2012-06-21

My goal was to call this page with a queryString parameter (http://localhost:8080/page.html?scrapeU ... ://cnn.com and then try to pull the value from the requestparametermap off the facescontext but its null in my init method. My second option is to set an inputhidden in my jQuery(document).ready function but the below syntax doesn't work. Anyone know how to get this to work either way? Thanks for the help!

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
<ui:composition template="/WEB-INF/facelet/layout/external/main.xhtml">
   <ui:define name="content">
   <h:form id="scrapeFrm" binding="#{bookmarklet.bookmarkletFrm}">
   <h:inputHidden id="scrapeURL" value="default"/>
   <p:remoteCommand name="scapeImages" process="@this,scrapeURL" actionListener="#{bookmarklet.loadImages}" update="imageGrid"/>
   <script type="text/javascript">
          var value=$('#scrapeURL').val();

Open in new window

public class Bookmarklet extends BaseAction{
   private UIForm bookmarkletFrm;
   public void init(){
       if (!FacesUtils.isPostback()) {
          ExternalContext context = FacesUtils.getExternalContext();
          String scrapeURL = context.getRequestParameterMap().get("sourceURL");

Open in new window

Question by:cgray1223
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
LVL 23

Accepted Solution

cmalakar earned 2000 total points
ID: 35699082
>> My second option is to set an inputhidden in my jQuery(document).ready function but the below syntax doesn't work.

What is not working ? Did you get alert () ?

I dont see you including the jquery js file.

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
Suggested Courses

718 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question