Go Premium for a chance to win a PS4. Enter to Win


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
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

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

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

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
A solution for Fortify Path Manipulation.
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
Suggested Courses

972 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