You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Todd Nine <to...@gmail.com> on 2007/05/10 19:11:33 UTC

Calling JSF page from html page

Hi all,
  I'm trying to call a JSF application from a plain HTML form on a different
subdomain (and server).  Its a search so I only have 1 input field.  I have
include the code below.  I need to call the method "performSearch" on the
bean that's associated with my searchResults.jsf page.  It renders the page,
but never invokes the method.  What do I need in my form to do this?

<script type="text/javascript">
    function clearForm(textField) {
    textField.value = "";
    }
</script>

<div class="searcher">
<p>Search</p>
<form name="frmSearch" action="searchResults.jsf" method="post"
enctype="application/x-www-form-urlencoded">
    <input id="searchTerms" name="searchTerms" type="text" value="Search"
onclick="clearForm(this);" class="searchInput" onfocus="clearForm(this);" />
    <input id="performSearch" name="performSearch" type="image"
src="images/btn_go.jpg"  style="align:right;" class="go_btn" />

</form>
</div>

Re: Calling JSF page from html page

Posted by Simon Kitching <si...@rhe.co.nz>.
There's another problem with your approach. You cannot use managed-bean 
managed-property to inject a value of a *shorter* scope.

So when you get the current exception fixed I expect you'll then get an 
error about "cannot inject reference to value of shorter scope" or similar.

In this case searchBean is of scope "session" but you're trying to 
inject a value of scope "request" which just doesn't make sense; 
dependency injection only occurs once when the managed bean is created. 
If this was allowed, then the searchTerms property would only be set on 
the first access to this page, then *not* set on later accesses as the 
bean already exists. Rather than permit this confusing behaviour, JSF 
implementations are required to throw an exception in this situation.

You can add a tag to the page to force an "init" method to be invoked. I 
have a custom "callback" I use for that purpose; someday I'll try to get 
around to offering that for sandbox/tomahawk. However a hacky 
alternative can be implemented. In this case (invoke a JSF page from the 
submit of an HTML page) only the *render* of the JSF page is important, so:

<h:outputText style="display:none" value="#{searchBean.init}"/>

private void init() {
   // check request-scope flag to see if already initialised, and
   // if so then just return.
   //
   // set request-scope initialised flag
   // look for non-JSF parameters and deal with them
}

public String getInit() {
   init();
   return null;
}

public void setInit(String s) {
}


Another alternative might be to write a PhaseListener that scans the 
request for params of a specific name format, eg "jsf.param.bbbb.pppp" 
and for each one found create a ValueBinding for #{bbbb.pppp} then write 
the value to it. This looks like a very convenient approach but I'm not 
so sure about the security implications; looks a bit like that PHP 
feature that is now deprecated for security reasons. A somewhat more 
secure approach could be to have a config table of (view-id, param-name, 
target-property) for the PhaseListener to work from.

Regards,

Simon



Todd Nine wrote:
> Thanks for the help.  I've tried something similar
> 
> <managed-bean>
>         <description>
>             The bean used to submit a search result
>         </description>
>         <managed-bean-name>searchBean</managed-bean-name>
>         <managed-bean-class>
>             com.purdueefcu.website.bean.SearchBean
>         </managed-bean-class>
>         <managed-bean-scope>session</managed-bean-scope>
>         <managed-property>
>             <property-name>searchTerms</property-name>
>             <property-class>java.lang.String</property-class>
>             <value>#{param.searchTerms}</value>
>         </managed-property>
>     </managed-bean>
> 
> And I receive the following error
> 
> javax.servlet.ServletException: Cannot get value for expression '#{searchBean.startIndexDisplay}'
> 	javax.faces.webapp.FacesServlet.service
> (FacesServlet.java:152)
> 
> *root cause*
> 
> javax.faces.FacesException: Cannot get value for expression '#{searchBean.startIndexDisplay}'
> 	org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch
> (ServletExternalContextImpl.java:422)
> 	org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:234)
> 	org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:384)
> 	javax.faces.webapp.FacesServlet.service
> (FacesServlet.java:138)
> 
> 
> If I use this code in my "setter" to check if the param is available, 
> I'm able to get the value from the form below.  Any ideas?
> .
> Object terms = FacesContext.getCurrentInstance 
> ().getExternalContext().getRequestParameterMap().get("searchTerms");
>        
>         if(terms != null){
>             this.searchTerms = terms.toString();   
>         }
>        
>         performSearch();
>        
> 
> <form name="frmSearch" action=
> "searchResults.jsf" method="get"
> 	enctype="application/x-www-form-urlencoded"
>>
> <input id="searchTerms" name=
> "searchTerms" type="text" value="Search"
> 	
> onclick="clearForm(this);" class="searchInput"
> 	
> onfocus="clearForm(this);" />
> <input
>  id="performSearch" name="performSearch" 
> type="image"
> 	src="images/btn_go.jpg" style=
> "align:right;" class="go_btn" />
> </
> form>
> 
> 
> 
> On 5/14/07, *Cagatay Civici* <cagatay.civici@gmail.com 
> <ma...@gmail.com>> wrote:
> 
>     Hi,
> 
>     <managed-bean>
>             <managed-bean-name>barcaBean</managed-bean-name>
>            
>     <managed-bean-class>com.fc.barcelona.BarcaBean</managed-bean-class>
>             <managed-bean-scope>request</managed-bean-scope>
>             <managed-property>
>                 <property-name>playerId</property-name>
>                 <value>#{param.playerId}</value>
>             </managed-property>
>     </managed-bean>
> 
>     Example:
>     playerDetail.jsf?playerId=10
> 
>     So when there is request param called playerId in the request
>     parameter map, it'll be used automatically to set the playerId
>     property of barcaBean assuming there are references to barcaBean in
>     the playerDetail.jsf page.
> 
>     Cagatay
> 
> 
>     On 5/14/07, *Todd Nine* < todd.nine@gmail.com
>     <ma...@gmail.com>> wrote:
> 
>         Perhaps I should be more clear, my last post didn't make much
>         sense.  I've been using EL (obviously since I have JSF pages),
>         but I'm not sure how to bind to bean values using simple HTTP
>         named params.

> 
> 


Re: Calling JSF page from html page

Posted by Andrew Robinson <an...@gmail.com>.
The only two possibilities that I can think of are

1) The constructor of the search bean is throwing an exception
or
2) startIndexDisplay is a Long that is null when first accessed and
therefore cannot be converted to a long.

The EL exception is hiding the real exception (it is usually a lot
further down and sometimes cut off in the printed stack trace). You
may have better luck using a debugger.

Questions:
1) are you using Shale, Seam, Spring or any other code that could
cause errors during bean creation?
2) do you have any code in the search bean constructor?
3) is startIndexDisplay a long or a Long?

Also try:
add a try catch in your setSearchTerms:
  public void setSearchTerms(String searchTerms)
  {
    this.searchTerms = searchTerms;
    try
    {
      performSearch();
    }
    catch (Throwable error)
    {
      error.printStackTrace();
      throw new FacesException(error);
    }
  }




