This content has been marked as final.
Show 9 replies
-
1. Re: Best practice for using page request parameter in query restrictions
wespe Dec 19, 2008 12:48 PM (in response to wespe)Anybody?
-
2. Re: Best practice for using page request parameter in query restrictions
luke.poldo.mailinator.com Dec 19, 2008 1:12 PM (in response to wespe)and in pages.xml there's the parameter?
<page view-id="/dossierShow.xhtml"> <param name="dossierId" value="#{dossierHome.id}" converterId="javax.faces.Long"/> </page>
-
3. Re: Best practice for using page request parameter in query restrictions
mail.micke Dec 19, 2008 1:46 PM (in response to wespe)You need to grab it like this #{params.requestTypeId}.
-
4. Re: Best practice for using page request parameter in query restrictions
mail.micke Dec 19, 2008 1:48 PM (in response to wespe)or maybe it is #{param.requestTypeId} , can't quite remember.
-
5. Re: Best practice for using page request parameter in query restrictions
wespe Dec 19, 2008 4:07 PM (in response to wespe)Thanks for the reply, yes it's there.
-
6. Re: Best practice for using page request parameter in query restrictions
wespe Dec 19, 2008 4:11 PM (in response to wespe)This one would work, but now I get:
Caused by: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.LongIs there a way to convert the parameter to Long in restrictions?
-
7. Re: Best practice for using page request parameter in query restrictions
wespe Dec 19, 2008 4:21 PM (in response to wespe)I have it in pages.xml like this:
<rule if-outcome="browseFeature"> <redirect view-id="/requestList.xhtml"> <param name="requestTypeId" value="#{featureTypeId}" converterId="javax.faces.Long" /> </redirect> </rule>
-
8. Re: Best practice for using page request parameter in query restrictions
wespe Dec 19, 2008 4:31 PM (in response to wespe)Interesting.. If I specify it like this:
<framework:entity-query ejbql="select r from Request r where r.requestType=#{param.requestTypeId}" name="myRequestList" order="createdAt"> </framework:entity-query>
Then it's working.. but if I use restrictions then it does not..
Is this the way it meant to be? -
9. Re: Best practice for using page request parameter in query restrictions
mail.micke Dec 19, 2008 4:42 PM (in response to wespe)Haven't tried what you are doing.
But my guess would have been that
<param name="requestTypeId" value="#{featureTypeId}" converterId="javax.faces.Long" />
created Long object directly accessible via #{featureTypeId}, does it work if you use that instead of the #{param.requestTypeId}?
Otherwise you could create a
holder class
.@Name("featureReqBean") public class FeatureReqBean{ private Long featureTypeId; //getters setters }
and then do
<rule if-outcome="browseFeature"> <redirect view-id="/requestList.xhtml"> <param name="requestTypeId" value="#{featureReqBean.featureTypeId}" converterId="javax.faces.Long" /> </redirect> </rule> <framework:entity-query ejbql="select r from Request r where r.requestType=#{featureReqBean.requestTypeId}" name="myRequestList" order="createdAt"> </framework:entity-query>
Just guessing though ;)
- micke