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 6243575
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T12:09:54+00:00 2026-05-24T12:09:54+00:00

I have been searching for an answer to my problem for two days now,

  • 0

I have been searching for an answer to my problem for two days now, so I figure its time to ask. Hopefully someone wiser in the ways of JSF and Seam (it won’t take much, I’m still new to both) will be able to enlighten me.

I have a Seam application that requires a dropdown, but one that the user can type into as well. This will allow user-created entries as well as pre-defined ones. I am attempting to create this combobox using the FlexBox jQuery plugin. It seems like a good candidate for what I need. I just need to specify a div and a page that returns JSON data in order to create this combobox effect.

add-codes.html

...
<div>
Department: <div id="dept-dropdown" />
</div>
...

AccountComboBoxList.java

...
@Scope(SESSION)
@Name("actComboBoxAction")
public class AccountComboBoxList implements Serializable {
...
@WebRemote
public JSONObject getDepartmentJSON() {
    JSONObject returnJSON = new JSONObject();
    try {
        //if dept name is null, skip this and return empty obj
        if(deptName!=null) {
            JSONArray returnArray =
                JsonDataHelper.convertAcctToolEnt2JsonArray(deptName);
            returnJSON = new JSONObject();
            returnJSON.put("results",returnArray);
            logger.info("JSON results: "+returnJSON);
        }
    } catch (JSONException je) {
        logger.warn("JSONException thrown!");
        logger.warn(je.getMessage());
        je.printStackTrace();
    } finally {
        return returnJSON;
    }
}
...

deptString.xhtml – in its entirety

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:s="http://jboss.com/products/seam/taglib">

<h:outputText value="#{actComboBoxAction.getDepartmentJSON()}" />

</ui:composition>

Then in my javascript file I simply create the combobox with this line:

...
$("#test-string").flexbox('./includes/deptString.seam');
...

The problem comes in at this point. deptString.seam calls the seam method correctly and successfully returns a JSONObject. But the combobox doesn’t work correctly because a ” is attached on the end of the string.
For example, I copy-and-pasted this from the resulting ‘View Source’ of the page:

{"results":[{"id":"1","name":"Dept1"},{"id":"2","name":"Dept2"},{"id":"3","name":"Dept3"}]}</html>

What is adding this extraneous tag and is there any way to get rid of it?
I created a text file with just the proper JSON in it and called that file into the .flexbox() method. The combobox worked as advertisted then, so I know the flexbox code works.
I also tried removing all the JSF code from the deptString.xhtml file and had just the single line #{actComboBoxAction.getDepartmentJSON()} in the file. This caused a ‘com.sun.facelets.FaceletException: Error Parsing /includes/deptString.xhtml: Error Traced[line: 1] Content is not allowed in prolog.’ error.

Like I said, i’m new to JSF and Seam. If there is an obvious/better way to get a simple String from the backend to the frontend in a Seam/JSF application, I’m all ears.

Thanks in advance for your help.

  • 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-05-24T12:09:55+00:00Added an answer on May 24, 2026 at 12:09 pm

    If your javascript was in a facelet (xhtml) file the you should be able to do

    $("#test-string").flexbox('#{actComboBoxAction.getDepartmentJSON()}'); 
    

    Mixing JSF EL in a JavaScript file mentions someways of achieving this

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been searching for an answer for a couple days now and had
I have been searching and this problem seems simple but cannot find answer. I
Hi I have been searching a solution to this problem for many days but
I have been searching for an answer for quite some time, and I have
I have been searching for an answer now for nearly one hour but cant
I have been searching the internet for an answer to my problem and have
I have been searching the internet wildly for an answer to this question. We
I have been searching everywhere but I could not find an answer. I need
I have been searching around using Google but I can't find an answer to
Hopefully this is a pretty simple question for someone to answer. I have a

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.