On 5/14/07, Todd Nine <to...@gmail.com> wrote:
>
>     /**
>      * @return the startIndexDisplay
>      */
>     public long getStartIndexDisplay() {
>         return startIndexDisplay;
>     }
>
> /**
>      * @return the searchTerms
>      */
>     public String getSearchTerms() {
>         return searchTerms;
>     }
>
>     /**
>      * @param searchTerms
>      *            the searchTerms to set
>      */
>     public void setSearchTerms(String searchTerms) {
>         // TODO TN. This is a bit ugly, but allows us to integrate
>         // with plain http requests this needs replaced with JSF EL in the
> faces-context.xml file
>         this.searchTerms = "";
>         Object terms =
> FacesContext.getCurrentInstance().getExternalContext()
>
> .getRequestParameterMap().get("searchTerms");
>
>         if (terms != null) {
>             this.searchTerms = terms.toString();
>         }
>
>         performSearch();
>
>     }
>
>
>
> On 5/14/07, Andrew Robinson <an...@gmail.com> wrote:
> > Your "searchBean.getStartIndexDisplay()" is throwing an exception. Can
> > you provide the code for that function and the get/setSearchTerms
> > functions?
> >
> > On 5/14/07, Todd Nine < todd.nine@gmail.com> wrote:
> > > Thanks for the help.  I've tried something similar
> > >
> > > <managed-bean>
> > >         <description>
> > >             The bean used to submit a search result
> > >         </description>
> > >
> <managed-bean-name>searchBean</managed-bean-name>
> > >         <managed-bean-class>
> > >             com.purdueefcu.website.bean.SearchBean
> > >         </managed-bean-class>
> > >
> <managed-bean-scope>session</managed-bean-scope>
> > >         <managed-property>
> > >             <property-name>searchTerms</property-name>
> > >             <property-class>java.lang.String</property-class>
> > >             <value>#{param.searchTerms}</value>
> > >         </managed-property>
> > >     </managed-bean>
> > >
> > > And I receive the following error
> > > javax.servlet.ServletException: Cannot get value for expression
> > > '#{searchBean.startIndexDisplay}'
> > >  javax.faces.webapp.FacesServlet.service
> > > (FacesServlet.java:152)
> > >
> > >
> > >
> > > root cause javax.faces.FacesException: Cannot get value for expression
> > > '#{searchBean.startIndexDisplay}'
> > >
> org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch
> > > (ServletExternalContextImpl.java:422)
> > >
> org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:234)
> > >
> org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java
> :384)
> > >  javax.faces.webapp.FacesServlet.service
> > > (FacesServlet.java:138)
> > >
> > >
> > > If I use this code in my "setter" to check if the param is available,
> I'm
> > > able to get the value from the form below.  Any ideas?
> > > .
> > > Object terms = FacesContext.getCurrentInstance
> > >
> ().getExternalContext().getRequestParameterMap().get("searchTerms");
> > >
> > >         if(terms != null){
> > >             this.searchTerms = terms.toString();
> > >         }
> > >
> > >         performSearch();
> > >
> > > <form name="frmSearch" action=
> > > "searchResults.jsf" method="get"
> > >  enctype="application/x-www-form-urlencoded"
> > > >
> > > <input id="searchTerms" name=
> > > "searchTerms" type="text" value="Search"
> > >
> > > onclick="clearForm(this);" class="searchInput"
> > >
> > > onfocus="clearForm(this);" />
> > > <input
> > >  id="performSearch" name="performSearch"
> > > type="image"
> > >  src="images/btn_go.jpg" style=
> > > "align:right;" class="go_btn" />
> > > </
> > > form>
> > >
> > >
> > > On 5/14/07, Cagatay Civici <cagatay.civici@gmail.com > wrote:
> > > > Hi,
> > > >
> > > > <managed-bean>
> > > >
> <managed-bean-name>barcaBean</managed-bean-name>
> > > >
> > > <managed-bean-class>com.fc.barcelona.BarcaBean </managed-bean-class>
> > > >
> <managed-bean-scope>request</managed-bean-scope>
> > > >         <managed-property>
> > > >             <property-name>playerId</property-name>
> > > >             <value>#{param.playerId}</value>
> > > >         </managed-property>
> > > > </managed-bean>
> > > >
> > > > Example:
> > > > playerDetail.jsf?playerId=10
> > > >
> > > > So when there is request param called playerId in the request
> parameter
> > > map, it'll be used automatically to set the playerId property of
> barcaBean
> > > assuming there are references to barcaBean in the playerDetail.jsf page.
> > > >
> > > > Cagatay
> > > >
> > > >
> > > >
> > > > On 5/14/07, Todd Nine < todd.nine@gmail.com> wrote:
> > > > > Perhaps I should be more clear, my last post didn't make much sense.
> > > I've been using EL (obviously since I have JSF pages), but I'm not sure
> how
> > > to bind to bean values using simple HTTP named params.
> > > > >
> > > > > Thanks,
> > > > > Todd
> > > > >
> > > > >
> > > > >
> > > > > On 5/14/07, Todd Nine < todd.nine@gmail.com> wrote:
> > > > > > I've never heard of EL before, and I'm having trouble finding it
> on
> > > the wiki.  Thanks for your input, can you please point me in the
> direction
> > > of the documentation?
> > > > > >
> > > > > > Thanks,
> > > > > > Todd
> > > > > >
> > > > > >
> > > > > >
> > > > > > On 5/10/07, Scott O'Bryan <da...@gmail.com> wrote:
> > > > > > > Use use el in your faces-config to bind the request parameters
> to
> > > > > > > managed properties on your managed beans.  This won't CALL your
> > > code,
> > > > > > > but when you retrieve the beans to render your page, the managed
> > > > > > > properties should be set for you.
> > > > > > >
> > > > > > > Scott
> > > > > > >
> > > > > > > eric.jung@novartis.com wrote:
> > > > > > > >
> > > > > > > > How would one's code be called to manipulate this managed bean
> > > when
> > > > > > > > such a request comes through? Is the only way with a
> > > PhaseListener?
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > *"Scott O'Bryan" < darkarena@gmail.com>*
> > > > > > > >
> > > > > > > > 05/10/2007 03:06 PM
> > > > > > > > Please respond to
> > > > > > > > "MyFaces Discussion" < users@myfaces.apache.org>
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > To
> > > > > > > >       MyFaces Discussion < users@myfaces.apache.org>
> > > > > > > > cc
> > > > > > > >
> > > > > > > > Subject
> > > > > > > >       Re: Calling JSF page from html page
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > Using request parameters, you could also create a managed
> property
> > > in a
> > > > > > > > managed bean in your FacesConfig.  Use EL to bind the request
> > > property
> > > > > > > > to your bean.  Your bean would then be able to generate the
> > > results
> > > > > > > > needed  for the bindings on your page.   :)  It removes the
> need
> > > to do
> > > > > > > > anything too fancy...
> > > > > > > >
> > > > > > > > Andrew Robinson wrote:
> > > > > > > > > I don't think that this is not the best way of doing this.
> The
> > > > > > > > > UICommand may not decide to decode the way you think it
> will.
> > > What I
> > > > > > > > > would recommend doing is using request parameters. In an
> on-load
> > > style
> > > > > > > > > method of your page, check for the existence of that request
> > > parameter
> > > > > > > > > and execute your method.
> > > > > > > > >
> > > > > > > > > Or you can create a custom servlet to do this. See
> > > > > > > > >
> > >
> http://wiki.apache.org/myfaces/InvokingJsfPagesWithStandardUrls
> > > > > > > > >
> > > > > > > > > Also, a view will only decode and go through the lifecycle
> if
> > > the view
> > > > > > > > > was already created. In your attempt, there is no view to
> > > deserialize
> > > > > > > > > for the page, and thus no decode and then no actions and the
> > > submitted
> > > > > > > > > values will be thrown out.
> > > > > > > > >
> > > > > > > > > Using a servlet or on-load method I really think is the
> right
> > > way to go.
> > > > > > > > >
> > > > > > > > > As for on-load functionality check out JBoss-Seam jsf-comp
> > > on-load or
> > > > > > > > > the shale view handler.
> > > > > > > > >
> > > > > > > > > On 5/10/07, Todd Nine < todd.nine@gmail.com > wrote:
> > > > > > > > >> Hi all,
> > > > > > > > >>   I'm trying to call a JSF application from a plain HTML
> form
> > > on a
> > > > > > > > >> different
> > > > > > > > >> subdomain (and server).  Its a search so I only have 1
> input
> > > field.
> > > > > > > > >> I have
> > > > > > > > >> include the code below.  I need to call the method
> > > "performSearch" on
> > > > > > > > >> the
> > > > > > > > >> bean that's associated with my searchResults.jsf page.  It
> > > renders
> > > > > > > > >> the page,
> > > > > > > > >> but never invokes the method.  What do I need in my form to
> do
> > > this?
> > > > > > > > >>
> > > > > > > > >> <script type="text/javascript">
> > > > > > > > >>     function clearForm(textField) {
> > > > > > > > >>     textField.value = "";
> > > > > > > > >>     }
> > > > > > > > >> </script>
> > > > > > > > >>
> > > > > > > > >> <div class="searcher">
> > > > > > > > >> <p>Search</p>
> > > > > > > > >> <form name="frmSearch" action=" searchResults.jsf"
> method="post"
> > > > > > > > >>
> enctype="application/x-www-form-urlencoded">
> > > > > > > > >>     <input id="searchTerms" name="searchTerms" type="text"
> > > > > > > > >> value="Search"
> > > > > > > > >> onclick="clearForm(this);" class="searchInput"
> > > > > > > > >> onfocus="clearForm(this);" />
> > > > > > > > >>     <input id="performSearch" name="performSearch"
> type="image"
> > > > > > > > >> src="images/btn_go.jpg"
> style="align:right;"
> > > class="go_btn" />
> > > > > > > > >>
> > > > > > > > >> </form>
> > > > > > > > >>  </div>
> > > > > > > > >>
> > > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > _________________________
> > > > > > > >
> > > > > > > > CONFIDENTIALITY NOTICE
> > > > > > > >
> > > > > > > > The information contained in this e-mail message is intended
> only
> > > for
> > > > > > > > the exclusive use of the individual or entity named above and
> may
> > > > > > > > contain information that is privileged, confidential or exempt
> > > from
> > > > > > > > disclosure under applicable law. If the reader of this message
> is
> > > not
> > > > > > > > the intended recipient, or the employee or agent responsible
> for
> > > > > > > > delivery of the message to the intended recipient, you are
> hereby
> > > > > > > > notified that any dissemination, distribution or copying of
> this
> > > > > > > > communication is strictly prohibited. If you have received
> this
> > > > > > > > communication in error, please notify the sender immediately
> by
> > > e-mail
> > > > > > > > and delete the material from any computer.  Thank you.
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
>
>

