You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Joris Kimpe <jo...@get.be> on 2008/06/17 16:54:49 UTC

[TRINIDAD] include jsp using param

Hello group,

I have a jsp (containing Trinidad components), and I want to include a
second jsp page (using jsp:include).  I'd like to pass a backing bean
parameter to the included page (so I can use this value in a javascript
function), but how can I do this?  

It appears to be impossible to use "#{row.shiftId}" inside the onclick
attribute (which is in the included jsp).  Or am I wrong?  Also using
${param.shiftId} results in an error:
According to TLD or attribute directive in tag file, attribute onclick does
not accept any expressions



These are my jsp files:

first.jsp
-------------------------------------------------------------------------------
...
<f:subview id="overviewPage">
	<tr:table id="overviewTable" value="#{backingBean.dataModel}" var="row">
		...
		<tr:panelFormLayout>
		        <tr:table id="results" value="#{row.results}" var="result">
                		<tr:column>
		                        <tr:outputLabel value="#{result.shift}"/>
		                </tr:column>
		        </tr:table>

				
		        <jsp:include page="second.jsp">
	        	        <jsp:param name="shiftId" value="#{row.shiftId}"/>
		        </jsp:include>
		</tr:panelFormLayout>
		...
	</tr:table>
</f:subview>




second.jsp
-------------------------------------------------------------------------------
<f:subview id="createAbsence">
	<tr:panelPopup onclick="jsFunction('${param.shiftId}');" text="create"
modal="true" position="relative">
		<tr:selectOneChoice label="type" value="#{backingBean.type}"
required="yes" immediate="true">
			<f:selectItems value="#{personalShiftPlanOverviewActions.absenceTypes}"
/>
		</tr:selectOneChoice>					
		...
	</tr:panelPopup>
</f:subview>


Thanks for your help!

Joris
-- 
View this message in context: http://www.nabble.com/-TRINIDAD--include-jsp-using-param-tp17912565p17912565.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: [TRINIDAD] include jsp using param

Posted by Walter Mourão <wa...@gmail.com>.
Hi Joris,
this article: http://www.ibm.com/developerworks/java/library/j-facelets/
was of great value to me some time ago. I suggest you take a looks.

Cheers,

On Wed, Jun 18, 2008 at 12:31 PM, Joris Kimpe <jo...@get.be> wrote:

