K
KN
Am quite confused over a number of struts-related issues concerning a
problem I've been working on & would appreciate any help/comments.
Am very new to struts - so please forgive any misconceptions/errors
on my part.
Some prerequisites
- am developing with struts 2
- Am using the display tag from sourceforge
http://displaytag.sourceforge.net/11/displaytag/tagreference.html
- Am using Tomcat 5.0.28 (a JSP 2.0 container)
I have a struts action that places a number of objects into the
ActionContext, I am also accessing various properties of this Action
using OGNL and some standard JSP EL constructs.
- my problem is - I want to use an EL expressing in the display tag -
JSP code snipped below - but don't really understand
the implications
<!-- BEGIN CODE -->
<!--------------------------------------------------------->
<!-- NOTE: using the el variant od the display tag -->
<%@ taglib uri="http://displaytag.sf.net/el" prefix="display" %>
<s:iterator id="current" value="sessionDisplayers" >
<s:set name="id" value="#current" scope="page" />
<display:table name="${id}"
id="${id}"
class="scrollTable"
pagesize="18"
decorator="com.mycompany.MyDecorator"
requestURI=""
style="width:65%">
<display:column property="myRepository.name"
sortProperty="myRepository.name"
sortable="true"
headerClass="sortable"
class="standardStyle"
titleKey="displayTag.repository.device"/>
<!--------------------------------------------------------->
<!-- END CODE -->
- as you can see - I use a struts iteration tag to access a property
(getSessionDisplayers) on my action - and instantiate a variable
'current'
I then set an attribute (id) in the page context - and use this from
within my display tag - so that the same markup can be reused.
- now the real problem - I am having to use the el related classes for
this;
<%@ taglib uri="http://displaytag.sf.net/el" prefix="display" %>
in contrast to;
<%@ taglib uri="http://displaytag.sf.net" prefix="display" %>
However there are a number of issues/questions here
the EL tag libs require the use of
org.apache.taglibs.standard.support.ExpressionEvaluationManager - this
class is contained within the
standard-1.0.6.jar - which (I think) is a struts-1.x library (remember
this is a struts-2 application) - I know there's no problem
introducing
this dependency (nothing seems to break, no namespace clashes etc... -
is it ok for me to do this ??).
Secondly - I assumed that in a JSP 2.0/2.1 container - EL expression
evaluation was handled by the container - that's why pre-JSP 2.0 you
see 2 variants
or the core libraries - one for 'normal' behaviour, and one for tags
that utilise runtime/EL expressions - hence tlds like
http://java.sun.com/jstl-el/core
.... for handling EL expressions within tags
http://java.sun.com/jsp/jstl/core
.... for translation time only stuff
But in JSP 2.x EL evaluation is handled by the container - not the
taglib - so in a JSP 2.x authored/hosted app. you don't need to
reference/utilise an 'el' variant
of the core taglibs if you want to use request-time expressions within
your code.
- so am confused - I'm using struts 2 with a JSP 2.0 container so
surely the container should handle EL expressions, or is there a
struts 2.x version of
ExpressionEvaluationManager - or is the standard-1.0.6.jar ok to use
within a struts 2.x application.
Thanks in advance
problem I've been working on & would appreciate any help/comments.
Am very new to struts - so please forgive any misconceptions/errors
on my part.
Some prerequisites
- am developing with struts 2
- Am using the display tag from sourceforge
http://displaytag.sourceforge.net/11/displaytag/tagreference.html
- Am using Tomcat 5.0.28 (a JSP 2.0 container)
I have a struts action that places a number of objects into the
ActionContext, I am also accessing various properties of this Action
using OGNL and some standard JSP EL constructs.
- my problem is - I want to use an EL expressing in the display tag -
JSP code snipped below - but don't really understand
the implications
<!-- BEGIN CODE -->
<!--------------------------------------------------------->
<!-- NOTE: using the el variant od the display tag -->
<%@ taglib uri="http://displaytag.sf.net/el" prefix="display" %>
<s:iterator id="current" value="sessionDisplayers" >
<s:set name="id" value="#current" scope="page" />
<display:table name="${id}"
id="${id}"
class="scrollTable"
pagesize="18"
decorator="com.mycompany.MyDecorator"
requestURI=""
style="width:65%">
<display:column property="myRepository.name"
sortProperty="myRepository.name"
sortable="true"
headerClass="sortable"
class="standardStyle"
titleKey="displayTag.repository.device"/>
<!--------------------------------------------------------->
<!-- END CODE -->
- as you can see - I use a struts iteration tag to access a property
(getSessionDisplayers) on my action - and instantiate a variable
'current'
I then set an attribute (id) in the page context - and use this from
within my display tag - so that the same markup can be reused.
- now the real problem - I am having to use the el related classes for
this;
<%@ taglib uri="http://displaytag.sf.net/el" prefix="display" %>
in contrast to;
<%@ taglib uri="http://displaytag.sf.net" prefix="display" %>
However there are a number of issues/questions here
the EL tag libs require the use of
org.apache.taglibs.standard.support.ExpressionEvaluationManager - this
class is contained within the
standard-1.0.6.jar - which (I think) is a struts-1.x library (remember
this is a struts-2 application) - I know there's no problem
introducing
this dependency (nothing seems to break, no namespace clashes etc... -
is it ok for me to do this ??).
Secondly - I assumed that in a JSP 2.0/2.1 container - EL expression
evaluation was handled by the container - that's why pre-JSP 2.0 you
see 2 variants
or the core libraries - one for 'normal' behaviour, and one for tags
that utilise runtime/EL expressions - hence tlds like
http://java.sun.com/jstl-el/core
.... for handling EL expressions within tags
http://java.sun.com/jsp/jstl/core
.... for translation time only stuff
But in JSP 2.x EL evaluation is handled by the container - not the
taglib - so in a JSP 2.x authored/hosted app. you don't need to
reference/utilise an 'el' variant
of the core taglibs if you want to use request-time expressions within
your code.
- so am confused - I'm using struts 2 with a JSP 2.0 container so
surely the container should handle EL expressions, or is there a
struts 2.x version of
ExpressionEvaluationManager - or is the standard-1.0.6.jar ok to use
within a struts 2.x application.
Thanks in advance