Re: Calling JSF page from html page

Posted by Todd Nine <to...@gmail.com>.
    /**
     * @return the startIndexDisplay
     */
    public long getStartIndexDisplay() {
        return startIndexDisplay;
    }

/**
     * @return the searchTerms
     */
    public String getSearchTerms() {
        return searchTerms;
    }

    /**
     * @param searchTerms
     *            the searchTerms to set
     */
    public void setSearchTerms(String searchTerms) {
        // TODO TN. This is a bit ugly, but allows us to integrate
        // with plain http requests this needs replaced with JSF EL in the
faces-context.xml file
        this.searchTerms = "";
        Object terms = FacesContext.getCurrentInstance
().getExternalContext()
                .getRequestParameterMap().get("searchTerms");

        if (terms != null) {
            this.searchTerms = terms.toString();
        }

        performSearch();

    }


On 5/14/07, Andrew Robinson <an...@gmail.com> wrote:
>
> Your "searchBean.getStartIndexDisplay()" is throwing an exception. Can
> you provide the code for that function and the get/setSearchTerms
> functions?
>
> On 5/14/07, Todd Nine <to...@gmail.com> wrote:
> > Thanks for the help.  I've tried something similar
> >
> > <managed-bean>
> >         <description>
> >             The bean used to submit a search result
> >         </description>
> >         <managed-bean-name>searchBean</managed-bean-name>
> >         <managed-bean-class>
> >             com.purdueefcu.website.bean.SearchBean
> >         </managed-bean-class>
> >         <managed-bean-scope>session</managed-bean-scope>
> >         <managed-property>
> >             <property-name>searchTerms</property-name>
> >             <property-class>java.lang.String</property-class>
> >             <value>#{param.searchTerms}</value>
> >         </managed-property>
> >     </managed-bean>
> >
> > And I receive the following error
> > javax.servlet.ServletException: Cannot get value for expression
> > '#{searchBean.startIndexDisplay}'
> >  javax.faces.webapp.FacesServlet.service
> > (FacesServlet.java:152)
> >
> >
> >
> > root cause javax.faces.FacesException: Cannot get value for expression
> > '#{searchBean.startIndexDisplay}'
> > org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch
> > (ServletExternalContextImpl.java:422)
> > org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(
> JspViewHandlerImpl.java:234)
> > org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java
> :384)
> >  javax.faces.webapp.FacesServlet.service
> > (FacesServlet.java:138)
> >
> >
> > If I use this code in my "setter" to check if the param is available,
> I'm
> > able to get the value from the form below.  Any ideas?
> > .
> > Object terms = FacesContext.getCurrentInstance
> > ().getExternalContext().getRequestParameterMap().get("searchTerms");
> >
> >         if(terms != null){
> >             this.searchTerms = terms.toString();
> >         }
> >
> >         performSearch();
> >
> > <form name="frmSearch" action=
> > "searchResults.jsf" method="get"
> >  enctype="application/x-www-form-urlencoded"
> > >
> > <input id="searchTerms" name=
> > "searchTerms" type="text" value="Search"
> >
> > onclick="clearForm(this);" class="searchInput"
> >
> > onfocus="clearForm(this);" />
> > <input
> >  id="performSearch" name="performSearch"
> > type="image"
> >  src="images/btn_go.jpg" style=
> > "align:right;" class="go_btn" />
> > </
> > form>
> >
> >
> > On 5/14/07, Cagatay Civici <ca...@gmail.com> wrote:
> > > Hi,
> > >
> > > <managed-bean>
> > >         <managed-bean-name>barcaBean</managed-bean-name>
> > >
> > <managed-bean-class>com.fc.barcelona.BarcaBean</managed-bean-class>
> > >         <managed-bean-scope>request</managed-bean-scope>
> > >         <managed-property>
> > >             <property-name>playerId</property-name>
> > >             <value>#{param.playerId}</value>
> > >         </managed-property>
> > > </managed-bean>
> > >
> > > Example:
> > > playerDetail.jsf?playerId=10
> > >
> > > So when there is request param called playerId in the request
> parameter
> > map, it'll be used automatically to set the playerId property of
> barcaBean
> > assuming there are references to barcaBean in the playerDetail.jsf page.
> > >
> > > Cagatay
> > >
> > >
> > >
> > > On 5/14/07, Todd Nine < todd.nine@gmail.com> wrote:
> > > > Perhaps I should be more clear, my last post didn't make much sense.
> > I've been using EL (obviously since I have JSF pages), but I'm not sure
> how
> > to bind to bean values using simple HTTP named params.
> > > >
> > > > Thanks,
> > > > Todd
> > > >
> > > >
> > > >
> > > > On 5/14/07, Todd Nine < todd.nine@gmail.com> wrote:
> > > > > I've never heard of EL before, and I'm having trouble finding it
> on
> > the wiki.  Thanks for your input, can you please point me in the
> direction
> > of the documentation?
> > > > >
> > > > > Thanks,
> > > > > Todd
> > > > >
> > > > >
> > > > >
> > > > > On 5/10/07, Scott O'Bryan <da...@gmail.com> wrote:
> > > > > > Use use el in your faces-config to bind the request parameters
> to
> > > > > > managed properties on your managed beans.  This won't CALL your
> > code,
> > > > > > but when you retrieve the beans to render your page, the managed
> > > > > > properties should be set for you.
> > > > > >
> > > > > > Scott
> > > > > >
> > > > > > eric.jung@novartis.com wrote:
> > > > > > >
> > > > > > > How would one's code be called to manipulate this managed bean
> > when
> > > > > > > such a request comes through? Is the only way with a
> > PhaseListener?
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > *"Scott O'Bryan" <da...@gmail.com>*
> > > > > > >
> > > > > > > 05/10/2007 03:06 PM
> > > > > > > Please respond to
> > > > > > > "MyFaces Discussion" < users@myfaces.apache.org>
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > To
> > > > > > >       MyFaces Discussion < users@myfaces.apache.org>
> > > > > > > cc
> > > > > > >
> > > > > > > Subject
> > > > > > >       Re: Calling JSF page from html page
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > Using request parameters, you could also create a managed
> property
> > in a
> > > > > > > managed bean in your FacesConfig.  Use EL to bind the request
> > property
> > > > > > > to your bean.  Your bean would then be able to generate the
> > results
> > > > > > > needed  for the bindings on your page.   :)  It removes the
> need
> > to do
> > > > > > > anything too fancy...
> > > > > > >
> > > > > > > Andrew Robinson wrote:
> > > > > > > > I don't think that this is not the best way of doing this.
> The
> > > > > > > > UICommand may not decide to decode the way you think it
> will.
> > What I
> > > > > > > > would recommend doing is using request parameters. In an
> on-load
> > style
> > > > > > > > method of your page, check for the existence of that request
> > parameter
> > > > > > > > and execute your method.
> > > > > > > >
> > > > > > > > Or you can create a custom servlet to do this. See
> > > > > > > >
> > http://wiki.apache.org/myfaces/InvokingJsfPagesWithStandardUrls
> > > > > > > >
> > > > > > > > Also, a view will only decode and go through the lifecycle
> if
> > the view
> > > > > > > > was already created. In your attempt, there is no view to
> > deserialize
> > > > > > > > for the page, and thus no decode and then no actions and the
> > submitted
> > > > > > > > values will be thrown out.
> > > > > > > >
> > > > > > > > Using a servlet or on-load method I really think is the
> right
> > way to go.
> > > > > > > >
> > > > > > > > As for on-load functionality check out JBoss-Seam jsf-comp
> > on-load or
> > > > > > > > the shale view handler.
> > > > > > > >
> > > > > > > > On 5/10/07, Todd Nine <todd.nine@gmail.com > wrote:
> > > > > > > >> Hi all,
> > > > > > > >>   I'm trying to call a JSF application from a plain HTML
> form
> > on a
> > > > > > > >> different
> > > > > > > >> subdomain (and server).  Its a search so I only have 1
> input
> > field.
> > > > > > > >> I have
> > > > > > > >> include the code below.  I need to call the method
> > "performSearch" on
> > > > > > > >> the
> > > > > > > >> bean that's associated with my searchResults.jsf page.  It
> > renders
> > > > > > > >> the page,
> > > > > > > >> but never invokes the method.  What do I need in my form to
> do
> > this?
> > > > > > > >>
> > > > > > > >> <script type="text/javascript">
> > > > > > > >>     function clearForm(textField) {
> > > > > > > >>     textField.value = "";
> > > > > > > >>     }
> > > > > > > >> </script>
> > > > > > > >>
> > > > > > > >> <div class="searcher">
> > > > > > > >> <p>Search</p>
> > > > > > > >> <form name="frmSearch" action="searchResults.jsf"
> method="post"
> > > > > > > >> enctype="application/x-www-form-urlencoded">
> > > > > > > >>     <input id="searchTerms" name="searchTerms" type="text"
> > > > > > > >> value="Search"
> > > > > > > >> onclick="clearForm(this);" class="searchInput"
> > > > > > > >> onfocus="clearForm(this);" />
> > > > > > > >>     <input id="performSearch" name="performSearch"
> type="image"
> > > > > > > >> src="images/btn_go.jpg"  style="align:right;"
> > class="go_btn" />
> > > > > > > >>
> > > > > > > >> </form>
> > > > > > > >>  </div>
> > > > > > > >>
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > _________________________
> > > > > > >
> > > > > > > CONFIDENTIALITY NOTICE
> > > > > > >
> > > > > > > The information contained in this e-mail message is intended
> only
> > for
> > > > > > > the exclusive use of the individual or entity named above and
> may
> > > > > > > contain information that is privileged, confidential or exempt
> > from
> > > > > > > disclosure under applicable law. If the reader of this message
> is
> > not
> > > > > > > the intended recipient, or the employee or agent responsible
> for
> > > > > > > delivery of the message to the intended recipient, you are
> hereby
> > > > > > > notified that any dissemination, distribution or copying of
> this
> > > > > > > communication is strictly prohibited. If you have received
> this
> > > > > > > communication in error, please notify the sender immediately
> by
> > e-mail
> > > > > > > and delete the material from any computer.  Thank you.
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>