>
> To be honest, I want to stick to JSF (especially Trinidad, so no Tomahawk)
> if
> this is possible.  So, could you give me a small example of how I can use a
> var from fist.jsp in second.jsp?
>
> So something like this:
>
> first.jsp
> <tr:table id="tableId" value="#{backingBean.dataModel}" var="row">
>         ... call second.jsp or something like that (like it was a
> component)
> </tr:table>
>
>
> second.jsp
> <tr:inputText id="textId" value="#{var.text}"/>
>
>
>
>
>
> Andrew Robinson-5 wrote:
> >
> > 1) use facelets
> > 2) honestly, use facelets, JSPs stink
> > 3) well if you must...
> > 4) are you really sure you want to stick with JSP, a failed technology?
> > 5) okay, don't use params. JSP includes do not change the JSF scopes.
> > Therefore, as long as you are not using JSTL tags in your include, you
> > don't need to use JSP tags at all except for the include. If you need
> > to change the name of a EL so that there is one standard for your
> > include to use, have a look at the tomahawk alias bean:
> > http://myfaces.apache.org/tomahawk/tlddoc/t/aliasBean.html
> >
> > Basically, if you are using JSF, try to stay 100% in JSF and not use
> > JSP as much as possible as it only creates confusion. Even if you
> > understand it, someone maintaining the code may not. As a result it is
> > always best to stick with 100% JSF tags and components.
> >
> > As for #2-4 I couldn't resist sharing my opinion ;)
> >
> > -Andrew
> >
> > On Wed, Jun 18, 2008 at 1:44 AM, Joris Kimpe <jo...@get.be> wrote:
> >>
> >> Great article!
> >>
> >> How do you suggest how I should do this?  I have 3 pages using the same
> >> panelPopup (which is in second.jsp).  For maintenance and redundancy
> >> reasons
> >> I want to write this panelPopup only once (and include it somehow in my
> 3
> >> pages).  I thought jsp:include should do the trick, but this didn't
> >> work...
> >>
> >> Joris
> >>
> >>
> >>
> >> Andrew Robinson-5 wrote:
> >>>
> >>> Read this:
> >>>
> >>>
> http://andrewfacelets.blogspot.com/2008/03/build-time-vs-render-time.html
> >>>
> >>> On Tue, Jun 17, 2008 at 8:54 AM, Joris Kimpe <jo...@get.be>
> wrote:
> >>>>
> >>>> Hello group,
> >>>>
> >>>> I have a jsp (containing Trinidad components), and I want to include a
> >>>> second jsp page (using jsp:include).  I'd like to pass a backing bean
> >>>> parameter to the included page (so I can use this value in a
> javascript
> >>>> function), but how can I do this?
> >>>>
> >>>> It appears to be impossible to use "#{row.shiftId}" inside the onclick
> >>>> attribute (which is in the included jsp).  Or am I wrong?  Also using
> >>>> ${param.shiftId} results in an error:
> >>>> According to TLD or attribute directive in tag file, attribute onclick
> >>>> does
> >>>> not accept any expressions
> >>>>
> >>>>
> >>>>
> >>>> These are my jsp files:
> >>>>
> >>>> first.jsp
> >>>>
> -------------------------------------------------------------------------------
> >>>> ...
> >>>> <f:subview id="overviewPage">
> >>>>        <tr:table id="overviewTable" value="#{backingBean.dataModel}"
> >>>> var="row">
> >>>>                ...
> >>>>                <tr:panelFormLayout>
> >>>>                        <tr:table id="results" value="#{row.results}"
> >>>> var="result">
> >>>>                                <tr:column>
> >>>>                                        <tr:outputLabel
> >>>> value="#{result.shift}"/>
> >>>>                                </tr:column>
> >>>>                        </tr:table>
> >>>>
> >>>>
> >>>>                        <jsp:include page="second.jsp">
> >>>>                                <jsp:param name="shiftId"
> >>>> value="#{row.shiftId}"/>
> >>>>                        </jsp:include>
> >>>>                </tr:panelFormLayout>
> >>>>                ...
> >>>>        </tr:table>
> >>>> </f:subview>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>> second.jsp
> >>>>
> -------------------------------------------------------------------------------
> >>>> <f:subview id="createAbsence">
> >>>>        <tr:panelPopup onclick="jsFunction('${param.shiftId}');"
> >>>> text="create"
> >>>> modal="true" position="relative">
> >>>>                <tr:selectOneChoice label="type"
> >>>> value="#{backingBean.type}"
> >>>> required="yes" immediate="true">
> >>>>                        <f:selectItems
> >>>> value="#{personalShiftPlanOverviewActions.absenceTypes}"
> >>>> />
> >>>>                </tr:selectOneChoice>
> >>>>                ...
> >>>>        </tr:panelPopup>
> >>>> </f:subview>
> >>>>
> >>>>
> >>>> Thanks for your help!
> >>>>
> >>>> Joris
> >>>> --
> >>>> View this message in context:
> >>>>
> http://www.nabble.com/-TRINIDAD--include-jsp-using-param-tp17912565p17912565.html
> >>>> Sent from the MyFaces - Users mailing list archive at Nabble.com.
> >>>>
> >>>>
> >>>
> >>>
> >>
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/-TRINIDAD--include-jsp-using-param-tp17912565p17961427.html
> >> Sent from the MyFaces - Users mailing list archive at Nabble.com.
> >>
> >>
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/-TRINIDAD--include-jsp-using-param-tp17912565p17985352.html
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>
>


-- 
Walter Mourão
http://waltermourao.com.br
http://waltermourao.blogspot.com
http://arcadian.com.br

Re: [TRINIDAD] include jsp using param

Posted by Joris Kimpe <jo...@get.be>.
Maybe my example isn't clear.  What I mean is:
- my first.jsp contains a table with a var named row
- my second.jsp contains an inputText with the value of an element "text" of
the var "row" (from the table of first.jsp)



