[JBoss Seam] - seam-gen , Authenticate and EntityHome
by hvram
Hi
My application uses the generate-entities to reverse engineer an existing DB schema . I am using the pages generated using seam-gen.
I am trying to plug in the authentication and I am wondering what is the correct way to go about it .
I did the following in Authenticator.java
@Out (scope=Session)
User user;
and in the authenticate method I set the user object.
But the pages generated by seam-gen refer to the UserHome object instead of user.
When I try to do a
@In (create=true)
@Out (Scope=Session)
UserHome userHome
OR
userHome = Component.getInstance("userHome)
things do not work . The userHome object if viewed using the debug.seam shows illegalStateException for the Collection objects
So should I
a) rewrite the pages to refer to user instead of userHome . If that is the case can I use the persist methods of EntityHome or should I write those methods again
b) Any other way to solve the problem ? Is there are different approach to authentication
Thanks in Advance
Regards
Hari
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4040306#4040306
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4040306
19 years
[JBoss Seam] - EntityHome, ajax4JSF and Pagination
by gledson.rabelo
Hi,
I'm using the Seam EntityHome and Ajax4JSF for developing ajax enabled CRUDs with pagination.
The data table has checkboxs that the user can select to delete many entities.
When I go to the next page (>), the listPanel is rerendered and the checkboxs should be cleaned for the new entities of current page.
But when I selected one checkbox and go to the next page, it remains checked in the next page.
And when I clicked in the Remove button ("Excluir") and I'm in the middle page, the ids of the first are sended for the removeChecked operation.
My Code is listed below.
Please, Could somebody help me?
|
| <a4j:form>
| ...
|
| <a4j:outputPanel id="listPanel" ajaxRendered="true" layout="block">
|
| <!-- search results -->
|
| <rich:dataTable value="#{questionarios.resultList}" var="questionario"
| id="table">
| <!-- Table Header -->
| <f:facet name="header">
| <rich:columnGroup>
| <rich:column>
| <h:outputText value="Seleção" />
| </rich:column>
| <rich:column>
| <h:outputText value="Id" />
| </rich:column>
| <rich:column>
| <a4j:commandLink value="-" reRender="listPanel">
| <f:param name="querySorting" value="descricao" />
| </a4j:commandLink>
| <h:outputText value="Descrição" />
| </rich:column>
| <rich:column>
| <a4j:commandLink value="-" reRender="listPanel">
| <f:param name="querySorting" value="exercicio" />
| </a4j:commandLink>
| <h:outputText value="Exercício" />
| </rich:column>
| </rich:columnGroup>
| </f:facet>
| <!-- Table Rows -->
| <rich:column>
| <h:selectBooleanCheckbox value="#{questionarioHome.selection[questionario.idQuestionario]}"/>
| </rich:column>
| <rich:column>
| <h:outputText value="#{questionario.idQuestionario}" />
| </rich:column>
| <rich:column>
| <s:link view="/viewQuestionario.xhtml" value="#{questionario.descricao}">
| <f:param name="questionarioId" value="#{questionario.idQuestionario}" />
| </s:link>
| </rich:column>
| <rich:column>
| <h:outputText value="#{questionario.exercicio}" />
| </rich:column>
| </rich:dataTable>
|
| <h:outputText
| value="Não há questionários para seram exibidos."
| rendered="#{empty questionarios.resultList}" class="message" />
|
| <div class="tableControl">
|
| <h:outputText value="Total de Registros: ${questionarios.resultCount}" />
|
| <a4j:commandLink value="<<" reRender="listPanel" rendered="#{questionarios.previousExists}">
| <f:param name="firstResult" value="0" />
| <f:param name="querySorting" value="#{questionarios.order}" />
| </a4j:commandLink>
|
| <a4j:commandLink value="<" reRender="listPanel" rendered="#{questionarios.previousExists}">
| <f:param name="firstResult" value="#{questionarios.previousFirstResult}" />
| <f:param name="querySorting" value="#{questionarios.order}" />
| </a4j:commandLink>
|
| <a4j:commandLink value=">" reRender="listPanel" rendered="#{questionarios.nextExists}">
| <f:param name="firstResult" value="#{questionarios.nextFirstResult}" />
| <f:param name="querySorting" value="#{questionarios.order}" />
| </a4j:commandLink>
|
| <a4j:commandLink value=">>" reRender="listPanel" rendered="#{questionarios.nextExists}">
| <f:param name="firstResult" value="#{questionarios.lastFirstResult}" />
| <f:param name="querySorting" value="#{questionarios.order}" />
| </a4j:commandLink>
| </div>
|
| <div class="actionButtons">
| <a4j:commandLink reRender="listPanel" value="Excluir" action="#{questionarioHome.removeChecked}"/>
| </div>
|
| </a4j:outputPanel>
| </a4j:form>
|
|
|
|
| @Name("questionarioHome")
| public class FramexEntityHome<E> extends EntityHome<E> {
|
| private static final long serialVersionUID = -1322828158520981636L;
|
| @Override
| public Object getId() {
| return super.getId();
| }
|
| Map<Object, Boolean> selection = new HashMap<Object, Boolean>();
|
| public Map<Object, Boolean> getSelection() {
| return selection;
| }
|
| public void setSelection(Map<Object, Boolean> selection) {
| this.selection = selection;
| }
|
| public void removeChecked() {
| System.out.println("CALL REMOVE CHECKED");
| if (selection != null) {
| System.out.println("### SIZE ###" + selection.keySet().size());
| for (Object id : selection.keySet()) {
| System.out.println("---> " + id + ":" + selection.get(id));
| }
| }
| }
| }
|
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4040301#4040301
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4040301
19 years