Re: Calling JSF page from html page

Posted by Andrew Robinson <an...@gmail.com>.
Your "searchBean.getStartIndexDisplay()" is throwing an exception. Can
you provide the code for that function and the get/setSearchTerms
functions?

On 5/14/07, Todd Nine <to...@gmail.com> wrote:
> Thanks for the help.  I've tried something similar
>
> <managed-bean>
>         <description>
>             The bean used to submit a search result
>         </description>
>         <managed-bean-name>searchBean</managed-bean-name>
>         <managed-bean-class>
>             com.purdueefcu.website.bean.SearchBean
>         </managed-bean-class>
>         <managed-bean-scope>session</managed-bean-scope>
>         <managed-property>
>             <property-name>searchTerms</property-name>
>             <property-class>java.lang.String</property-class>
>             <value>#{param.searchTerms}</value>
>         </managed-property>
>     </managed-bean>
>
> And I receive the following error
> javax.servlet.ServletException: Cannot get value for expression
> '#{searchBean.startIndexDisplay}'
>  javax.faces.webapp.FacesServlet.service
> (FacesServlet.java:152)
>
>
>
> root cause javax.faces.FacesException: Cannot get value for expression
> '#{searchBean.startIndexDisplay}'
> org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch
> (ServletExternalContextImpl.java:422)
> org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:234)
> org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:384)
>  javax.faces.webapp.FacesServlet.service
> (FacesServlet.java:138)
>
>
> If I use this code in my "setter" to check if the param is available, I'm
> able to get the value from the form below.  Any ideas?
> .
> Object terms = FacesContext.getCurrentInstance
> ().getExternalContext().getRequestParameterMap().get("searchTerms");
>
>         if(terms != null){
>             this.searchTerms = terms.toString();
>         }
>
>         performSearch();
>
> <form name="frmSearch" action=
> "searchResults.jsf" method="get"
>  enctype="application/x-www-form-urlencoded"
> >
> <input id="searchTerms" name=
> "searchTerms" type="text" value="Search"
>
> onclick="clearForm(this);" class="searchInput"
>
> onfocus="clearForm(this);" />
> <input
>  id="performSearch" name="performSearch"
> type="image"
>  src="images/btn_go.jpg" style=
> "align:right;" class="go_btn" />
> </
> form>
>
>
> On 5/14/07, Cagatay Civici <ca...@gmail.com> wrote:
> > Hi,
> >
> > <managed-bean>
> >         <managed-bean-name>barcaBean</managed-bean-name>
> >
> <managed-bean-class>com.fc.barcelona.BarcaBean</managed-bean-class>
> >         <managed-bean-scope>request</managed-bean-scope>
> >         <managed-property>
> >             <property-name>playerId</property-name>
> >             <value>#{param.playerId}</value>
> >         </managed-property>
> > </managed-bean>
> >
> > Example:
> > playerDetail.jsf?playerId=10
> >
> > So when there is request param called playerId in the request parameter
> map, it'll be used automatically to set the playerId property of barcaBean
> assuming there are references to barcaBean in the playerDetail.jsf page.
> >
> > Cagatay
> >
> >
> >
> > On 5/14/07, Todd Nine < todd.nine@gmail.com> wrote:
> > > Perhaps I should be more clear, my last post didn't make much sense.
> I've been using EL (obviously since I have JSF pages), but I'm not sure how
> to bind to bean values using simple HTTP named params.
> > >
> > > Thanks,
> > > Todd
> > >
> > >
> > >
> > > On 5/14/07, Todd Nine < todd.nine@gmail.com> wrote:
> > > > I've never heard of EL before, and I'm having trouble finding it on
> the wiki.  Thanks for your input, can you please point me in the direction
> of the documentation?
> > > >
> > > > Thanks,
> > > > Todd
> > > >
> > > >
> > > >
> > > > On 5/10/07, Scott O'Bryan <da...@gmail.com> wrote:
> > > > > Use use el in your faces-config to bind the request parameters to
> > > > > managed properties on your managed beans.  This won't CALL your
> code,
> > > > > but when you retrieve the beans to render your page, the managed
> > > > > properties should be set for you.
> > > > >
> > > > > Scott
> > > > >
> > > > > eric.jung@novartis.com wrote:
> > > > > >
> > > > > > How would one's code be called to manipulate this managed bean
> when
> > > > > > such a request comes through? Is the only way with a
> PhaseListener?
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > *"Scott O'Bryan" <da...@gmail.com>*
> > > > > >
> > > > > > 05/10/2007 03:06 PM
> > > > > > Please respond to
> > > > > > "MyFaces Discussion" < users@myfaces.apache.org>
> > > > > >
> > > > > >
> > > > > >
> > > > > > To
> > > > > >       MyFaces Discussion < users@myfaces.apache.org>
> > > > > > cc
> > > > > >
> > > > > > Subject
> > > > > >       Re: Calling JSF page from html page
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > Using request parameters, you could also create a managed property
> in a
> > > > > > managed bean in your FacesConfig.  Use EL to bind the request
> property
> > > > > > to your bean.  Your bean would then be able to generate the
> results
> > > > > > needed  for the bindings on your page.   :)  It removes the need
> to do
> > > > > > anything too fancy...
> > > > > >
> > > > > > Andrew Robinson wrote:
> > > > > > > I don't think that this is not the best way of doing this. The
> > > > > > > UICommand may not decide to decode the way you think it will.
> What I
> > > > > > > would recommend doing is using request parameters. In an on-load
> style
> > > > > > > method of your page, check for the existence of that request
> parameter
> > > > > > > and execute your method.
> > > > > > >
> > > > > > > Or you can create a custom servlet to do this. See
> > > > > > >
> http://wiki.apache.org/myfaces/InvokingJsfPagesWithStandardUrls
> > > > > > >
> > > > > > > Also, a view will only decode and go through the lifecycle if
> the view
> > > > > > > was already created. In your attempt, there is no view to
> deserialize
> > > > > > > for the page, and thus no decode and then no actions and the
> submitted
> > > > > > > values will be thrown out.
> > > > > > >
> > > > > > > Using a servlet or on-load method I really think is the right
> way to go.
> > > > > > >
> > > > > > > As for on-load functionality check out JBoss-Seam jsf-comp
> on-load or
> > > > > > > the shale view handler.
> > > > > > >
> > > > > > > On 5/10/07, Todd Nine <todd.nine@gmail.com > wrote:
> > > > > > >> Hi all,
> > > > > > >>   I'm trying to call a JSF application from a plain HTML form
> on a
> > > > > > >> different
> > > > > > >> subdomain (and server).  Its a search so I only have 1 input
> field.
> > > > > > >> I have
> > > > > > >> include the code below.  I need to call the method
> "performSearch" on
> > > > > > >> the
> > > > > > >> bean that's associated with my searchResults.jsf page.  It
> renders
> > > > > > >> the page,
> > > > > > >> but never invokes the method.  What do I need in my form to do
> this?
> > > > > > >>
> > > > > > >> <script type="text/javascript">
> > > > > > >>     function clearForm(textField) {
> > > > > > >>     textField.value = "";
> > > > > > >>     }
> > > > > > >> </script>
> > > > > > >>
> > > > > > >> <div class="searcher">
> > > > > > >> <p>Search</p>
> > > > > > >> <form name="frmSearch" action="searchResults.jsf" method="post"
> > > > > > >> enctype="application/x-www-form-urlencoded">
> > > > > > >>     <input id="searchTerms" name="searchTerms" type="text"
> > > > > > >> value="Search"
> > > > > > >> onclick="clearForm(this);" class="searchInput"
> > > > > > >> onfocus="clearForm(this);" />
> > > > > > >>     <input id="performSearch" name="performSearch" type="image"
> > > > > > >> src="images/btn_go.jpg"  style="align:right;"
> class="go_btn" />
> > > > > > >>
> > > > > > >> </form>
> > > > > > >>  </div>
> > > > > > >>
> > > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > _________________________
> > > > > >
> > > > > > CONFIDENTIALITY NOTICE
> > > > > >
> > > > > > The information contained in this e-mail message is intended only
> for
> > > > > > the exclusive use of the individual or entity named above and may
> > > > > > contain information that is privileged, confidential or exempt
> from
> > > > > > disclosure under applicable law. If the reader of this message is
> not
> > > > > > the intended recipient, or the employee or agent responsible for
> > > > > > delivery of the message to the intended recipient, you are hereby
> > > > > > notified that any dissemination, distribution or copying of this
> > > > > > communication is strictly prohibited. If you have received this
> > > > > > communication in error, please notify the sender immediately by
> e-mail
> > > > > > and delete the material from any computer.  Thank you.
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>

