[JBoss Seam] - creating Edit forms for transaltable entities - and keep ma
by marius.oancea
If you edit simple objects like Users, you can have thinks like:
<h:inputText value="#{user.username}" required="true"/>
This is very simple because user.username is a simple string and binding to the input fields is evident.
How one would approach the following problem:
I have a entity named "Word". Word has a name that is different in every language. So I have the following structure:
Word Translation
==== ==========
name : Translation --------------> language: String
text: String
Binding input fields like below, is not possible:
<h:inputText value="#{word.name(selectedLanguage)}" required="true"/>
What is the most elegant way to solve that?
Note:
selectedLanguage is a statefull component.
One posibility is to create a WordWrapper component in wich I inject selectedLanguage, and a word object. Then I provide methods for binding (set/get for name in selected language). This will work I think but I have very many Classes like Word and will be much work.
Any better approach to write less code ?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4095162#4095162
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4095162
18Â years, 9Â months
[JBoss jBPM] - delay task execution jpdl
by cla83
ok i've solved the deploy problem (wrong xml tag) and i've tried this solution:
| ...
| <start-state name="start">
| <event type="node-enter">
| <script>System.out.println("ciao mamma!!!!!!!!!!!!!!!!");</script>
| </event>
| ...
| <state name="wait">
| <event type="node-enter">
| <create-timer duedate="60 seconds" transition="continue">
| <script>System.out.println("ciao mamma");</script>
| </create-timer>
| </event>
| <transition name="continue" to="Control"></transition>
| </state>
| ...
|
but when the flow reach the wait state the token don't leave it.
How you can see i've also added 2 script but in both cases the server console don't show the message:"ciao mamma"
Can be a jvm probem??
P.S.I'm sorry for my ignorance
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4095158#4095158
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4095158
18Â years, 9Â months
[JBoss Seam] - component injection seam 1.2.1. ga
by ccode
environment
jboss 4.2
seam 1.2.1
i have seam component
package iu.ce.ejb.service;
| import javax.ejb.Local;
| import iu.ce.entity.User;
| @Local
| public interface UserService {
| public User getUser(String username, String password);
| }
| import iu.ce.service.UserService;
|
| import javax.ejb.Stateless;
| import javax.persistence.EntityManager;
| import javax.persistence.NoResultException;
| import javax.persistence.PersistenceContext;
| import javax.persistence.Query;
|
| import org.jboss.seam.annotations.In;
| import org.jboss.seam.annotations.Logger;
| import org.jboss.seam.annotations.Name;
| import org.jboss.seam.annotations.Out;
| import org.jboss.seam.log.Log;
| import org.jboss.seam.security.Identity;
|
| @Stateless
| @Name("userServiceBean")
| public class UserServiceBean implements UserService {
| @In
| Identity identity;
| @Logger
| Log log;
| @PersistenceContext(unitName = "iuce")
| private EntityManager entityManager;
|
|
| public User getUser(String username, String password) {
| try {
| Query q = entityManager.createQuery("from User u where"
| + " username=:username and password=:password");
| q.setParameter("username", username);
| q.setParameter("password", password);
| return (User) q.getSingleResult();
| } catch (NoResultException e) {
| return null;
| }
| }
| public void authenticate() {
| log.info("authenticating #0", identity.getUsername());
| getUser("", "");
| //getUser("h","h");
| //userServiceBean.getUser("h", "h");
| // write your authentication logic here,
| // return true if the authentication was
| // successful, false otherwise
| identity.addRole("admin");
| //return true;
| }
| }
authentication works fine
in application server log
00:47:29,153 INFO [Component] Component: userServiceBean, scope: STATELESS, type: STATELESS_SESSION_BEAN, class: iu.ce.bean.UserServiceBean, JNDI: iuce-ear/UserServiceBean/local
component seems installed
i have another component standart Authentication component which wizards creates.
when i tried to insert this
@In(create=true)
| UserBeanService userBeanService
|
or
@In
| UserBeanService userBeanService
|
it gives following error
| In attribute requires non-null value ...
|
UserServiceBean returns null.
i want to learn how can i inject seam component to another component.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4095151#4095151
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4095151
18Â years, 9Â months