Joris Kimpe wrote:
> 
> To be honest, I want to stick to JSF (especially Trinidad, so no Tomahawk)
> if this is possible.  So, could you give me a small example of how I can
> use a var from fist.jsp in second.jsp?
> 
> So something like this:
> 
> first.jsp
> <tr:table id="tableId" value="#{backingBean.dataModel}" var="row">
>          ... call second.jsp or something like that (like it was a
> component)
> </tr:table>
> 
> 
> second.jsp
> <tr:inputText id="textId" value="#{var.text}"/>
> 
> 
> 
> 
> 
> Andrew Robinson-5 wrote:
>> 
>> 1) use facelets
>> 2) honestly, use facelets, JSPs stink
>> 3) well if you must...
>> 4) are you really sure you want to stick with JSP, a failed technology?
>> 5) okay, don't use params. JSP includes do not change the JSF scopes.
>> Therefore, as long as you are not using JSTL tags in your include, you
>> don't need to use JSP tags at all except for the include. If you need
>> to change the name of a EL so that there is one standard for your
>> include to use, have a look at the tomahawk alias bean:
>> http://myfaces.apache.org/tomahawk/tlddoc/t/aliasBean.html
>> 
>> Basically, if you are using JSF, try to stay 100% in JSF and not use
>> JSP as much as possible as it only creates confusion. Even if you
>> understand it, someone maintaining the code may not. As a result it is
>> always best to stick with 100% JSF tags and components.
>> 
>> As for #2-4 I couldn't resist sharing my opinion ;)
>> 
>> -Andrew
>> 
>> On Wed, Jun 18, 2008 at 1:44 AM, Joris Kimpe <jo...@get.be> wrote:
>>>
>>> Great article!
>>>
>>> How do you suggest how I should do this?  I have 3 pages using the same
>>> panelPopup (which is in second.jsp).  For maintenance and redundancy
>>> reasons
>>> I want to write this panelPopup only once (and include it somehow in my
>>> 3
>>> pages).  I thought jsp:include should do the trick, but this didn't
>>> work...
>>>
>>> Joris
>>>
>>>
>>>
>>> Andrew Robinson-5 wrote:
>>>>
>>>> Read this:
>>>>
>>>> http://andrewfacelets.blogspot.com/2008/03/build-time-vs-render-time.html
>>>>
>>>> On Tue, Jun 17, 2008 at 8:54 AM, Joris Kimpe <jo...@get.be>
>>>> wrote:
>>>>>
>>>>> Hello group,
>>>>>
>>>>> I have a jsp (containing Trinidad components), and I want to include a
>>>>> second jsp page (using jsp:include).  I'd like to pass a backing bean
>>>>> parameter to the included page (so I can use this value in a
>>>>> javascript
>>>>> function), but how can I do this?
>>>>>
>>>>> It appears to be impossible to use "#{row.shiftId}" inside the onclick
>>>>> attribute (which is in the included jsp).  Or am I wrong?  Also using
>>>>> ${param.shiftId} results in an error:
>>>>> According to TLD or attribute directive in tag file, attribute onclick
>>>>> does
>>>>> not accept any expressions
>>>>>
>>>>>
>>>>>
>>>>> These are my jsp files:
>>>>>
>>>>> first.jsp
>>>>> -------------------------------------------------------------------------------
>>>>> ...
>>>>> <f:subview id="overviewPage">
>>>>>        <tr:table id="overviewTable" value="#{backingBean.dataModel}"
>>>>> var="row">
>>>>>                ...
>>>>>                <tr:panelFormLayout>
>>>>>                        <tr:table id="results" value="#{row.results}"
>>>>> var="result">
>>>>>                                <tr:column>
>>>>>                                        <tr:outputLabel
>>>>> value="#{result.shift}"/>
>>>>>                                </tr:column>
>>>>>                        </tr:table>
>>>>>
>>>>>
>>>>>                        <jsp:include page="second.jsp">
>>>>>                                <jsp:param name="shiftId"
>>>>> value="#{row.shiftId}"/>
>>>>>                        </jsp:include>
>>>>>                </tr:panelFormLayout>
>>>>>                ...
>>>>>        </tr:table>
>>>>> </f:subview>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> second.jsp
>>>>> -------------------------------------------------------------------------------
>>>>> <f:subview id="createAbsence">
>>>>>        <tr:panelPopup onclick="jsFunction('${param.shiftId}');"
>>>>> text="create"
>>>>> modal="true" position="relative">
>>>>>                <tr:selectOneChoice label="type"
>>>>> value="#{backingBean.type}"
>>>>> required="yes" immediate="true">
>>>>>                        <f:selectItems
>>>>> value="#{personalShiftPlanOverviewActions.absenceTypes}"
>>>>> />
>>>>>                </tr:selectOneChoice>
>>>>>                ...
>>>>>        </tr:panelPopup>
>>>>> </f:subview>
>>>>>
>>>>>
>>>>> Thanks for your help!
>>>>>
>>>>> Joris
>>>>> --
>>>>> View this message in context:
>>>>> http://www.nabble.com/-TRINIDAD--include-jsp-using-param-tp17912565p17912565.html
>>>>> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>>>>>
>>>>>
>>>>
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/-TRINIDAD--include-jsp-using-param-tp17912565p17961427.html
>>> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>>>
>>>
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/-TRINIDAD--include-jsp-using-param-tp17912565p17985590.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: [TRINIDAD] include jsp using param

