[JBoss Seam] - Re: External AJAX access to webremote?
by whafrog
Now that I included jboss-seam-remoting.jar...yes. (doh! slap!)
Different issue now, both IE and Firefox have security issues. I'm logged in to my work via VPN, it must think "localhost" is a different domain. In IE I can enable the session, in Firefox I get a red "Please wait..." box in the upper right of the page, and an error on the console:
Error: uncaught exception: Permission denied to call method XMLHttpRequest.open
I can get past the "Please wait..." by adding the following code to my javascript method:
if (window.XMLHttpRequest) { // Mozilla, Safari,...
| try {
| netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
| } catch (e) {
| alert("Permission UniversalBrowserRead denied.");
| return null;
| }
| }
|
However, then I get this in the javascript console:
Error: [Exception... "'Permission denied to get property XMLDocument.documentElement' when calling method: [nsIOnReadyStateChangeHandler::handleEvent]" nsresult: "0x8057001e (NS_ERROR_XPC_JS_THREW_STRING)" location: "<unknown>" data: no]
Any way around that?
I've rewritten this service as a servlet. I still end up with the same domain-change security issues, but don't have a problem reading the data from my home-rolled javascript. So I'm wondering if there's a bug in the Seam javascript?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4112993#4112993
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4112993
18 years, 4 months
[JBoss Seam] - Re: Chained select boxes
by damianharvey
It's friday, my pub lunch is settling nicely and I'm feeling verbose, so here's a very basic example (probably some syntax errors but you get the drift):
| @Name("citySelectionBean")
| @Scope(ScopeType.CONVERSATION) // <---- This is important. You could also use SESSION or a stateful bean
| public class CitySelectionBean {
| String country;
| String state;
| String city;
|
| public List<String> getCountries() {
| return entityManager.createQuery("select c from Country c").getResultList();
| }
|
| public List<String> getStates() {
| List<String> states = new ArrayList<String>();
| if(this.country != null) {
| return entityManager.createQuery("select s from State s where s.country = :country")
| .setParameter("country", this.country)
| .getResultList();
| }
| return states;
| }
|
| public List<String> getCities() {
| List<String> cities = new ArrayList<String>();
| if(this.state != null) {
| return entityManager.createQuery("select c from City c where c.state = :state")
| .setParameter("state", this.state)
| .getResultList();
| }
| return cities;
| }
| }
|
And your page:
| <h:selectOneMenu id="country" value="#{citySelectionBean.country}">
| <s:selectItems value="#{citySelectionBean.countries}" var="country" label="#{country}">
| <a:support event="onchange" reRender="state, city"/>
| </h:selectOneMenu>
|
| <h:selectOneMenu id="state" value="#{citySelectionBean.state}">
| <s:selectItems value="#{citySelectionBean.states}" var="state" label="#{state}">
| <a:support event="onchange" reRender="city"/>
| </h:selectOneMenu>
|
| <h:selectOneMenu id="city" value="#{citySelectionBean.city}">
| <s:selectItems value="#{citySelectionBean.cities}" var="city" label="#{city}">
| </h:selectOneMenu>
|
Also create a page.xml file and ensure that you have something like <begin-conversation> in it.
Hope this helps.
Cheers,
Damian.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4112981#4112981
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4112981
18 years, 4 months