Announcement Announcement Module
Collapse
No announcement yet.
display tag page parameter Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • display tag page parameter

    Hi, im new to display tag, i'm using it with swf and don't understand how to get the number of the selected page from displaytag.

    From the page i found

    (Integer.parseInt(request.getParameter((new ParamEncoder(tableId).encodeParameterName(TableTag Parameters.PARAMETER_PAGE)))) - 1) * pageSize.

    How can i pass the PARAMETER_PAGE from my flow to a bean ?

  • #2
    code

    I've tried to search the PARAMETER_PAGE but it is null,
    here is the code
    any idea???

    Code:
    <form:form commandName =  "browseExpedientesCommand">
    <input id="_flowExecutionKey" type="hidden" name="_flowExecutionKey" value="${flowExecutionKey}"/>
    <form:errors path = "*" cssClass = "errors" />
    			
    <display:table class="table" id="expedientes" name="pagina.items" pagesize="${pagina.viewSize}" partialList="true" size="${pagina.totalSize}" requestURI="flowController.html?_flowExecutionKey=${flowExecutionKey}&_eventId=paginar">
    <display:column title="">
    <form:checkbox path = "expedientesSeleccionados" value = "idExpediente"/>
    </display:column>
    <display:column title="N&uacute;mero" property="numeroExpediente"/>
    <display:column title="Motivo"property="motivo"/>
    <display:column title="">
    <a href="<c:out value="#"/>"><img src= "${pageContext.request.contextPath}/icons/page.png"/></a>
    	 		 					<a href="<c:out value="#"/>"><img src= "${pageContext.request.contextPath}/icons/table_edit.png"/></a>
    	 		 					<a href="<c:out value="#"/>"><img src= "${pageContext.request.contextPath}/icons/table_delete.png"/></a>
    	 		 				</display:column>
     		 				</display:table>
    	 		 				
    			<jsp:scriptlet>
    			
    			  System.out.println(Integer.parseInt(request.getParameter((new ParamEncoder("expedientes").encodeParameterName(TableTagParameters.PARAMETER_PAGE)))) - 1);
    
    			 </jsp:scriptlet>
    	 		 				
    	 		 			<input type="submit" name="_eventId_enviar" value="Enviar >>"/>
    	 		 
    					</form:form>
    
    				</div>

    Comment


    • #3
      Well in your jsp it is always going to be null...

      Comment


      • #4
        Hi, thanks for answering, yes i will always be null, its the request!! It'was my fault.

        My idea was to do something like this:

        Code:
        <view-state id="expedientesDetenidosEnUnidad" view="browseExpedientes/expedientesDetenidosEnUnidad">
        <entry-actions>
        	<bean-action bean = "browseExpedientesFacade" method = "findExpedientesDetenidos">
        	<method-arguments>
        	<argument expression = "${flowScope.offset}"/>
        	</method-arguments>
        	<method-result name="expedienteList" scope="flow"/>
        	</bean-action>
        </entry-actions>
        		
        <transition on="nextPager" to="expedientesDetenidosEnUnidad">
        	<set attribute = "offset" value="${requestParameters.PARAMETER_PAGE}" scope="flow"/>
        </transition>
        	</view-state>
        so i need to get the PARAMETER_PAGE param or some parameter that told me the page number, from my logger, i found that the page parameter that is passed to swf is
        d-78787-s=2, so i tried requestParameters.d-78787-s, but i get a swf error.I understand that this code is generated from the table 's id, and you need to decode with
        Code:
        request.getParameter((new ParamEncoder("expedientes").encodeParameterName(TableTagParameters.PARAMETER_PAGE))))
        I'll try to with an evaluate action or something like that and i'll let you know.

        Bye

        Comment


        • #5
          Ehrm... We used DisplayTag quite extensivly and we retrieve the (newly) selected page by simply retrieving the page parameter....

          Comment


          • #6
            well, the evaluation action did not work as well.
            This is the link that i get
            Code:
            http://localhost:8080/SASE/flowController.html?d-7577386-p=3&_eventId=paginar&_flowExecutionKey=_c54635877-0055-BC40-8AAF-CF8F4CBAA4F4_k08E77AC6-7342-87F9-422F-E9E63501AC82&_flowExecutionKey=_c54635877-0055-BC40-8AAF-CF8F4CBAA4F4_k08E77AC6-7342-87F9-422F-E9E63501AC82
            I used this POJO to do the paging, pherhaps there is a better way to do this.
            Could you post me a short example? it would be very helpful.

            thanks a lot!
            Code:
            public PaginaImpl findExpedientesDetenidos(Long idUnidad,PaginaImpl pagina,RequestScope s) {
            		
            
            		Assert.notNull(idUnidad);
            		
            		EnviarExpedienteFacadeResult resultado = null;
            
            		List<EnviarExpedienteFacadeResult> resultados = new ArrayList<EnviarExpedienteFacadeResult>();
            
            		logger.debug("Offset :"+pagina.getOffset());
            		logger.debug("Cantidad a ver :"+pagina.getViewSize());
            		
            		List<Expediente> expedientes = unidadRepository.findExpedientes(idUnidad,pagina.getOffset(),pagina.getViewSize());
            		int totalSize = unidadRepository.cantidadDeExpedientes(idUnidad);
            		
            		for (Expediente expediente : expedientes) {
            			resultado = enviarExpedienteFacadeResultFactory.make(expediente);
            			resultados.add(resultado);
            		}
            
            		logger.debug("Cantidad de expedientes por traidos:"+resultados.size());
            		logger.debug("Cantidad total de expedientes :"+totalSize);
            		
            		pagina.setItems(resultados);
            		pagina.setTotalSize(totalSize);
            		
            		return pagina;
            	}

            Comment


            • #7
              i tried to pass ${requestParameters.d-7786-s}
              but i get an exception, is there any way to escape de expression d-7786-s ?

              Code:
              EBUG http-8080-Processor23 org.springframework.web.servlet.DispatcherServlet - Could not complete request
              org.springframework.webflow.engine.ActionExecutionException: Exception thrown executing [AnnotatedAction@4320432 targetAction = [email protected]74, attributes = map[[empty]]] in state 'expedientesDetenidosEnUnidad' of flow 'browseExpedientes-flow' -- action execution attributes were 'map[[empty]]'; nested exception is org.springframework.binding.expression.EvaluationException: Expression [EvaluationAttempt@16a216a2 expression = (requestParameters.d - 7577386) - p, target = [RequestControlContextImpl@8d008d0 externalContext = [ServletExternalContext@4d9a4d9a requestParameterMap = map['_flowExecutionKey' -> array<String>['_c1B3D256B-A132-82DC-6D1A-DBC3BAF3E708_k03129651-6B6C-7D20-16F1-0F0C44DD5108', '_c1B3D256B-A132-82DC-6D1A-DBC3BAF3E708_k03129651-6B6C-7D20-16F1-0F0C44DD5108'], '_eventId_seleccionarUnidad' -> 'Siguiente >>', 'unidadSeleccionada' -> '1']], requestScope = map[[empty]], attributes = map[[empty]], flowExecution = [FlowExecutionImpl@70da70da flow = 'navegacion-flow', flowSessions = list[[FlowSessionImpl@72ac72ac flow = 'navegacion-flow', state = 'browseExpedientes', scope = map['idUnidad' -> [null]], flashMap = map[[empty]], status = Suspended], [FlowSessionImpl@7f807f80 flow = 'browseExpedientes-flow', state = 'expedientesDetenidosEnUnidad', scope = map['currentFormObject' -> [email protected][unidadSeleccionada=1,expedientesSeleccionados=<null>], 'browseExpedientesCommand' -> [email protected][unidadSeleccionada=1,expedientesSeleccionados=<null>], 'pagina' -> ar.uba.fi.sase.browseExpedientes.PaginaImpl@9aa09aa, 'unidadList' -> list[ar.uba.fi.sase.estructura.UnidadImpl@f880f88[nombre=Soporte], ar.uba.fi.sase.estructura.UnidadImpl@16b016b0[nombre=Mesa de entradas]]], flashMap = map['org.springframework.validation.BindException.browseExpedientesCommand' -> org.springframework.validation.BindException: org.springframework.validation.BeanPropertyBindingResult: 0 errors, 'org.springframework.validation.BindException.currentFormObject' -> org.springframework.validation.BindException: org.springframework.validation.BeanPropertyBindingResult: 0 errors], status = Active]]]], context = [null]] failed - make sure the expression is evaluatable on the target object; nested exception is ognl.NoSuchPropertyException: org.springframework.webflow.engine.impl.RequestControlContextImpl.p
              Caused by: 
              org.springframework.binding.expression.EvaluationException: Expression [EvaluationAttempt@16a216a2 expression = (requestParameters.d - 7577386) - p, target = [RequestControlContextImpl@8d008d0 externalContext = [ServletExternalContext@4d9a4d9a requestParameterMap = map['_flowExecutionKey' -> array<String>['_c1B3D256B-A132-82DC-6D1A-DBC3BAF3E708_k03129651-6B6C-7D20-16F1-0F0C44DD5108', '_c1B3D256B-A132-82DC-6D1A-DBC3BAF3E708_k03129651-6B6C-7D20-16F1-0F0C44DD5108'], '_eventId_seleccionarUnidad' -> 'Siguiente >>', 'unidadSeleccionada' -> '1']], requestScope = map[[empty]], attributes = map[[empty]], flowExecution = [FlowExecutionImpl@70da70da flow = 'navegacion-flow', flowSessions = list[[FlowSessionImpl@72ac72ac flow = 'navegacion-flow', state = 'browseExpedientes', scope = map['idUnidad' -> [null]], flashMap = map[[empty]], status = Suspended], [FlowSessionImpl@7f807f80 flow = 'browseExpedientes-flow', state = 'expedientesDetenidosEnUnidad', scope = map['currentFormObject' -> [email protected][unidadSeleccionada=1,expedientesSeleccionados=<null>], 'browseExpedientesCommand' -> [email protected][unidadSeleccionada=1,expedientesSeleccionados=<null>], 'pagina' -> ar.uba.fi.sase.browseExpedientes.PaginaImpl@9aa09aa, 'unidadList' -> list[ar.uba.fi.sase.estructura.UnidadImpl@f880f88[nombre=Soporte], ar.uba.fi.sase.estructura.UnidadImpl@16b016b0[nombre=Mesa de entradas]]], flashMap = map['org.springframework.validation.BindException.browseExpedientesCommand' -> org.springframework.validation.BindException: org.springframework.validation.BeanPropertyBindingResult: 0 errors, 'org.springframework.validation.BindException.currentFormObject' -> org.springframework.validation.BindException: org.springframework.validation.BeanPropertyBindingResult: 0 errors], status = Active]]]], context = [null]] failed - make sure the expression is evaluatable on the target object; nested exception is ognl.NoSuchPropertyException: org.springframework.webflow.engine.impl.RequestControlContextImpl.p
              Caused by: 
              ognl.NoSuchPropertyException: org.springframework.webflow.engine.impl.RequestControlContextImpl.p
              	at ognl.ObjectPropertyAccessor.getProperty(ObjectPropertyAccessor.java:122)
              	at ognl.OgnlRuntime.getProperty(OgnlRuntime.java:1657)
              	at ognl.ASTProperty.getValueBody(ASTProperty.java:92)
              	at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:170)
              	at ognl.SimpleNode.getValue(SimpleNode.java:210)
              	at ognl.ASTSubtract.getValueBody(ASTSubtract.java:50)
              	at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:170)
              	at ognl.SimpleNode.getValue(SimpleNode.java:210)
              	at ognl.Ognl.getValue(Ognl.java:333)
              	at ognl.Ognl.getValue(Ognl.java:310)
              	at org.springframework.binding.expression.support.OgnlExpression.evaluate(OgnlExpression.java:73)
              	at org.springframework.bi

              Comment


              • #8
                I find the solution just ${requestParameters['d-7577386-p']}

                Bye!

                Comment

                Working...
                X