Re: Calling JSF page from html page

Posted by Todd Nine <to...@gmail.com>.
Thanks for the help.  I've tried something similar

<managed-bean>
        <description>
            The bean used to submit a search result
        </description>
        <managed-bean-name>searchBean</managed-bean-name>
        <managed-bean-class>
            com.purdueefcu.website.bean.SearchBean
        </managed-bean-class>
        <managed-bean-scope>session</managed-bean-scope>
        <managed-property>
            <property-name>searchTerms</property-name>
            <property-class>java.lang.String</property-class>
            <value>#{param.searchTerms}</value>
        </managed-property>
    </managed-bean>

And I receive the following error

javax.servlet.ServletException: Cannot get value for expression
'#{searchBean.startIndexDisplay}'
	javax.faces.webapp.FacesServlet.service(FacesServlet.java:152)

*root cause*

javax.faces.FacesException: Cannot get value for expression
'#{searchBean.startIndexDisplay}'
	org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:422)
	org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:234)
	org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:384)
	javax.faces.webapp.FacesServlet.service(FacesServlet.java:138)


If I use this code in my "setter" to check if the param is available, I'm
able to get the value from the form below.  Any ideas?
.
Object terms = FacesContext.getCurrentInstance
().getExternalContext().getRequestParameterMap().get("searchTerms");

        if(terms != null){
            this.searchTerms = terms.toString();
        }

        performSearch();


<form name="frmSearch" action="searchResults.jsf" method="get"
	enctype="application/x-www-form-urlencoded">
<input id="searchTerms" name="searchTerms" type="text" value="Search"
	onclick="clearForm(this);" class="searchInput"
	onfocus="clearForm(this);" />
<input id="performSearch" name="performSearch" type="image"
	src="images/btn_go.jpg" style="align:right;" class="go_btn" />
</form>



On 5/14/07, Cagatay Civici <ca...@gmail.com> wrote:
>
> Hi,
>
> <managed-bean>
>         <managed-bean-name>barcaBean</managed-bean-name>
>         <managed-bean-class>com.fc.barcelona.BarcaBean
> </managed-bean-class>
>         <managed-bean-scope>request</managed-bean-scope>
>         <managed-property>
>             <property-name>playerId</property-name>
>             <value>#{param.playerId}</value>
>         </managed-property>
> </managed-bean>
>
> Example:
> playerDetail.jsf?playerId=10
>
> So when there is request param called playerId in the request parameter
> map, it'll be used automatically to set the playerId property of barcaBean
> assuming there are references to barcaBean in the playerDetail.jsf page.
>
> Cagatay
>
> On 5/14/07, Todd Nine <to...@gmail.com> wrote:
> >
> > Perhaps I should be more clear, my last post didn't make much sense.
> > I've been using EL (obviously since I have JSF pages), but I'm not sure how
> > to bind to bean values using simple HTTP named params.
> >
> > Thanks,
> > Todd
> >
> > On 5/14/07, Todd Nine < todd.nine@gmail.com> wrote:
> > >
> > > I've never heard of EL before, and I'm having trouble finding it on
> > > the wiki.  Thanks for your input, can you please point me in the direction
> > > of the documentation?
> > >
> > > Thanks,
> > > Todd
> > >
> > > On 5/10/07, Scott O'Bryan <da...@gmail.com> wrote:
> > > >
> > > > Use use el in your faces-config to bind the request parameters to
> > > > managed properties on your managed beans.  This won't CALL your
> > > > code,
> > > > but when you retrieve the beans to render your page, the managed
> > > > properties should be set for you.
> > > >
> > > > Scott
> > > >
> > > > eric.jung@novartis.com wrote:
> > > > >
> > > > > How would one's code be called to manipulate this managed bean
> > > > when
> > > > > such a request comes through? Is the only way with a
> > > > PhaseListener?
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > *"Scott O'Bryan" <da...@gmail.com>*
> > > > >
> > > > > 05/10/2007 03:06 PM
> > > > > Please respond to
> > > > > "MyFaces Discussion" < users@myfaces.apache.org>
> > > > >
> > > > >
> > > > >
> > > > > To
> > > > >       MyFaces Discussion < users@myfaces.apache.org>
> > > > > cc
> > > > >
> > > > > Subject
> > > > >       Re: Calling JSF page from html page
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > Using request parameters, you could also create a managed property
> > > > in a
> > > > > managed bean in your FacesConfig.  Use EL to bind the request
> > > > property
> > > > > to your bean.  Your bean would then be able to generate the
> > > > results
> > > > > needed  for the bindings on your page.   :)  It removes the need
> > > > to do
> > > > > anything too fancy...
> > > > >
> > > > > Andrew Robinson wrote:
> > > > > > I don't think that this is not the best way of doing this. The
> > > > > > UICommand may not decide to decode the way you think it will.
> > > > What I
> > > > > > would recommend doing is using request parameters. In an on-load
> > > > style
> > > > > > method of your page, check for the existence of that request
> > > > parameter
> > > > > > and execute your method.
> > > > > >
> > > > > > Or you can create a custom servlet to do this. See
> > > > > > http://wiki.apache.org/myfaces/InvokingJsfPagesWithStandardUrls
> > > > > >
> > > > > > Also, a view will only decode and go through the lifecycle if
> > > > the view
> > > > > > was already created. In your attempt, there is no view to
> > > > deserialize
> > > > > > for the page, and thus no decode and then no actions and the
> > > > submitted
> > > > > > values will be thrown out.
> > > > > >
> > > > > > Using a servlet or on-load method I really think is the right
> > > > way to go.
> > > > > >
> > > > > > As for on-load functionality check out JBoss-Seam jsf-comp
> > > > on-load or
> > > > > > the shale view handler.
> > > > > >
> > > > > > On 5/10/07, Todd Nine <todd.nine@gmail.com > wrote:
> > > > > >> Hi all,
> > > > > >>   I'm trying to call a JSF application from a plain HTML form
> > > > on a
> > > > > >> different
> > > > > >> subdomain (and server).  Its a search so I only have 1 input
> > > > field.
> > > > > >> I have
> > > > > >> include the code below.  I need to call the method
> > > > "performSearch" on
> > > > > >> the
> > > > > >> bean that's associated with my searchResults.jsf page.  It
> > > > renders
> > > > > >> the page,
> > > > > >> but never invokes the method.  What do I need in my form to do
> > > > this?
> > > > > >>
> > > > > >> <script type="text/javascript">
> > > > > >>     function clearForm(textField) {
> > > > > >>     textField.value = "";
> > > > > >>     }
> > > > > >> </script>
> > > > > >>
> > > > > >> <div class="searcher">
> > > > > >> <p>Search</p>
> > > > > >> <form name="frmSearch" action="searchResults.jsf" method="post"
> > > >
> > > > > >> enctype="application/x-www-form-urlencoded">
> > > > > >>     <input id="searchTerms" name="searchTerms" type="text"
> > > > > >> value="Search"
> > > > > >> onclick="clearForm(this);" class="searchInput"
> > > > > >> onfocus="clearForm(this);" />
> > > > > >>     <input id="performSearch" name="performSearch" type="image"
> > > >
> > > > > >> src="images/btn_go.jpg"  style="align:right;" class="go_btn" />
> > > > > >>
> > > > > >> </form>
> > > > > >>  </div>
> > > > > >>
> > > > > >
> > > > >
> > > > >
> > > > >
> > > > > _________________________
> > > > >
> > > > > CONFIDENTIALITY NOTICE
> > > > >
> > > > > The information contained in this e-mail message is intended only
> > > > for
> > > > > the exclusive use of the individual or entity named above and may
> > > > > contain information that is privileged, confidential or exempt
> > > > from
> > > > > disclosure under applicable law. If the reader of this message is
> > > > not
> > > > > the intended recipient, or the employee or agent responsible for
> > > > > delivery of the message to the intended recipient, you are hereby
> > > > > notified that any dissemination, distribution or copying of this
> > > > > communication is strictly prohibited. If you have received this
> > > > > communication in error, please notify the sender immediately by
> > > > e-mail
> > > > > and delete the material from any computer.  Thank you.
> > > >
> > > >
> > >
> >
>