Posted by Mike Kienenberger <mk...@gmail.com>.
On 6/18/08, Andrew Robinson <an...@gmail.com> wrote:
>  Hopefully aliasBean is moved over to myfaces commons someday as that
>  is a better home for it.

aliasBean has issues that have previously prevented its inclusion into
myfaces commons.

http://markmail.org/message/2bnsgpyr7qeoeoo3

Re: [TRINIDAD] include jsp using param

Posted by Andrew Robinson <an...@gmail.com>.
Tomahawk is JSF, both Trinidad and Tomahawk are 3rd party JSF add-ons.

Hopefully aliasBean is moved over to myfaces commons someday as that
is a better home for it.

Without using alias bean or writing your own code to do the same.

Here is how to do it with no alias:

> first.jsp
> <tr:table id="tableId" value="#{backingBean.dataModel}" var="var">
>         ... call second.jsp or something like that (like it was a
> component)
> </tr:table>

> second.jsp
> <tr:inputText id="textId" value="#{var.text}"/>

So that the var in the table maps to the same variable name in the included JSP.

Facelets has ui:param for its include, which has no equivalent in JSP.
This is why I strongly suggest that you use facelets and not JSP.

Re: [TRINIDAD] include jsp using param

Posted by Joris Kimpe <jo...@get.be>.
To be honest, I want to stick to JSF (especially Trinidad, so no Tomahawk) if
this is possible.  So, could you give me a small example of how I can use a
var from fist.jsp in second.jsp?

So something like this:

first.jsp
<tr:table id="tableId" value="#{backingBean.dataModel}" var="row">
         ... call second.jsp or something like that (like it was a
component)
</tr:table>


second.jsp
<tr:inputText id="textId" value="#{var.text}"/>





