/**
* @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 <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]> 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 < [EMAIL PROTECTED]> 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 < [EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]> 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
> > > > >
> > > > > [EMAIL PROTECTED] 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" <[EMAIL PROTECTED]>*
> > > > > >
> > > > > > 05/10/2007 03:06 PM
> > > > > > Please respond to
> > > > > > "MyFaces Discussion" < [email protected]>
> > > > > >
> > > > > >
> > > > > >
> > > > > > To
> > > > > > MyFaces Discussion < [email protected]>
> > > > > > 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 <[EMAIL PROTECTED] > 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.
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>