Re: Calling JSF page from html page

Posted by Cagatay Civici <ca...@gmail.com>.
Hi,

<managed-bean>
        <managed-bean-name>barcaBean</managed-bean-name>
        <managed-bean-class>com.fc.barcelona.BarcaBean</managed-bean-class>
        <managed-bean-scope>request</managed-bean-scope>
        <managed-property>
            <property-name>playerId</property-name>
            <value>#{param.playerId}</value>
        </managed-property>
</managed-bean>

Example:
playerDetail.jsf?playerId=10

So when there is request param called playerId in the request parameter map,
it'll be used automatically to set the playerId property of barcaBean
assuming there are references to barcaBean in the playerDetail.jsf page.

Cagatay

On 5/14/07, Todd Nine <to...@gmail.com> wrote:
>
> Perhaps I should be more clear, my last post didn't make much sense.  I've
> been using EL (obviously since I have JSF pages), but I'm not sure how to
> bind to bean values using simple HTTP named params.
>
> Thanks,
> Todd
>
> On 5/14/07, Todd Nine <to...@gmail.com> wrote:
> >
> > I've never heard of EL before, and I'm having trouble finding it on the
> > wiki.  Thanks for your input, can you please point me in the direction of
> > the documentation?
> >
> > Thanks,
> > Todd
> >
> > On 5/10/07, Scott O'Bryan <da...@gmail.com> wrote:
> > >
> > > Use use el in your faces-config to bind the request parameters to
> > > managed properties on your managed beans.  This won't CALL your code,
> > > but when you retrieve the beans to render your page, the managed
> > > properties should be set for you.
> > >
> > > Scott
> > >
> > > eric.jung@novartis.com wrote:
> > > >
> > > > How would one's code be called to manipulate this managed bean when
> > > > such a request comes through? Is the only way with a PhaseListener?
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > *"Scott O'Bryan" <da...@gmail.com>*
> > > >
> > > > 05/10/2007 03:06 PM
> > > > Please respond to
> > > > "MyFaces Discussion" < users@myfaces.apache.org>
> > > >
> > > >
> > > >
> > > > To
> > > >       MyFaces Discussion < users@myfaces.apache.org>
> > > > cc
> > > >
> > > > Subject
> > > >       Re: Calling JSF page from html page
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > Using request parameters, you could also create a managed property
> > > in a
> > > > managed bean in your FacesConfig.  Use EL to bind the request
> > > property
> > > > to your bean.  Your bean would then be able to generate the results
> > > > needed  for the bindings on your page.   :)  It removes the need to
> > > do
> > > > anything too fancy...
> > > >
> > > > Andrew Robinson wrote:
> > > > > I don't think that this is not the best way of doing this. The
> > > > > UICommand may not decide to decode the way you think it will. What
> > > I
> > > > > would recommend doing is using request parameters. In an on-load
> > > style
> > > > > method of your page, check for the existence of that request
> > > parameter
> > > > > and execute your method.
> > > > >
> > > > > Or you can create a custom servlet to do this. See
> > > > > http://wiki.apache.org/myfaces/InvokingJsfPagesWithStandardUrls
> > > > >
> > > > > Also, a view will only decode and go through the lifecycle if the
> > > view
> > > > > was already created. In your attempt, there is no view to
> > > deserialize
> > > > > for the page, and thus no decode and then no actions and the
> > > submitted
> > > > > values will be thrown out.
> > > > >
> > > > > Using a servlet or on-load method I really think is the right way
> > > to go.
> > > > >
> > > > > As for on-load functionality check out JBoss-Seam jsf-comp on-load
> > > or
> > > > > the shale view handler.
> > > > >
> > > > > On 5/10/07, Todd Nine <todd.nine@gmail.com > wrote:
> > > > >> Hi all,
> > > > >>   I'm trying to call a JSF application from a plain HTML form on
> > > a
> > > > >> different
> > > > >> subdomain (and server).  Its a search so I only have 1 input
> > > field.
> > > > >> I have
> > > > >> include the code below.  I need to call the method
> > > "performSearch" on
> > > > >> the
> > > > >> bean that's associated with my searchResults.jsf page.  It
> > > renders
> > > > >> the page,
> > > > >> but never invokes the method.  What do I need in my form to do
> > > this?
> > > > >>
> > > > >> <script type="text/javascript">
> > > > >>     function clearForm(textField) {
> > > > >>     textField.value = "";
> > > > >>     }
> > > > >> </script>
> > > > >>
> > > > >> <div class="searcher">
> > > > >> <p>Search</p>
> > > > >> <form name="frmSearch" action="searchResults.jsf" method="post"
> > > > >> enctype="application/x-www-form-urlencoded">
> > > > >>     <input id="searchTerms" name="searchTerms" type="text"
> > > > >> value="Search"
> > > > >> onclick="clearForm(this);" class="searchInput"
> > > > >> onfocus="clearForm(this);" />
> > > > >>     <input id="performSearch" name="performSearch" type="image"
> > > > >> src="images/btn_go.jpg"  style="align:right;" class="go_btn" />
> > > > >>
> > > > >> </form>
> > > > >>  </div>
> > > > >>
> > > > >
> > > >
> > > >
> > > >
> > > > _________________________
> > > >
> > > > CONFIDENTIALITY NOTICE
> > > >
> > > > The information contained in this e-mail message is intended only
> > > for
> > > > the exclusive use of the individual or entity named above and may
> > > > contain information that is privileged, confidential or exempt from
> > > > disclosure under applicable law. If the reader of this message is
> > > not
> > > > the intended recipient, or the employee or agent responsible for
> > > > delivery of the message to the intended recipient, you are hereby
> > > > notified that any dissemination, distribution or copying of this
> > > > communication is strictly prohibited. If you have received this
> > > > communication in error, please notify the sender immediately by
> > > e-mail
> > > > and delete the material from any computer.  Thank you.
> > >
> > >
> >
>

Re: Calling JSF page from html page

Posted by Todd Nine <to...@gmail.com>.
Perhaps I should be more clear, my last post didn't make much sense.  I've
been using EL (obviously since I have JSF pages), but I'm not sure how to
bind to bean values using simple HTTP named params.

Thanks,
Todd

