[JBoss Seam] - Parameter passing for page action
by milli
Hi,
How do I pass parameters in the following scenerio?(instead of using session scope)
@Name("home")
| Class Home
| {
| private Category category;
|
| public getCategory()
| {
| if (null == category)
| category = CategoryHome.find(id);
| return category;
| }
| }
home.xhtml:
.....
<h:commandLink action="#{categoryAction.action(home.category)}" value="Action" />
@Name(categoryAction)
| Class CategoryAction
| {
| private Category category;
|
| public Category getCategory()
| {
| return category;
| }
|
| public String action(Category category)
| {
| this.category = category
| return "category.xhtml"
| }
| }category.xhtml:
displays #{categoryAction.category.name} and #{categoryAction.category.description}
If I do as above, the category is always null in category.xhtml. If I set the categoryAction scope to Session it works. I'm trying to find out if there is a better way to do this without using session scope.
If I'm doing something wrong could you please let me know the right way of doing it. Basically I want to be able to pass objects from home page(home component) to category page(categoryAction component) avoiding another DB query.
Any help would be appreciated.
Thanks.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4044601#4044601
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4044601
19 years, 1 month
[Performance Tuning] - Jndi lookup performance
by int2
Hi everyone,
I have done a simple test on jndi lookup (on a separated client). I just really upset that the average time for the lookup is around 400 ms (local machine) and 500ms (remote machine).
I just wonder is there something wrong with my performance optimization ?
Following is the code of the client
public static void main(String[] args) {
| // TODO Auto-generated method stub
|
| if (System.getSecurityManager() == null)
| System.setSecurityManager(new RMISecurityManager());
| Calendar c = Calendar.getInstance();
|
| Properties env = new Properties();
| env.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
| //switch to 'localhost:1100' for performance comparison
| env.setProperty("java.naming.provider.url", "192.168.1.2:1099");
| env.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming");
| try{
| long start = System.currentTimeMillis();
| Context ctx = new InitialContext(env);
| Object ref = ctx.lookup("BBean/remote");
|
|
| long end = System.currentTimeMillis();
| long el = end - start;
| System.out.println("elapse(ms): " + el);
| }
| catch(NamingException e){
| e.printStackTrace();
| }
| }
Thank you a lot and regards
Boehm
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4044599#4044599
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4044599
19 years, 1 month