Andrew Robinson-5 wrote:
> 
> 1) use facelets
> 2) honestly, use facelets, JSPs stink
> 3) well if you must...
> 4) are you really sure you want to stick with JSP, a failed technology?
> 5) okay, don't use params. JSP includes do not change the JSF scopes.
> Therefore, as long as you are not using JSTL tags in your include, you
> don't need to use JSP tags at all except for the include. If you need
> to change the name of a EL so that there is one standard for your
> include to use, have a look at the tomahawk alias bean:
> http://myfaces.apache.org/tomahawk/tlddoc/t/aliasBean.html
> 
> Basically, if you are using JSF, try to stay 100% in JSF and not use
> JSP as much as possible as it only creates confusion. Even if you
> understand it, someone maintaining the code may not. As a result it is
> always best to stick with 100% JSF tags and components.
> 
> As for #2-4 I couldn't resist sharing my opinion ;)
> 
> -Andrew
> 
> On Wed, Jun 18, 2008 at 1:44 AM, Joris Kimpe <jo...@get.be> wrote:
>>
>> Great article!
>>
>> How do you suggest how I should do this?  I have 3 pages using the same
>> panelPopup (which is in second.jsp).  For maintenance and redundancy
>> reasons
>> I want to write this panelPopup only once (and include it somehow in my 3
>> pages).  I thought jsp:include should do the trick, but this didn't
>> work...
>>
>> Joris
>>
>>
>>
>> Andrew Robinson-5 wrote:
>>>
>>> Read this:
>>>
>>> http://andrewfacelets.blogspot.com/2008/03/build-time-vs-render-time.html
>>>
>>> On Tue, Jun 17, 2008 at 8:54 AM, Joris Kimpe <jo...@get.be> wrote:
>>>>
>>>> Hello group,
>>>>
>>>> I have a jsp (containing Trinidad components), and I want to include a
>>>> second jsp page (using jsp:include).  I'd like to pass a backing bean
>>>> parameter to the included page (so I can use this value in a javascript
>>>> function), but how can I do this?
>>>>
>>>> It appears to be impossible to use "#{row.shiftId}" inside the onclick
>>>> attribute (which is in the included jsp).  Or am I wrong?  Also using
>>>> ${param.shiftId} results in an error:
>>>> According to TLD or attribute directive in tag file, attribute onclick
>>>> does
>>>> not accept any expressions
>>>>
>>>>
>>>>
>>>> These are my jsp files:
>>>>
>>>> first.jsp
>>>> -------------------------------------------------------------------------------
>>>> ...
>>>> <f:subview id="overviewPage">
>>>>        <tr:table id="overviewTable" value="#{backingBean.dataModel}"
>>>> var="row">
>>>>                ...
>>>>                <tr:panelFormLayout>
>>>>                        <tr:table id="results" value="#{row.results}"
>>>> var="result">
>>>>                                <tr:column>
>>>>                                        <tr:outputLabel
>>>> value="#{result.shift}"/>
>>>>                                </tr:column>
>>>>                        </tr:table>
>>>>
>>>>
>>>>                        <jsp:include page="second.jsp">
>>>>                                <jsp:param name="shiftId"
>>>> value="#{row.shiftId}"/>
>>>>                        </jsp:include>
>>>>                </tr:panelFormLayout>
>>>>                ...
>>>>        </tr:table>
>>>> </f:subview>
>>>>
>>>>
>>>>
>>>>
>>>> second.jsp
>>>> -------------------------------------------------------------------------------
>>>> <f:subview id="createAbsence">
>>>>        <tr:panelPopup onclick="jsFunction('${param.shiftId}');"
>>>> text="create"
>>>> modal="true" position="relative">
>>>>                <tr:selectOneChoice label="type"
>>>> value="#{backingBean.type}"
>>>> required="yes" immediate="true">
>>>>                        <f:selectItems
>>>> value="#{personalShiftPlanOverviewActions.absenceTypes}"
>>>> />
>>>>                </tr:selectOneChoice>
>>>>                ...
>>>>        </tr:panelPopup>
>>>> </f:subview>
>>>>
>>>>
>>>> Thanks for your help!
>>>>
>>>> Joris
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/-TRINIDAD--include-jsp-using-param-tp17912565p17912565.html
>>>> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>>>>
>>>>
>>>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/-TRINIDAD--include-jsp-using-param-tp17912565p17961427.html
>> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/-TRINIDAD--include-jsp-using-param-tp17912565p17985352.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: [TRINIDAD] include jsp using param

Posted by Andrew Robinson <an...@gmail.com>.
1) use facelets
2) honestly, use facelets, JSPs stink
3) well if you must...
4) are you really sure you want to stick with JSP, a failed technology?
5) okay, don't use params. JSP includes do not change the JSF scopes.
Therefore, as long as you are not using JSTL tags in your include, you
don't need to use JSP tags at all except for the include. If you need
to change the name of a EL so that there is one standard for your
include to use, have a look at the tomahawk alias bean:
http://myfaces.apache.org/tomahawk/tlddoc/t/aliasBean.html

Basically, if you are using JSF, try to stay 100% in JSF and not use
JSP as much as possible as it only creates confusion. Even if you
understand it, someone maintaining the code may not. As a result it is
always best to stick with 100% JSF tags and components.

As for #2-4 I couldn't resist sharing my opinion ;)

-Andrew