On 5/14/07, Todd Nine <to...@gmail.com> wrote:
>
> I've never heard of EL before, and I'm having trouble finding it on the
> wiki.  Thanks for your input, can you please point me in the direction of
> the documentation?
>
> Thanks,
> Todd
>
> On 5/10/07, Scott O'Bryan <da...@gmail.com> wrote:
> >
> > Use use el in your faces-config to bind the request parameters to
> > managed properties on your managed beans.  This won't CALL your code,
> > but when you retrieve the beans to render your page, the managed
> > properties should be set for you.
> >
> > Scott
> >
> > eric.jung@novartis.com wrote:
> > >
> > > How would one's code be called to manipulate this managed bean when
> > > such a request comes through? Is the only way with a PhaseListener?
> > >
> > >
> > >
> > >
> > >
> > > *"Scott O'Bryan" <da...@gmail.com>*
> > >
> > > 05/10/2007 03:06 PM
> > > Please respond to
> > > "MyFaces Discussion" < users@myfaces.apache.org>
> > >
> > >
> > >
> > > To
> > >       MyFaces Discussion <us...@myfaces.apache.org>
> > > cc
> > >
> > > Subject
> > >       Re: Calling JSF page from html page
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > Using request parameters, you could also create a managed property in
> > a
> > > managed bean in your FacesConfig.  Use EL to bind the request property
> > > to your bean.  Your bean would then be able to generate the results
> > > needed  for the bindings on your page.   :)  It removes the need to do
> >
> > > anything too fancy...
> > >
> > > Andrew Robinson wrote:
> > > > I don't think that this is not the best way of doing this. The
> > > > UICommand may not decide to decode the way you think it will. What I
> >
> > > > would recommend doing is using request parameters. In an on-load
> > style
> > > > method of your page, check for the existence of that request
> > parameter
> > > > and execute your method.
> > > >
> > > > Or you can create a custom servlet to do this. See
> > > > http://wiki.apache.org/myfaces/InvokingJsfPagesWithStandardUrls
> > > >
> > > > Also, a view will only decode and go through the lifecycle if the
> > view
> > > > was already created. In your attempt, there is no view to
> > deserialize
> > > > for the page, and thus no decode and then no actions and the
> > submitted
> > > > values will be thrown out.
> > > >
> > > > Using a servlet or on-load method I really think is the right way to
> > go.
> > > >
> > > > As for on-load functionality check out JBoss-Seam jsf-comp on-load
> > or
> > > > the shale view handler.
> > > >
> > > > On 5/10/07, Todd Nine <to...@gmail.com> wrote:
> > > >> Hi all,
> > > >>   I'm trying to call a JSF application from a plain HTML form on a
> > > >> different
> > > >> subdomain (and server).  Its a search so I only have 1 input field.
> > > >> I have
> > > >> include the code below.  I need to call the method "performSearch"
> > on
> > > >> the
> > > >> bean that's associated with my searchResults.jsf page.  It renders
> > > >> the page,
> > > >> but never invokes the method.  What do I need in my form to do
> > this?
> > > >>
> > > >> <script type="text/javascript">
> > > >>     function clearForm(textField) {
> > > >>     textField.value = "";
> > > >>     }
> > > >> </script>
> > > >>
> > > >> <div class="searcher">
> > > >> <p>Search</p>
> > > >> <form name="frmSearch" action="searchResults.jsf" method="post"
> > > >> enctype="application/x-www-form-urlencoded">
> > > >>     <input id="searchTerms" name="searchTerms" type="text"
> > > >> value="Search"
> > > >> onclick="clearForm(this);" class="searchInput"
> > > >> onfocus="clearForm(this);" />
> > > >>     <input id="performSearch" name="performSearch" type="image"
> > > >> src="images/btn_go.jpg"  style="align:right;" class="go_btn" />
> > > >>
> > > >> </form>
> > > >>  </div>
> > > >>
> > > >
> > >
> > >
> > >
> > > _________________________
> > >
> > > CONFIDENTIALITY NOTICE
> > >
> > > The information contained in this e-mail message is intended only for
> > > the exclusive use of the individual or entity named above and may
> > > contain information that is privileged, confidential or exempt from
> > > disclosure under applicable law. If the reader of this message is not
> > > the intended recipient, or the employee or agent responsible for
> > > delivery of the message to the intended recipient, you are hereby
> > > notified that any dissemination, distribution or copying of this
> > > communication is strictly prohibited. If you have received this
> > > communication in error, please notify the sender immediately by e-mail
> > > and delete the material from any computer.  Thank you.
> >
> >
>

Re: Calling JSF page from html page

Posted by Todd Nine <to...@gmail.com>.
I've never heard of EL before, and I'm having trouble finding it on the
wiki.  Thanks for your input, can you please point me in the direction of
the documentation?

Thanks,
Todd

On 5/10/07, Scott O'Bryan <da...@gmail.com> wrote:
>
> Use use el in your faces-config to bind the request parameters to
> managed properties on your managed beans.  This won't CALL your code,
> but when you retrieve the beans to render your page, the managed
> properties should be set for you.
>
> Scott
>
> eric.jung@novartis.com wrote:
> >
> > How would one's code be called to manipulate this managed bean when
> > such a request comes through? Is the only way with a PhaseListener?
> >
> >
> >
> >
> >
> > *"Scott O'Bryan" <da...@gmail.com>*
> >
> > 05/10/2007 03:06 PM
> > Please respond to
> > "MyFaces Discussion" <us...@myfaces.apache.org>
> >
> >
> >
> > To
> >       MyFaces Discussion <us...@myfaces.apache.org>
> > cc
> >
> > Subject
> >       Re: Calling JSF page from html page
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > Using request parameters, you could also create a managed property in a
> > managed bean in your FacesConfig.  Use EL to bind the request property
> > to your bean.  Your bean would then be able to generate the results
> > needed  for the bindings on your page.   :)  It removes the need to do
> > anything too fancy...
> >
> > Andrew Robinson wrote:
> > > I don't think that this is not the best way of doing this. The
> > > UICommand may not decide to decode the way you think it will. What I
> > > would recommend doing is using request parameters. In an on-load style
> > > method of your page, check for the existence of that request parameter
> > > and execute your method.
> > >
> > > Or you can create a custom servlet to do this. See
> > > http://wiki.apache.org/myfaces/InvokingJsfPagesWithStandardUrls
> > >
> > > Also, a view will only decode and go through the lifecycle if the view
> > > was already created. In your attempt, there is no view to deserialize
> > > for the page, and thus no decode and then no actions and the submitted
> > > values will be thrown out.
> > >
> > > Using a servlet or on-load method I really think is the right way to
> go.
> > >
> > > As for on-load functionality check out JBoss-Seam jsf-comp on-load or
> > > the shale view handler.
> > >
> > > On 5/10/07, Todd Nine <to...@gmail.com> wrote:
> > >> Hi all,
> > >>   I'm trying to call a JSF application from a plain HTML form on a
> > >> different
> > >> subdomain (and server).  Its a search so I only have 1 input field.
> > >> I have
> > >> include the code below.  I need to call the method "performSearch" on
> > >> the
> > >> bean that's associated with my searchResults.jsf page.  It renders
> > >> the page,
> > >> but never invokes the method.  What do I need in my form to do this?
> > >>
> > >> <script type="text/javascript">
> > >>     function clearForm(textField) {
> > >>     textField.value = "";
> > >>     }
> > >> </script>
> > >>
> > >> <div class="searcher">
> > >> <p>Search</p>
> > >> <form name="frmSearch" action="searchResults.jsf" method="post"
> > >> enctype="application/x-www-form-urlencoded">
> > >>     <input id="searchTerms" name="searchTerms" type="text"
> > >> value="Search"
> > >> onclick="clearForm(this);" class="searchInput"
> > >> onfocus="clearForm(this);" />
> > >>     <input id="performSearch" name="performSearch" type="image"
> > >> src="images/btn_go.jpg"  style="align:right;" class="go_btn" />
> > >>
> > >> </form>
> > >>  </div>
> > >>
> > >
> >
> >
> >
> > _________________________
> >
> > CONFIDENTIALITY NOTICE
> >
> > The information contained in this e-mail message is intended only for
> > the exclusive use of the individual or entity named above and may
> > contain information that is privileged, confidential or exempt from
> > disclosure under applicable law. If the reader of this message is not
> > the intended recipient, or the employee or agent responsible for
> > delivery of the message to the intended recipient, you are hereby
> > notified that any dissemination, distribution or copying of this
> > communication is strictly prohibited. If you have received this
> > communication in error, please notify the sender immediately by e-mail
> > and delete the material from any computer.  Thank you.
>
>

Re: Calling JSF page from html page

Posted by Scott O'Bryan <da...@gmail.com>.
Use use el in your faces-config to bind the request parameters to 
managed properties on your managed beans.  This won't CALL your code, 
but when you retrieve the beans to render your page, the managed 
properties should be set for you.

Scott

eric.jung@novartis.com wrote:
>
> How would one's code be called to manipulate this managed bean when 
> such a request comes through? Is the only way with a PhaseListener?
>
>
>
>
>
> *"Scott O'Bryan" <da...@gmail.com>*
>
> 05/10/2007 03:06 PM
> Please respond to
> "MyFaces Discussion" <us...@myfaces.apache.org>
>
>
> 	
> To
> 	MyFaces Discussion <us...@myfaces.apache.org>
> cc
> 	
> Subject
> 	Re: Calling JSF page from html page
>
>
>
> 	
>
>
>
>
>
> Using request parameters, you could also create a managed property in a
> managed bean in your FacesConfig.  Use EL to bind the request property
> to your bean.  Your bean would then be able to generate the results
> needed  for the bindings on your page.   :)  It removes the need to do
> anything too fancy...
>
> Andrew Robinson wrote:
> > I don't think that this is not the best way of doing this. The
> > UICommand may not decide to decode the way you think it will. What I
> > would recommend doing is using request parameters. In an on-load style
> > method of your page, check for the existence of that request parameter
> > and execute your method.
> >
> > Or you can create a custom servlet to do this. See
> > http://wiki.apache.org/myfaces/InvokingJsfPagesWithStandardUrls
> >
> > Also, a view will only decode and go through the lifecycle if the view
> > was already created. In your attempt, there is no view to deserialize
> > for the page, and thus no decode and then no actions and the submitted
> > values will be thrown out.
> >
> > Using a servlet or on-load method I really think is the right way to go.
> >
> > As for on-load functionality check out JBoss-Seam jsf-comp on-load or
> > the shale view handler.
> >
> > On 5/10/07, Todd Nine <to...@gmail.com> wrote:
> >> Hi all,
> >>   I'm trying to call a JSF application from a plain HTML form on a
> >> different
> >> subdomain (and server).  Its a search so I only have 1 input field.  
> >> I have
> >> include the code below.  I need to call the method "performSearch" on
> >> the
> >> bean that's associated with my searchResults.jsf page.  It renders
> >> the page,
> >> but never invokes the method.  What do I need in my form to do this?
> >>
> >> <script type="text/javascript">
> >>     function clearForm(textField) {
> >>     textField.value = "";
> >>     }
> >> </script>
> >>
> >> <div class="searcher">
> >> <p>Search</p>
> >> <form name="frmSearch" action="searchResults.jsf" method="post"
> >> enctype="application/x-www-form-urlencoded">
> >>     <input id="searchTerms" name="searchTerms" type="text"
> >> value="Search"
> >> onclick="clearForm(this);" class="searchInput"
> >> onfocus="clearForm(this);" />
> >>     <input id="performSearch" name="performSearch" type="image"
> >> src="images/btn_go.jpg"  style="align:right;" class="go_btn" />
> >>
> >> </form>
> >>  </div>
> >>
> >
>
>
>
> _________________________
>
> CONFIDENTIALITY NOTICE
>
> The information contained in this e-mail message is intended only for 
> the exclusive use of the individual or entity named above and may 
> contain information that is privileged, confidential or exempt from 
> disclosure under applicable law. If the reader of this message is not 
> the intended recipient, or the employee or agent responsible for 
> delivery of the message to the intended recipient, you are hereby 
> notified that any dissemination, distribution or copying of this 
> communication is strictly prohibited. If you have received this 
> communication in error, please notify the sender immediately by e-mail 
> and delete the material from any computer.  Thank you.


