[JBoss Seam] - Page action pain, new stateless component instance?
by grettke_spdr
Hi guys,
Question for you. I've got a RESTFul page whose sole purpose is to prepare another page. It has an action that only gets run once. As such, it is set up to immediately redirect to another page (since I don't want that action run every single time). Here is how it looks
| <page view-id="/prepareInspectionRequest.xhtml"
| action="#{inspectionRequestAction.preparePage}">
| <param name="accountNumber"
| value="#{inspectionRequestAction.accountNumber}"/>
| <param name="userProfile"
| value="#{inspectionRequestAction.userProfile}"/>
|
| <navigation from-action="#{inspectionRequestAction.preparePage}">
| <rule if="#{inspectionRequestAction.validRequest}">
| <redirect view-id="/inspectionRequest.xhtml"/>
| </rule>
| <rule if="#{not inspectionRequestAction.validRequest}">
| <redirect view-id="/message.xhtml"/>
| </rule>
| </navigation>
| </page>
|
As written, when I step through inspectionRequestAction with the debugger, I evalute "this.hashCode()" within the setter for accountNumber and it evaluates to 29656067. When I step into preparePage and evalute hashCode I get 11498117. This is confusing to me because this is a stateless bean. The result of my setup is that my fields don't get populated correctly.
What am I doing wrong here?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4059677#4059677
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4059677
17Â years, 6Â months
[JBoss Seam] - Does Seam really support back buttoning?
by hkarapuu
I assumed that the back buttoning support would mean that the contents of the conversation scope would be rolled back to a previous state when using browser back button -- a.k.a continuations style, as in Spring Web Flows.
For example I have a page, which shows a number, which is stored in conversation scope. The page has a button. I click the button, the number increases. Exciting. I click the button five times, and the number is now five. I click the browser back button three times, and the number is two. I click the increase button on the page.
With all other 'back browser supporting' systems the result is 3.
With seam, the result is 6, just as if i had stored the value in Session scope instead of Conversation scope.
Is this the expected result? Meaning, did i understand what the back browser support means in Seam too optimistically, or am i just Doing Something Wrong?
Thanks,
Henri Karapuu
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4059675#4059675
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4059675
17Â years, 6Â months
[Beginners Corner] - Re: JBoss installation: What EXACTLY I need to download
by PeterJ
There is no single download that bundles all of the middleware components, you have to download each one separately. Also, what you end up downloading depends on the compatibility of the components. For example, if you need JBoss Portal, you will want to stick with JBoss AS 4.0.5.
Let's discuss JBoss AS a little bit. It would help if you gave a little more information on what technologies you plan to use. If you want EJB3, use 4.2. If you don't need EJB3, you might want to stick with 4.0.5. I should point out that there is no documentation available for 4.2, in which case 4.0.5 might be the best to start with. (JBoss AS contains the Hibernate runtime, but if you want to do development work you still should download Hibernate. JBoss AS does not contain jBPM.)
For the other middleware components, use the latest release identified as "GA" or "stable".
Also, the primary download page for all components is at http://labs.jboss.com/projects/download.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4059670#4059670
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4059670
17Â years, 6Â months
[JBoss Seam] - Securing components
by rapowder
Hi I am trying to add user management to my seam application (v. 1.2.1GA) and I'm getting some problems when assigning specific method access to different roles. Precisely, when I call Identity.instance().hasRole("admin") I get false although I setted the correct user role at login. Here is my Login class:
| @Stateless
| @Name("login")
| public class LoginAction implements Login {
|
| @In @Out
| private User user;
|
| @In(create = true, value = "spotme2EM")
| private EntityManager em;
|
| [...]
|
| public String login() {
|
| User userReference = find(user.getName(), user.getPassword());
|
| if(userReference != null) {
|
| Identity id = Identity.instance();
| id.setUsername(userReference.getName());
| id.setPassword(userReference.getPassword());
| id.addRole(userReference.getRole().name());
| try {
| id.authenticate();
| } catch (LoginException e) {
| e.printStackTrace();
| }
|
| sessionContext.set("loggedIn", true);
|
| return "home";
| }
| else {
| log.info("Invalid Login!");
| facesContext.addMessage(null, new FacesMessage("Invalid login"));
| return null;
| }
|
|
In another bean, I do the check like this:
public String delete() {
| public String deleteItem() {
|
| if (!Identity.instance().hasRole(CoreConstants.UserRole.ADMIN.name()))
| throw new AuthorizationException("Must be admin to perform this action!");
|
| [...]
| }
|
And of course the exception is always thrown... Any suggestions?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4059669#4059669
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4059669
17Â years, 6Â months
[JBoss Seam] - validation / exception handling patterns with EntityHome
by mbertelsen
We've got some simple CRUD operations that we're doing just by declaring an entity-query and entity-home in components.xml, and building a list page and a form page that bind to them. It works great, but one of our classes has a unique constraint on one of the fields. Right now, if you enter data on the edit form and submit (this is bound to {#entityHome.persist}, the persist method throws a SQLException which is handled by the normal seam exception handling - I get a generic error page for the SQLException.
I'd rather get a validation failure for the field *before* the persist fails, so I can show it on the edit form next to the field that needs to be unique, rather than handling it with an error page. It'd be less nice but acceptable to show the error as a general Faces Message. I guess I'd need to write a class that extends EntityHome and implements this behavior, but I thought I'd check if there was a better way.
We have a similar problem with delete when a foreign key is violated - I'd like to know what the recommendation is for handling the exception - Should I build a custom error page for SQLException, and try to parse the exception / message there to determine the key that failed? Or is extending EntityHome and throwing a custom exception a better way? Is there another better way?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4059665#4059665
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4059665
17Â years, 6Â months