On Wed, Jun 18, 2008 at 1:44 AM, Joris Kimpe <jo...@get.be> wrote:
>
> Great article!
>
> How do you suggest how I should do this?  I have 3 pages using the same
> panelPopup (which is in second.jsp).  For maintenance and redundancy reasons
> I want to write this panelPopup only once (and include it somehow in my 3
> pages).  I thought jsp:include should do the trick, but this didn't work...
>
> Joris
>
>
>
> Andrew Robinson-5 wrote:
>>
>> Read this:
>>
>> http://andrewfacelets.blogspot.com/2008/03/build-time-vs-render-time.html
>>
>> On Tue, Jun 17, 2008 at 8:54 AM, Joris Kimpe <jo...@get.be> wrote:
>>>
>>> Hello group,
>>>
>>> I have a jsp (containing Trinidad components), and I want to include a
>>> second jsp page (using jsp:include).  I'd like to pass a backing bean
>>> parameter to the included page (so I can use this value in a javascript
>>> function), but how can I do this?
>>>
>>> It appears to be impossible to use "#{row.shiftId}" inside the onclick
>>> attribute (which is in the included jsp).  Or am I wrong?  Also using
>>> ${param.shiftId} results in an error:
>>> According to TLD or attribute directive in tag file, attribute onclick
>>> does
>>> not accept any expressions
>>>
>>>
>>>
>>> These are my jsp files:
>>>
>>> first.jsp
>>> -------------------------------------------------------------------------------
>>> ...
>>> <f:subview id="overviewPage">
>>>        <tr:table id="overviewTable" value="#{backingBean.dataModel}"
>>> var="row">
>>>                ...
>>>                <tr:panelFormLayout>
>>>                        <tr:table id="results" value="#{row.results}"
>>> var="result">
>>>                                <tr:column>
>>>                                        <tr:outputLabel
>>> value="#{result.shift}"/>
>>>                                </tr:column>
>>>                        </tr:table>
>>>
>>>
>>>                        <jsp:include page="second.jsp">
>>>                                <jsp:param name="shiftId"
>>> value="#{row.shiftId}"/>
>>>                        </jsp:include>
>>>                </tr:panelFormLayout>
>>>                ...
>>>        </tr:table>
>>> </f:subview>
>>>
>>>
>>>
>>>
>>> second.jsp
>>> -------------------------------------------------------------------------------
>>> <f:subview id="createAbsence">
>>>        <tr:panelPopup onclick="jsFunction('${param.shiftId}');"
>>> text="create"
>>> modal="true" position="relative">
>>>                <tr:selectOneChoice label="type"
>>> value="#{backingBean.type}"
>>> required="yes" immediate="true">
>>>                        <f:selectItems
>>> value="#{personalShiftPlanOverviewActions.absenceTypes}"
>>> />
>>>                </tr:selectOneChoice>
>>>                ...
>>>        </tr:panelPopup>
>>> </f:subview>
>>>
>>>
>>> Thanks for your help!
>>>
>>> Joris
>>> --
>>> View this message in context:
>>> http://www.nabble.com/-TRINIDAD--include-jsp-using-param-tp17912565p17912565.html
>>> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>>>
>>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/-TRINIDAD--include-jsp-using-param-tp17912565p17961427.html
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>
>

Re: [TRINIDAD] include jsp using param

Posted by Joris Kimpe <jo...@get.be>.
Great article!

How do you suggest how I should do this?  I have 3 pages using the same
panelPopup (which is in second.jsp).  For maintenance and redundancy reasons
I want to write this panelPopup only once (and include it somehow in my 3
pages).  I thought jsp:include should do the trick, but this didn't work...

Joris