Re: Calling JSF page from html page

Posted by er...@novartis.com.
How would one's code be called to manipulate this managed bean when such a 
request comes through? Is the only way with a PhaseListener?






"Scott O'Bryan" <da...@gmail.com> 
05/10/2007 03:06 PM
Please respond to
"MyFaces Discussion" <us...@myfaces.apache.org>


To
MyFaces Discussion <us...@myfaces.apache.org>
cc

Subject
Re: Calling JSF page from html page






Using request parameters, you could also create a managed property in a 
managed bean in your FacesConfig.  Use EL to bind the request property 
to your bean.  Your bean would then be able to generate the results 
needed  for the bindings on your page.   :)  It removes the need to do 
anything too fancy...

Andrew Robinson wrote:
> I don't think that this is not the best way of doing this. The
> UICommand may not decide to decode the way you think it will. What I
> would recommend doing is using request parameters. In an on-load style
> method of your page, check for the existence of that request parameter
> and execute your method.
>
> Or you can create a custom servlet to do this. See
> http://wiki.apache.org/myfaces/InvokingJsfPagesWithStandardUrls
>
> Also, a view will only decode and go through the lifecycle if the view
> was already created. In your attempt, there is no view to deserialize
> for the page, and thus no decode and then no actions and the submitted
> values will be thrown out.
>
> Using a servlet or on-load method I really think is the right way to go.
>
> As for on-load functionality check out JBoss-Seam jsf-comp on-load or
> the shale view handler.
>
> On 5/10/07, Todd Nine <to...@gmail.com> wrote:
>> Hi all,
>>   I'm trying to call a JSF application from a plain HTML form on a 
>> different
>> subdomain (and server).  Its a search so I only have 1 input field. 
>> I have
>> include the code below.  I need to call the method "performSearch" on 
>> the
>> bean that's associated with my searchResults.jsf page.  It renders 
>> the page,
>> but never invokes the method.  What do I need in my form to do this?
>>
>> <script type="text/javascript">
>>     function clearForm(textField) {
>>     textField.value = "";
>>     }
>> </script>
>>
>> <div class="searcher">
>> <p>Search</p>
>> <form name="frmSearch" action="searchResults.jsf" method="post"
>> enctype="application/x-www-form-urlencoded">
>>     <input id="searchTerms" name="searchTerms" type="text" 
>> value="Search"
>> onclick="clearForm(this);" class="searchInput" 
>> onfocus="clearForm(this);" />
>>     <input id="performSearch" name="performSearch" type="image"
>> src="images/btn_go.jpg"  style="align:right;" class="go_btn" />
>>
>> </form>
>>  </div>
>>
>



_________________________

CONFIDENTIALITY NOTICE

The information contained in this e-mail message is intended only for the 
exclusive use of the individual or entity named above and may contain 
information that is privileged, confidential or exempt from disclosure 
under applicable law. If the reader of this message is not the intended 
recipient, or the employee or agent responsible for delivery of the 
message to the intended recipient, you are hereby notified that any 
dissemination, distribution or copying of this communication is strictly 
prohibited. If you have received this communication in error, please 
notify the sender immediately by e-mail and delete the material from any 
computer.  Thank you.

Re: Calling JSF page from html page

Posted by Scott O'Bryan <da...@gmail.com>.
Using request parameters, you could also create a managed property in a 
managed bean in your FacesConfig.  Use EL to bind the request property 
to your bean.  Your bean would then be able to generate the results 
needed  for the bindings on your page.   :)  It removes the need to do 
anything too fancy...

Andrew Robinson wrote:
> I don't think that this is not the best way of doing this. The
> UICommand may not decide to decode the way you think it will. What I
> would recommend doing is using request parameters. In an on-load style
> method of your page, check for the existence of that request parameter
> and execute your method.
>
> Or you can create a custom servlet to do this. See
> http://wiki.apache.org/myfaces/InvokingJsfPagesWithStandardUrls
>
> Also, a view will only decode and go through the lifecycle if the view
> was already created. In your attempt, there is no view to deserialize
> for the page, and thus no decode and then no actions and the submitted
> values will be thrown out.
>
> Using a servlet or on-load method I really think is the right way to go.
>
> As for on-load functionality check out JBoss-Seam jsf-comp on-load or
> the shale view handler.
>
> On 5/10/07, Todd Nine <to...@gmail.com> wrote:
>> Hi all,
>>   I'm trying to call a JSF application from a plain HTML form on a 
>> different
>> subdomain (and server).  Its a search so I only have 1 input field.  
>> I have
>> include the code below.  I need to call the method "performSearch" on 
>> the
>> bean that's associated with my searchResults.jsf page.  It renders 
>> the page,
>> but never invokes the method.  What do I need in my form to do this?
>>
>> <script type="text/javascript">
>>     function clearForm(textField) {
>>     textField.value = "";
>>     }
>> </script>
>>
>> <div class="searcher">
>> <p>Search</p>
>> <form name="frmSearch" action="searchResults.jsf" method="post"
>> enctype="application/x-www-form-urlencoded">
>>     <input id="searchTerms" name="searchTerms" type="text" 
>> value="Search"
>> onclick="clearForm(this);" class="searchInput" 
>> onfocus="clearForm(this);" />
>>     <input id="performSearch" name="performSearch" type="image"
>> src="images/btn_go.jpg"  style="align:right;" class="go_btn" />
>>
>> </form>
>>  </div>
>>
>


Re: Calling JSF page from html page

Posted by Andrew Robinson <an...@gmail.com>.
I don't think that this is not the best way of doing this. The
UICommand may not decide to decode the way you think it will. What I
would recommend doing is using request parameters. In an on-load style
method of your page, check for the existence of that request parameter
and execute your method.

Or you can create a custom servlet to do this. See
http://wiki.apache.org/myfaces/InvokingJsfPagesWithStandardUrls

Also, a view will only decode and go through the lifecycle if the view
was already created. In your attempt, there is no view to deserialize
for the page, and thus no decode and then no actions and the submitted
values will be thrown out.

Using a servlet or on-load method I really think is the right way to go.

As for on-load functionality check out JBoss-Seam jsf-comp on-load or
the shale view handler.

On 5/10/07, Todd Nine <to...@gmail.com> wrote:
> Hi all,
>   I'm trying to call a JSF application from a plain HTML form on a different
> subdomain (and server).  Its a search so I only have 1 input field.  I have
> include the code below.  I need to call the method "performSearch" on the
> bean that's associated with my searchResults.jsf page.  It renders the page,
> but never invokes the method.  What do I need in my form to do this?
>
> <script type="text/javascript">
>     function clearForm(textField) {
>     textField.value = "";
>     }
> </script>
>
> <div class="searcher">
> <p>Search</p>
> <form name="frmSearch" action="searchResults.jsf" method="post"
> enctype="application/x-www-form-urlencoded">
>     <input id="searchTerms" name="searchTerms" type="text" value="Search"
> onclick="clearForm(this);" class="searchInput" onfocus="clearForm(this);" />
>     <input id="performSearch" name="performSearch" type="image"
> src="images/btn_go.jpg"  style="align:right;" class="go_btn" />
>
> </form>
>  </div>
>