-
1. Re: Using EL in backend Java code?
samdoyle Oct 31, 2007 5:12 PM (in response to samdoyle)Something like:
String userName = "#{identity.username}";
How would you do this? -
2. Re: Using EL in backend Java code?
samdoyle Oct 31, 2007 6:33 PM (in response to samdoyle)Anyone?
-
3. Re: Using EL in backend Java code?
samdoyle Oct 31, 2007 7:42 PM (in response to samdoyle)Still looking. All I see when searching on Google is people complaining about SeamElResolver not working.
-
4. Re: Using EL in backend Java code?
samdoyle Oct 31, 2007 7:56 PM (in response to samdoyle)The only thing I see that resembles what I am looking for is some Test based examples which have no indication on how to do it in a Session Bean
@Test public void testSayHello() throws Exception { new FacesRequest("/hello.jsp") { @Override protected void updateModelValues() throws Exception { setValue("#{person.name}","Michael Yuan"); } @Override protected void invokeApplication() { assert getValue ("#{person.name}").equals("Michael Yuan"); assert invokeMethod("#{manager.sayHello}") == null; assert getValue ("#{person.name}") == null; } @Override protected void renderResponse() { List<Person> fans = (List<Person>) getValue("#{fans}"); assert fans!=null; assert fans.get(fans.size()-1) .getName().equals("Michael Yuan"); } }.run(); } TestNG-based The entire JSF lifecycle as well as database session are mocked
-
5. Re: Using EL in backend Java code?
dustismo Oct 31, 2007 11:07 PM (in response to samdoyle)Why not just do this?
Identity.instance().getUsername()
-
6. Re: Using EL in backend Java code?
v.masterov Nov 1, 2007 2:44 AM (in response to samdoyle)Expressions.instance().createValueExpression(#{myBean.myProperty})
returns Object. It needs to cast to your object type.Interpolator.instance().interpolate(#{myBean.myProperty})
returns String. -
7. Re: Using EL in backend Java code?
damianharvey Nov 1, 2007 11:49 AM (in response to samdoyle)This is an easy option:
@In(value=#{identity.username}) String username;
(had to remove double quotes as phpBB was choking on them for some reason)
Cheers,
Damian. -
8. Re: Using EL in backend Java code?
igx89 Nov 1, 2007 12:01 PM (in response to samdoyle)It is actually not phpBB, just a very old and embarrasingly messed up version of jForum :/
-
9. Re: Using EL in backend Java code?
pmuir Nov 1, 2007 12:35 PM (in response to samdoyle)Its horrible - soon we will have a lovely new forum :)
-
10. Re: Using EL in backend Java code?
supernovasoftware.com Nov 1, 2007 12:54 PM (in response to samdoyle)I remember reading the new forum is based on Seam. When will it be ready and is there a beta version I can try?
Will it be open source? -
11. Re: Using EL in backend Java code?
pmuir Nov 1, 2007 1:10 PM (in response to samdoyle)I remember reading the new forum is based on Seam. When will it be ready and is there a beta version I can try?
Will it be open source?
Soon now (we really are getting closer) but I'm not sure how long exactly. It's all based around the wiki architecture that Christian is building (which is used to run http://in.relation.to/ and is available in Seam examples now (though the forums aren't finished). It will be under the same license as Seam. -
12. Re: Using EL in backend Java code?
supernovasoftware.com Nov 1, 2007 1:16 PM (in response to samdoyle)This is great. Real seam applications as opposed to smaller area specific examples will prove quite useful for learning how to structure larger applications.
Plus, I could use a nice forum for my inventory tracking software. :) -
13. Re: Using EL in backend Java code?
samdoyle Nov 1, 2007 3:33 PM (in response to samdoyle)"v.masterov@gmail.com" wrote:
Expressions.instance().createValueExpression(#{myBean.myProperty})
returns Object. It needs to cast to your object type.Interpolator.instance().interpolate(#{myBean.myProperty})
returns String. -
14. Re: Using EL in backend Java code?
samdoyle Nov 1, 2007 3:41 PM (in response to samdoyle)I'll give that at try, thanks.