aspose file tools*
The moose likes JSF and the fly likes commandLink in table -> javax.servlet.ServletException: Can't find bundle Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "commandLink in table -> javax.servlet.ServletException: Can Watch "commandLink in table -> javax.servlet.ServletException: Can New topic
Author

commandLink in table -> javax.servlet.ServletException: Can't find bundle

Markus Schmider
Ranch Hand

Joined: Feb 25, 2007
Posts: 109
Hallo
I am using JBoss 6 (Mojarra 2.0)

When I press the commandButton I get

The problem is the

When I remove it the application works.

I have no idea what this means or how I can solve the problems.

Many thanks for any input.

Hans
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16303
    
  21

Time to be pedantic again:

Backing beans are not Controllers. They are Models.

I'll be glad to discuss nuances, but I've seen what kind of horrors people code when they don't observe the distinction. Hence, the not-so-subtle hint.

Bundles are typically attached to JSF webapps in faces-config.xml file. A Bundle is a classpath object, so the rules on naming and locating bundles are the same as for classes.

That would commonly mean a file in the WEB-INF/classes/resources/application directory. Or, actually, I suspect that it's looking for a bundle named "application" in the WEB-INF/classes/resources directory. Since the point of bundles is to support I18N, the actual bundle name needs to be something like "application.en" for standard English.


Customer surveys are for companies who didn't pay proper attention to begin with.
Markus Schmider
Ranch Hand

Joined: Feb 25, 2007
Posts: 109
After some research I have added
el-api-1.1.jar
el-impl-1.1.jar
to the lib directory of JBoss
and

to web.xml
Now at least I get an error message which makes more sense:


Still...
I am trying to emulate an article from a Java magazine which shows that it should be possible to use the variable declared in <h:dataTable var="...">
in method expressions.
Markus Schmider
Ranch Hand

Joined: Feb 25, 2007
Posts: 109
to Tim.
Thanks for your kind reply.

I have separated controller from model Logic: The Controller has a reference to the model.
If you know a more elegant way I would be very interested to learn it.

By the way my problem is about Method Expression Parameters. Perhaps should have expressed myself more clearly.

Thanks,

Hans
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16303
    
  21

JSF apps have little or no user-written Controller code in them. Mostly it uses canned Controller components (the FacesServlet and JSF Tag processors) which are wired up in the Views to their corresponding Models.

Action processors are not Controllers. They're the entry into the business methods that are fired when a command Controller such as a commandButton or commandLink is activated. Or lately, by AJAX, but the same mechanism applies. "Pure" MVC doesn't actually address what to do with data, just how to keep a model and its view in sync via Controllers. In the real world, of course, we do have to jump off into practical applications (business logic), and that's what the Action methods for.

Ideally, one would keep the Actions separate from the Backing properties, but in actual practice, it's usually more trouble than it's worth.

It is not a good idea to attempt to invoke Action methods as though they were general-purpose functions. Although JSF2 makes parameterizing things easier, the original concept was for Action methods to accept no parameters and return a navigation indicator (String). Parameters are neither required nor desirable, because the action processor should be accessing data directly from the Model, not from the View. Putting stuff like that in the View clutters up the View definition, ties it more tightly to a specific usage, adds network overhead, and on top of all that, is a potential security hazard.

Just to make things even more problematic, the EL language used on View definitions is NOT java, any more than JavaScript is. EL has its own syntax, restrictions and modes of operation. When it comes to EL, simpler is better.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: commandLink in table -> javax.servlet.ServletException: Can't find bundle