You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by ying lcs <yi...@gmail.com> on 2006/10/12 22:13:49 UTC
URL of myfaces application
Is it possible to change the myfaces application URL so that it does
not use '*.jsf' in the URL? And is it possible to pass in an argument
(in my example ("abc = 1") in the myface URL ?
http://localhost:8080/myfaceapplication.jsf?abc=1
If yes, how can myface application get this value?
Thank you.
Re: URL of myfaces application
Posted by Roger Keays <ro...@ninthavenue.com.au>.
ying lcs wrote:
> Is it possible to change the myfaces application URL so that it does
> not use '*.jsf' in the URL?
change your web.xml:
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.myext</url-pattern>
</servlet-mapping>
or
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/app/*</url-pattern>
</servlet-mapping>
you can also change the extension for your jsp/facelets templates:
<!-- use documents saved as *.xhtml -->
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
And is it possible to pass in an argument
> (in my example ("abc = 1") in the myface URL ?
>
> http://localhost:8080/myfaceapplication.jsf?abc=1
>
> If yes, how can myface application get this value?
java:
FacesContext.getExternalContext().getRequestParameterMap().get("abc");
el: ${param.abc}
--
----------------------------------------
Ninth Avenue Software
p: +61 7 3137 1351 (UTC +10)
f: +61 7 3102 9141
w: http://www.ninthavenue.com.au
e: info@ninthavenue.com.au
----------------------------------------
Re: URL of myfaces application
Posted by Mert Çalışkan <mc...@gmail.com>.
In the backing bean of the target page, define a variable.Iinitialize its
value in the getter method.
*private *String myParam;
*public *String getMyParam() {
*if *(myParam == *null*) {
myParam = (String) expressionResolver("#{param.abc}");
}
*return *myParam;
}
*public **void *setMyParam(String myParam) {
*this*.myParam = myParam;
}
*public *Object expressionResolver(String expression) {
Object value = *null*;
*if *((expression.indexOf("#{") != -1) && (expression.indexOf("#{")
< expression.indexOf('}'))) {
value = getFacesContext().getApplication().createValueBinding(
expression).getValue(getFacesContext());
} *else *{
value = expression;
}
*return *value;
}
Declare an input hidden field.to use it on the page.
<h:inputHidden id="hiddenParam" value="#{yourBackingBean.abc}"/>
Now you can use it even in js..
var myParam = document.getElementById('form1:hiddenParam').value;
Regards,
Mert
http://www.jroller.com/page/mert
On 10/12/06, ying lcs <yi...@gmail.com> wrote:
>
> Is it possible to change the myfaces application URL so that it does
> not use '*.jsf' in the URL? And is it possible to pass in an argument
> (in my example ("abc = 1") in the myface URL ?
>
> http://localhost:8080/myfaceapplication.jsf?abc=1
>
> If yes, how can myface application get this value?
>
> Thank you.
>
Re: URL of myfaces application
Posted by Ron Smits <ro...@ronsmits.org>.
if you look in web.xml you should see how you can map what is used to
trigger the servlet. Usually this is either */jsf or /faces/
Ron
On Thu, 2006-10-12 at 15:13 -0500, ying lcs wrote:
> Is it possible to change the myfaces application URL so that it does
> not use '*.jsf' in the URL? And is it possible to pass in an argument
> (in my example ("abc = 1") in the myface URL ?
>
> http://localhost:8080/myfaceapplication.jsf?abc=1
>
> If yes, how can myface application get this value?
>
> Thank you.