Andrew Robinson-5 wrote:
> 
> Read this:
> 
> http://andrewfacelets.blogspot.com/2008/03/build-time-vs-render-time.html
> 
> On Tue, Jun 17, 2008 at 8:54 AM, Joris Kimpe <jo...@get.be> wrote:
>>
>> Hello group,
>>
>> I have a jsp (containing Trinidad components), and I want to include a
>> second jsp page (using jsp:include).  I'd like to pass a backing bean
>> parameter to the included page (so I can use this value in a javascript
>> function), but how can I do this?
>>
>> It appears to be impossible to use "#{row.shiftId}" inside the onclick
>> attribute (which is in the included jsp).  Or am I wrong?  Also using
>> ${param.shiftId} results in an error:
>> According to TLD or attribute directive in tag file, attribute onclick
>> does
>> not accept any expressions
>>
>>
>>
>> These are my jsp files:
>>
>> first.jsp
>> -------------------------------------------------------------------------------
>> ...
>> <f:subview id="overviewPage">
>>        <tr:table id="overviewTable" value="#{backingBean.dataModel}"
>> var="row">
>>                ...
>>                <tr:panelFormLayout>
>>                        <tr:table id="results" value="#{row.results}"
>> var="result">
>>                                <tr:column>
>>                                        <tr:outputLabel
>> value="#{result.shift}"/>
>>                                </tr:column>
>>                        </tr:table>
>>
>>
>>                        <jsp:include page="second.jsp">
>>                                <jsp:param name="shiftId"
>> value="#{row.shiftId}"/>
>>                        </jsp:include>
>>                </tr:panelFormLayout>
>>                ...
>>        </tr:table>
>> </f:subview>
>>
>>
>>
>>
>> second.jsp
>> -------------------------------------------------------------------------------
>> <f:subview id="createAbsence">
>>        <tr:panelPopup onclick="jsFunction('${param.shiftId}');"
>> text="create"
>> modal="true" position="relative">
>>                <tr:selectOneChoice label="type"
>> value="#{backingBean.type}"
>> required="yes" immediate="true">
>>                        <f:selectItems
>> value="#{personalShiftPlanOverviewActions.absenceTypes}"
>> />
>>                </tr:selectOneChoice>
>>                ...
>>        </tr:panelPopup>
>> </f:subview>
>>
>>
>> Thanks for your help!
>>
>> Joris
>> --
>> View this message in context:
>> http://www.nabble.com/-TRINIDAD--include-jsp-using-param-tp17912565p17912565.html
>> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/-TRINIDAD--include-jsp-using-param-tp17912565p17961427.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: [TRINIDAD] include jsp using param

Posted by Andrew Robinson <an...@gmail.com>.
Read this:

http://andrewfacelets.blogspot.com/2008/03/build-time-vs-render-time.html

On Tue, Jun 17, 2008 at 8:54 AM, Joris Kimpe <jo...@get.be> wrote:
>
> Hello group,
>
> I have a jsp (containing Trinidad components), and I want to include a
> second jsp page (using jsp:include).  I'd like to pass a backing bean
> parameter to the included page (so I can use this value in a javascript
> function), but how can I do this?
>
> It appears to be impossible to use "#{row.shiftId}" inside the onclick
> attribute (which is in the included jsp).  Or am I wrong?  Also using
> ${param.shiftId} results in an error:
> According to TLD or attribute directive in tag file, attribute onclick does
> not accept any expressions
>
>
>
> These are my jsp files:
>
> first.jsp
> -------------------------------------------------------------------------------
> ...
> <f:subview id="overviewPage">
>        <tr:table id="overviewTable" value="#{backingBean.dataModel}" var="row">
>                ...
>                <tr:panelFormLayout>
>                        <tr:table id="results" value="#{row.results}" var="result">
>                                <tr:column>
>                                        <tr:outputLabel value="#{result.shift}"/>
>                                </tr:column>
>                        </tr:table>
>
>
>                        <jsp:include page="second.jsp">
>                                <jsp:param name="shiftId" value="#{row.shiftId}"/>
>                        </jsp:include>
>                </tr:panelFormLayout>
>                ...
>        </tr:table>
> </f:subview>
>
>
>
>
> second.jsp
> -------------------------------------------------------------------------------
> <f:subview id="createAbsence">
>        <tr:panelPopup onclick="jsFunction('${param.shiftId}');" text="create"
> modal="true" position="relative">
>                <tr:selectOneChoice label="type" value="#{backingBean.type}"
> required="yes" immediate="true">
>                        <f:selectItems value="#{personalShiftPlanOverviewActions.absenceTypes}"
> />
>                </tr:selectOneChoice>
>                ...
>        </tr:panelPopup>
> </f:subview>
>
>
> Thanks for your help!
>
> Joris
> --
> View this message in context: http://www.nabble.com/-TRINIDAD--include-jsp-using-param-tp17912565p17912565.html
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>
>