You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Leszek Gawron <ou...@wlkp.org> on 2003/09/22 10:57:58 UTC

JXPath usage problem

How can I map this functionality that uses JEXL (which works):
<t:forEach var="type" items="${typeList}">
	<t:choose>
		<t:when test="${pocket.Dev_DtId == type.Dt_DtId}">
			<option value="${type.Dt_DtId}" selected="">${type.Dt_Type}</option>
		</t:when>
		<t:otherwise>
			<option value="${type.Dt_DtId}">${type.Dt_Type}</option>
		</t:otherwise>
	</t:choose>
</t:forEach>

to JXPath ?

This does not work:
<select style="width: 147" name="Dev_DtId">
	<t:forEach select="#{typeList}">
		<t:choose>
			<t:when test="#{/pocket/Dev_DtId/text() = Dt_DtId/text()}">
				<option value="#{Dt_DtId}" selected="">#{Dt_Type}</option>
			</t:when>
			<t:otherwise>
				<option value="#{Dt_DtId}">#{Dt_Type}</option>
			</t:otherwise>
		</t:choose>
	</t:forEach>
</select>

my flow procedure is:
function addPocket( pocketId ) {
	var message="";
	var pocketDetails = {};
	
	var typeList = getTypesDb();
	var projectList = getProjectsDb();
	
	pocketDetails.Dev_Serial = "";
	pocketDetails.Dev_License = "";
	pocketDetails.Dev_InvoiceNo = "";
	pocketDetails.Dev_WzNo = "";
	pocketDetails.Dev_WzMtsNo = "";
	pocketDetails.Dev_Description = "";
	pocketDetails.Prj_PrjId = 0;
	pocketDetails.Dev_DtId = typeList[ 0 ];
	
	var first = true;
	while( true ) {
		if ( !first ) {
			typeList = getTypesDb();
			projectList = getProjectsDb();
			first = false;
		}
		if ( 	cocoon.request.getParameter( "submit-save" ) != null || 
				cocoon.request.getParameter( "submit-next" ) != null ) {
			pocketDetails.Dev_Serial = cocoon.request.getParameter( "Dev_Serial" );
			pocketDetails.Dev_License = cocoon.request.getParameter( "Dev_License" );
			pocketDetails.Dev_InvoiceNo = cocoon.request.getParameter( "Dev_InvoiceNo" );
			pocketDetails.Dev_WzNo = cocoon.request.getParameter( "Dev_WzNo" );
			pocketDetails.Dev_WzMtsNo = cocoon.request.getParameter( "Dev_WzMtsNo" );
			pocketDetails.Dev_Description = cocoon.request.getParameter( "Dev_Description" );
			pocketDetails.Prj_PrjId = cocoon.request.getParameter( "Prj_PrjId" );
			pocketDetails.Dev_DtId = cocoon.request.getParameter( "Dev_DtId" );
			
			//if ( validateProjectDetails( projectDetails ) ) {
			addPocketDb( pocketDetails );
			if ( cocoon.request.getParameter( "submit-next" ) != null ) {
				pocketDetails.Dev_Serial = "";
				pocketDetails.Dev_License = "";
				pocketDetails.Dev_Description = "";
			} else {
			cocoon.redirectTo( "/gemini-manager/service/pocket-list?project.chk=&project.input=0" );
			}
		}
		if ( cocoon.request.getParameter( "submit-cancel" ) != null ) {
			cocoon.redirectTo( "/gemini-manager/service/pocket-list?project.chk=&project.input=0" );
		}
		
		cocoon.sendPageAndWait( "view/pocket-add.jx", { typeList: typeList.rows, 
														projectList: projectList.rows, 
														pocket: pocketDetails, 
														message: message } );		
	}
}

-- 
            __
         | /  \ |        Leszek Gawron            //  \\
        \_\\  //_/       ouzo@wlkp.org           _\\()//_
         .'/()\'.     Phone: +48(501)720812     / //  \\ \
          \\  //  recursive: adj; see recursive  | \__/ |


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: JXPath usage problem

