Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Passing a list through location.href

  1. #1
    Junior Member
    Join Date
    Jul 2019
    Thanked 0 Times in 0 Posts

    Default Passing a list through location.href

    My problem is, i want to pass a parameter which is a list.

    function addNewDriver() 
    	var pEntityType = <%=c.WIDOC_ENTITY_DRIVER%>;
    	var pListEntities = <%=lListDrivers%>;
    	location.href= "<%= c.url %>do/user/groupItemForm.step1.jsp?idClient=" + <%=pIdClient%> + "&listEntities:" + pListEntities + 
    "&idGroup=" + <%=pIdGroup%> + "&entityType=" + pEntityType + "&<%= lBackButtonUrl %>";	

    "lListDrivers" is already filled with values of each driver, like dni, name, surname etc. Well it's actually a List<Map>.
    The problem comes because, to pass this list, values inside can't have an equal, for example:

    var pListEntities = [{dniPerson=4444444S, surname2Person=XXX, passportPerson=null, namePerson=XXX, idGroupItem=1, idPk=1111, surname1Person=XXXX}

    Google Chrome is giving me this error: Uncaught SyntaxError: Invalid shorthand property initializer
    What I assume is, google wants this:

    var pListEntities = [{dniPerson:4444444S, surname2Person:XXX, passportPerson:null, namePerson:XXX, idGroupItem:1, idPk:1111, surname1Person:XXXX}

    But I can't touch anything of theese values inside, cause are given in another java, is there any way to fix this? Thanks!

  2. #2
    Member Helium c2's Avatar
    Join Date
    Nov 2023
    Kekaha, Kaua'i
    Thanked 0 Times in 0 Posts

    Default Re: Passing a list through location.href

    You want to make class files for a Chrome book for others like myself to use. As a file extension. Upload or download buttons. Drag and drop buttons issues. But something. And it's not working out. First off, the environment you're working on has to be for many users. So environmental variables and parameter used in these class files are for the whole network and not just yourself. It has to be passed so that many users can use your file extensions on chrome. So that's the reason why it is reading a not so good remark.

    I think I may have an actual idea for this problem. This is a java environment, so you're working on some thing for JVM or Java host site to be on your computer. The actual hostsite is local. So it's http://localhost8080 url which is on some root directory. But you're making class files to be on some website that uses Java Virtual Machine. Also using a https://localhost8080 url. This is probably the standard java kit. Where the packages are all set and pre-made for that specific environment. Using JVM and setting up a local host site. That's probably the reading why it's a reading like that. You're trying to re-engineer the whole sdk kit java uses.
    Last edited by Helium c2; February 20th, 2024 at 10:13 PM.

Similar Threads

  1. Specifying the file location
    By fahman_khan75@yahoo.com in forum What's Wrong With My Code?
    Replies: 4
    Last Post: March 12th, 2014, 08:36 AM
  2. Replies: 3
    Last Post: October 5th, 2013, 09:14 AM
  3. Returning location instead of value?
    By cpguy in forum What's Wrong With My Code?
    Replies: 1
    Last Post: September 29th, 2011, 04:39 PM
  4. [SOLVED] How to specify FileOutputStream location?
    By Hallowed in forum Java Theory & Questions
    Replies: 7
    Last Post: May 29th, 2011, 06:36 PM