Posted by Leszek Gawron <ou...@wlkp.org>.
On Tue, Sep 23, 2003 at 08:15:44AM -0700, Christopher Oliver wrote:
> What output do you get (if any)? 
I get the select filled with all options of which none has the selected
attribute set 

> And what type of object is "typeList"?
it is ScriptableRowSet.rows (Database.js and helper classes)

> >><select style="width: 147" name="Dev_DtId">
> >>	<t:forEach select="#{typeList}">
> >>		<t:choose>
> >>			<t:when test="#{/pocket/Dev_DtId = Dt_DtId}">
> >>				<option value="#{Dt_DtId}" 
> >>				selected="">#{Dt_Type}</option>
> >>			</t:when>
> >>			<t:otherwise>
> >>				<option 
> >>				value="#{Dt_DtId}">#{Dt_Type}</option>
> >>			</t:otherwise>
> >>		</t:choose>
> >>	</t:forEach>
> >></select>
> >>   
> >>
> >Hmm ... I forgot to write that I've tried this also, but to be sure I tried
> >again now - still does not work.

-- 
            __
         | /  \ |        Leszek Gawron            //  \\
        \_\\  //_/       ouzo@wlkp.org           _\\()//_
         .'/()\'.     Phone: +48(501)720812     / //  \\ \
          \\  //  recursive: adj; see recursive  | \__/ |


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: JXPath usage problem

Posted by Christopher Oliver <re...@verizon.net>.
What output do you get (if any)? And what type of object is "typeList"?

Leszek Gawron wrote:

>On Mon, Sep 22, 2003 at 08:26:41PM -0700, Christopher Oliver wrote:
>  
>
>>Try this:
>>
>><select style="width: 147" name="Dev_DtId">
>>	<t:forEach select="#{typeList}">
>>		<t:choose>
>>			<t:when test="#{/pocket/Dev_DtId = Dt_DtId}">
>>				<option value="#{Dt_DtId}" 
>>				selected="">#{Dt_Type}</option>
>>			</t:when>
>>			<t:otherwise>
>>				<option 
>>				value="#{Dt_DtId}">#{Dt_Type}</option>
>>			</t:otherwise>
>>		</t:choose>
>>	</t:forEach>
>></select>
>>    
>>
>Hmm ... I forgot to write that I've tried this also, but to be sure I tried
>again now - still does not work.
>	LG
>  
>



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: JXPath usage problem

Posted by Leszek Gawron <ou...@wlkp.org>.
On Mon, Sep 22, 2003 at 08:26:41PM -0700, Christopher Oliver wrote:
> Try this:
> 
> <select style="width: 147" name="Dev_DtId">
> 	<t:forEach select="#{typeList}">
> 		<t:choose>
> 			<t:when test="#{/pocket/Dev_DtId = Dt_DtId}">
> 				<option value="#{Dt_DtId}" 
> 				selected="">#{Dt_Type}</option>
> 			</t:when>
> 			<t:otherwise>
> 				<option 
> 				value="#{Dt_DtId}">#{Dt_Type}</option>
> 			</t:otherwise>
> 		</t:choose>
> 	</t:forEach>
> </select>
Hmm ... I forgot to write that I've tried this also, but to be sure I tried
again now - still does not work.
	LG
-- 
            __
         | /  \ |        Leszek Gawron            //  \\
        \_\\  //_/       ouzo@wlkp.org           _\\()//_
         .'/()\'.     Phone: +48(501)720812     / //  \\ \
          \\  //  recursive: adj; see recursive  | \__/ |


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: JXPath usage problem

Posted by Christopher Oliver <re...@verizon.net>.
Try this:

<select style="width: 147" name="Dev_DtId">
	<t:forEach select="#{typeList}">
		<t:choose>
			<t:when test="#{/pocket/Dev_DtId = Dt_DtId}">
				<option value="#{Dt_DtId}" selected="">#{Dt_Type}</option>
			</t:when>
			<t:otherwise>
				<option value="#{Dt_DtId}">#{Dt_Type}</option>
			</t:otherwise>
		</t:choose>
	</t:forEach>
</select>


JXPath doesn't support the text() function on Bean nodes.


Leszek Gawron wrote:

>How can I map this functionality that uses JEXL (which works):
><t:forEach var="type" items="${typeList}">
>	<t:choose>
>		<t:when test="${pocket.Dev_DtId == type.Dt_DtId}">
>			<option value="${type.Dt_DtId}" selected="">${type.Dt_Type}</option>
>		</t:when>
>		<t:otherwise>
>			<option value="${type.Dt_DtId}">${type.Dt_Type}</option>
>		</t:otherwise>
>	</t:choose>
></t:forEach>
>
>to JXPath ?
>
>This does not work:
><select style="width: 147" name="Dev_DtId">
>	<t:forEach select="#{typeList}">
>		<t:choose>
>			<t:when test="#{/pocket/Dev_DtId/text() = Dt_DtId/text()}">
>				<option value="#{Dt_DtId}" selected="">#{Dt_Type}</option>
>			</t:when>
>			<t:otherwise>
>				<option value="#{Dt_DtId}">#{Dt_Type}</option>
>			</t:otherwise>
>		</t:choose>
>	</t:forEach>
></select>
>
>my flow procedure is:
>function addPocket( pocketId ) {
>	var message="";
>	var pocketDetails = {};
>	
>	var typeList = getTypesDb();
>	var projectList = getProjectsDb();
>	
>	pocketDetails.Dev_Serial = "";
>	pocketDetails.Dev_License = "";
>	pocketDetails.Dev_InvoiceNo = "";
>	pocketDetails.Dev_WzNo = "";
>	pocketDetails.Dev_WzMtsNo = "";
>	pocketDetails.Dev_Description = "";
>	pocketDetails.Prj_PrjId = 0;
>	pocketDetails.Dev_DtId = typeList[ 0 ];
>	
>	var first = true;
>	while( true ) {
>		if ( !first ) {
>			typeList = getTypesDb();
>			projectList = getProjectsDb();
>			first = false;
>		}
>		if ( 	cocoon.request.getParameter( "submit-save" ) != null || 
>				cocoon.request.getParameter( "submit-next" ) != null ) {
>			pocketDetails.Dev_Serial = cocoon.request.getParameter( "Dev_Serial" );
>			pocketDetails.Dev_License = cocoon.request.getParameter( "Dev_License" );
>			pocketDetails.Dev_InvoiceNo = cocoon.request.getParameter( "Dev_InvoiceNo" );
>			pocketDetails.Dev_WzNo = cocoon.request.getParameter( "Dev_WzNo" );
>			pocketDetails.Dev_WzMtsNo = cocoon.request.getParameter( "Dev_WzMtsNo" );
>			pocketDetails.Dev_Description = cocoon.request.getParameter( "Dev_Description" );
>			pocketDetails.Prj_PrjId = cocoon.request.getParameter( "Prj_PrjId" );
>			pocketDetails.Dev_DtId = cocoon.request.getParameter( "Dev_DtId" );
>			
>			//if ( validateProjectDetails( projectDetails ) ) {
>			addPocketDb( pocketDetails );
>			if ( cocoon.request.getParameter( "submit-next" ) != null ) {
>				pocketDetails.Dev_Serial = "";
>				pocketDetails.Dev_License = "";
>				pocketDetails.Dev_Description = "";
>			} else {
>			cocoon.redirectTo( "/gemini-manager/service/pocket-list?project.chk=&project.input=0" );
>			}
>		}
>		if ( cocoon.request.getParameter( "submit-cancel" ) != null ) {
>			cocoon.redirectTo( "/gemini-manager/service/pocket-list?project.chk=&project.input=0" );
>		}
>		
>		cocoon.sendPageAndWait( "view/pocket-add.jx", { typeList: typeList.rows, 
>														projectList: projectList.rows, 
>														pocket: pocketDetails, 
>														message: message } );		
>	}
>}
>
>  
>



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org