Re: message bundle from listener

2005-08-25 Thread Rahul P Akolkar
::SammyRulez:: [EMAIL PROTECTED] wrote on 08/25/2005 06:11:54 PM:
 Hi all
 
 I would like to store in an application scope variable a message
 bundle via listener when the application stat up... something like:
 
  public void contextInitialized(ServletContextEvent event) {
 
 ResourceBundle strings = ResourceBundle.getBundle(strings);
 
 event.getServletContext().setAttribute(labels,strings);
 
 
 }
 
 and retrive the string messages via jstl whit fmt:message
 
 fmt:message bundle=${labels} key=appWelcome/
 
 but I bump in an exception:
 
 org.apache.jasper.JasperException: jsp.error.beans.property.conversion
 org.apache.jasper.runtime.JspRuntimeLibrary.
 getValueFromPropertyEditorManager(JspRuntimeLibrary.java:885)
 
 
 any ideas on what obj to use to store string in the application scope
 via servlet context?
snip/

javax.servlet.jsp.jstl.fmt.LocalizationContext

i.e.

event.getServletContext().setAttribute(labels, new 
LocalizationContext(strings));

And if anyone asks, I insisted on the two argument constructor ;-)

[ 
http://java.sun.com/products/jsp/jstl/1.1/docs/api/javax/servlet/jsp/jstl/fmt/LocalizationContext.html
 
]

-Rahul


 
 thanks
 
 
 
 -- 
 ::SammyRulez::
 http://sammyprojectz.blogspot.com



Re: Dynamic vars in c:set

2005-08-25 Thread Rahul P Akolkar
Dylan MacDonald [EMAIL PROTECTED] wrote on 08/25/2005 06:42:03 PM:
 Hi -
 
 I was wondering whether it was possible to set the var in the c:set tag
 dynamically?  For example, within my forEach tags I want to build a
 list of page variables dynamically based on the index (or the varStatus
 count) of the loop:
 
 c:forEach var=parameter items=${paramValues} varStatus=status
c:set var=variable${status.count} value=${parameter.key} /
 /c:forEach
 
 which I can then access in the page as variable1, variable2, etc.  I
 assumed this was alright since I am using EL within the var attribute,
 but alas it doesn't seem to work.  Any ideas or workarounds?
snip/

You can't gensym name-from-attribute's in JSP. The more important question 
is why you think it is necessary. In other words, even if you created 
variable1, ... ,variableN in pageContext, you'd still want to run a loop 
through them to do something else. You should be able to do without 
gensym, whatever it is you are doing.

-Rahul


 
 Thanks,
 
 Dylan MacDonald
 


Re: Uri confusion

2005-08-11 Thread Rahul P Akolkar
Murray Steele [EMAIL PROTECTED] wrote on 08/10/2005 04:15:26 AM:
 Hi,
 
 The _rt bit means that the taglibs understand runtime expressions as 
 the values of their attributes.
snip/ 
 On 9 Aug 2005, at 08:41, Karianne Berg wrote:
 
  Hi,
 
  I'm quite new to JSTL, and crawling through tutorials and code 
  examples on
  the net got me confused. In the documentation, it says that in order 
  to use
  JSLT 1.1, you have to use the following uri:
  http://java.sun.com/jsp/jstl/core .
  However, I have seen that most code examples use this uri with their 
  JSTL
  1.1 examples: http://java.sun.com/jstl/core_rt. I managed to find out 
  that
  the mystical rt meant runtime, but that was about it. What is the
  difference between those two? Which should I use?

In addition to the earlier reply, with reference to the Standard 
implementation, the former is part of JSTL 1.1 (JSP 2.0 taglib), the 
latter is part of JSTL 1.0 (JSP 1.2 taglib).

This page doesn't answer your question directly, but you might find it 
useful [ http://wiki.apache.org/jakarta-taglibs/FrequentlyAskedQuestions ]

-Rahul



Re: Struts Validator - missing longRange and doubleRange

2005-08-11 Thread Rahul P Akolkar
Givler, Eric [EMAIL PROTECTED] wrote on 08/10/2005 08:16:25 AM:
 Our development tool at the office includes an older version of 
 Struts (v1.16).  The tool mentions some incompatibilities with newer
 versions of struts, so we have not changed this.  Anyway, there is a
 Validator in struts that includes an XML validation-rules file as 
 well as a validator file (for validations specific to your 
 application).  The struts Validator site (online) mentions these two
 validators, but there is NO entry for either in the validator-rules 
file.
 
 If I open the class (org.apache.struts.validator.FieldChecks), I can
 see validateDoubleRange, but I don't see the other.
 
 Can anyone shed a little light on this one?
snip/

Will be a more appropriate post for:
user@struts.apache.org [ http://struts.apache.org/mail.html ]

-Rahul


[ANNOUNCEMENT] Reusable Dialog Components (RDC) 1.0.0 released

2005-07-27 Thread Rahul P Akolkar
The Apache Jakarta Taglibs team is pleased to announce the release of 
version 1.0.0 of the Reusable Dialog Components (RDC) tag library.

JSP 2.0 based Reusable Dialog Components (RDC) is a framework for creating 
JSP taglibs that aid in rapid development of voice and multimodal 
applications. Server-side generation of HTML has proven an effective way 
of generating the user interface for visual Web applications that are 
implemented using server-side application frameworks such as Struts. Over 
time, the effort involved in such HTML generation has been reduced by the 
availability of various JSP tag libraries that abstract away the minutiae 
of HTML markup. The goal of the RDC project is to achieve for voice 
applications what JSP tag libraries have already achieved in the world of 
visual Web applications.

* RDC webpage is here [ 
http://jakarta.apache.org/taglibs/sandbox/doc/rdc-doc/intro.html ]
* RDC wiki is here [ 
http://wiki.apache.org/jakarta-taglibs/ReusableDialogComponents ] 
* RDC 1.0.0 release is available for download here [ 
http://jakarta.apache.org/site/downloads/downloads_taglibs-rdc.cgi ]. 
Source and binaries are distributed separately.
* RDC revision history is available here [ 
http://jakarta.apache.org/taglibs/sandbox/doc/rdc-doc/changes.html ]

- The Apache Jakarta Taglibs Team


Re: c:forEach index in looop

2005-07-27 Thread Rahul P Akolkar
Marco Mistroni [EMAIL PROTECTED] wrote on 07/27/2005 05:30:17 PM:
 hello all,
i am trying to replace struts logic:iterate with  JSTL c:forEach...
 however,  i need what in logic:iterate is the index in the loop
 is it possible to get it from anywhere?
 

c:forEach ... varStatus=status ... 
  ...
  I am in iteration number ${status.count}
  ...
/c:forEach

-Rahul


Re: TagSupport vs BodyTagSupport

2005-07-23 Thread Rahul P Akolkar
Luca Passani [EMAIL PROTECTED] wrote on 07/23/2005 02:28:14 PM:

 ooops, I felt this was a general taglib question, more than a Struts 
 question. It only takes struts as an example,
 but the question is is there a reason why it makes sense to always 
 subclass BodyTagSupport in a tag-library?
snip/

Outside of frameworks, I am usually guarded about any statement that 
matches always do *, especially those related to patterns and 
subclassing.

I often extend SimpleTagSupport (JSP 2.0), and have on occassions, 
preferred it over BodyTagSupport, due to its simpler life cycle.

For a far more detailed commentary, please read the jsp.tagext Javadocs 
here [ 
http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/jsp/tagext/package-summary.html
 
]

-Rahul


Re: URL for String TagLib source code

2005-07-15 Thread Rahul P Akolkar
Henri Yandell [EMAIL PROTECTED] wrote on 07/15/2005 01:29:09 PM:
 On 7/15/05, Robert Taylor [EMAIL PROTECTED] wrote:
  Thanks Martin, but at the risk of sounding ignorant.
  
  The last source link is labeled archives... (not very intuitive)
  I clicked on it and then downloaded the file:
  jakarta-taglibs-string-current.zip 
  
  This appears to be a binary distribution.
 
 Yeah, I can't find a source distribution for any of the taglibs I
 randomly clicked on, either in archives or on the main mirrors. Seems
 bad.

In the mean time, current sources have always been available and linked 
via [ http://jakarta.apache.org/taglibs/#Downloads ], by clicking on the 
appropriate Source links, for supported or sandbox taglibs 
distributions. The sources, AFAIK, were always available as supported or 
sandbox bundles (rather than individual taglib sources), primarily because 
the top level build script fires the individual taglib builds (i.e. you'd 
be at a loss to build without having the bits one level up). Once you have 
those, however, you can use your discretion to build the taglibs that 
interest you.

Links from the download section mentioned above lead to (Robert, you'll 
find the String taglib sources by following the first link below):
Supported [ http://cvs.apache.org/builds/jakarta-taglibs/nightly/src/ ] 
Sandbox [ 
http://cvs.apache.org/builds/jakarta-taglibs-sandbox/nightly/src/ ]

-Rahul

 
 Hen



Re: URL for String TagLib source code

2005-07-15 Thread Rahul P Akolkar
Henri Yandell [EMAIL PROTECTED] wrote on 07/15/2005 01:53:07 PM:
snip/ 
 While I'm on a slightly different topic:
 
 * we really don't release source when we release code?

AFAICT. Which is why I had to prepend my earlier post with In the mean 
time, ...

Do we have tags for all past releases? I think this is becoming more 
appropriate for the dev list.

-Rahul

P.S.- Robert, thanks for bringing this up!

 
 Hen


Re: c:import and context attribute

2005-07-15 Thread Rahul P Akolkar
Dylan MacDonald [EMAIL PROTECTED] wrote on 07/13/2005 05:41:46 PM:
 Can someone explain the context attribute in the c:import tag?
 
snip/

It is used in cross-context imports and is the name of the context you're 
importing from. Most containers need to be configured to enable 
cross-context access.

 I'm working in a development environment that differs from the
 production environment in that the root of the server isn't /, it's
 /www (the production root is obviously /).
 
snap/

I'm not sure I got this (I thought for a bit you were implying the 
difference between deploying, say, ROOT.war and mywebapp.war on Tomcat). 
In any case, relative urls like the one in the first c:import below should 
work if you are migrating all the contents of the context from the 
production to the dev environment. Portable code will prepend the context 
path obtained from the request at JSP invocation to any urls that need it. 
I don't think there is a cross-context angle to your problem, in reference 
to your earlier question about the context attribute.

-Rahul


 Needless to say this makes it difficult to code anything with
 root-relative (e.g. /images/logo.gif) links.  I can probably work
 around some of this but I thought I might be able to solve some of my
 issues with my jsp includes using the context attribute.  But I cannot
 get it to work.
 
 I assumed I would change my c:import tag from this
 
 c:import url=includes/footer.jsp /
 
 to this:
 
 c:import url=/includes/footer.jsp context=/www /
 
 but that doesn't work.  Any ideas?
 
 Thanks,
 
 Dylan MacDonald



Re: [SOLVED] Re: how to debug jsp compilation error in Tomcat 5.5 ?

2005-06-17 Thread Rahul P Akolkar
Woodchuck [EMAIL PROTECTED] wrote on 06/17/2005 11:18:17 AM:
  The lists have been slow. Please do not send multiple copies :-)
 
 i also noticed there seems to be multiple copies of my original post. 
 i do not know why, i only sent once. 

OK, sorry about the banter ;-) It seems we had quite a few incidences like 
that yesterday.

 aha!  just as you stated, i found HTML tags sitting within c:choose
 but outside of c:when and c:otherwise

 well, i guess this was ok in Struts 1.1 but not anymore in Struts 1.2.7
 (or is this an unintentional change?)

The message is produced by the standard's TLVs (JSTL). The behavior you 
are seeing is expected (the semantics of c:choose means the intent of 
having template text outside a legal child is unclear). Not sure why it 
worked for you before.

 
 thanks, Rahul, and everyone that tried to help! :)

You're welcome.

-Rahul


Re: [OT] Using JSTL 1.1.2 with Tomcat 5.5 J2SE 5.0

2005-06-06 Thread Rahul P Akolkar
Dino Klein [EMAIL PROTECTED] wrote on 06/06/2005 09:16:07 AM:

 I have two jspx files (pasted below), where one includes the other.
 When I remove the xmlns:c declaration/importation - it works; similarly, 
 
 when I do not include the other file, it also works fine.
snip/
 (1) main.jspx
 ==
 ?xml version=1.0 encoding=UTF-8?
 jsp:root xmlns:jsp=http://java.sun.com/JSP/Page; version=2.0
 maintag xmlns:c=http://java.sun.com/jsp/jstl/core;
jsp:directive.include file=one.jspx/
 /maintag
 /jsp:root
 =
 
 (2) one.jspx
 =
 ?xml version=1.0 encoding=UTF-8?
 jsp:root xmlns:jsp=http://java.sun.com/JSP/Page; version=2.0
tagahello/taga
 /jsp:root
 =

This is not a JSTL issue, marked OT. In XML views of JSPs, the included 
file is expanded in place. And jasper2 isn't happy because there are more 
than one jsp:root elements in the XML view of main.jspx. In your case, I 
don't see any need for either of the two jsp:root elements (unless you 
simplified before posting, and you have a legitimate need). Remove either, 
or both, and you should be fine.

I think you've raised an interesting question. It seems jasper2 will not 
allow includes in the scenarios that result in more than one jsp:root 
elements in the expanded view. Please check if the spec says anything 
about this. If not, I would:
1) Ask for clarification on jsp spec public (unless Mark or Pierre listen 
to this list, and answer)
2) Post on tomcat-user, wait for feedback (follow with a bug report, 
depending on feedback)

-Rahul


Re: Using JSTL 1.1.2 with Tomcat 5.5 J2SE 5.0

2005-06-06 Thread Rahul P Akolkar
Dino Klein [EMAIL PROTECTED] wrote on 06/06/2005 03:44:38 PM:
snip/
 I did some primitive debugging, and all I could find out is that if I 
use 
 xmlns:fn=http://java.sun.com/jsp/jstl/functions;, then I have no 
 problems; I checked the TLDs, and I noticed that it does not include a 
 validator like the rest (c, sql, fmt, x - all do, and cause problems).

I tried this, you are right. It turns out the bit in my earlier email that 
talked about multiple jsp:root's in the expanded view was FUD, my sincere 
apologies. I've removed the OT marker. Unless someone else has an 
explanation, you can:
1) Dig into the JSTL TLV impls
2) File a bug report (if you're sufficiently convinced)
The two options are not mutually exclusive ;-)

-Rahul


Re: Upgrade from Tomcat 4 to 5

2005-06-03 Thread Rahul P Akolkar
Nic -

I recommend downloading the JSTL 1.1 Spec Maintenance Release from here [ 
http://java.sun.com/products/jsp/jstl/ ] and reading Appendix A 
(Compatibility  Migration), specifically A.2 deals which JSTL 1.0 - 1.1 
migration. Should have everything you need to know.

-Rahul


Re: c:out problem

2005-05-31 Thread Rahul P Akolkar
See Question 1 on Taglibs Wiki FAQ [ 
http://wiki.apache.org/jakarta-taglibs/FrequentlyAskedQuestions ]

-Rahul


Andy [EMAIL PROTECTED] wrote on 05/31/2005 09:29:37 AM:

 
 
 I have another problem ! (what is going on today?) Why can't I print out 
the
 value of a variable using c:out ? The below example was copied from
 http://javaalmanac.com/egs/javax.servlet.jsp.jstl.core/attr.html
 
 
 c:set var=name1 value=value1 scope=page /
 c:set var=com_mycompany_name2 value=value2 scope=request /
 c:set var=com_mycompany_name3 value=value3 scope=session /
 c:set var=com_mycompany_name4 value=value4 scope=application 
/
 
 %-- Show the saved values --%
 c:out value='${pageScope.name1}' /  br
 c:out value='${requestScope.com_mycompany_name2}' / br
 c:out value='${sessionScope.com_mycompany_name3}' / br
 c:out value='${applicationScope.com_mycompany_name4}' / br
 
 
 All I get is -
 
 ${pageScope.name1}
 ${requestScope.com_mycompany_name2}
 ${sessionScope.com_mycompany_name3}
 ${applicationScope.com_mycompany_name4}
 
 Thanks,
 
 Andy.
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 


RE: c:choose not evaluating correctly

2005-05-31 Thread Rahul P Akolkar
A jsp:useBean declaration, that changes things ;-)

On 5/31/05, Andy [EMAIL PROTECTED] wrote:
snip/
 I can see lots of horrible conditional glue logic in my future.

No, really, atleast not because of whats discussed in this thread.

I would:
1) Set the session attribute in the Struts layer only if the 
username/password were valid (thats what you're doing)
2) Not have a jsp:useBean declaration in the JSP (so if the 
username/password is not valid, a bean isn't instantiated)
3) Use the empty operator in EL expressions (on the 'userSession' bean 
itself, not any property)
4) Change this bit:

Username:
jsp:useBean id=userSession scope=session
class=template.filter.UserSession/
jsp:getProperty name=userSession property=username/jsp:getProperty

(I suspect the userSession constructor initializes username to a non-null 
value? Otherwise, you'd see a NPE here?)

to this:

c:if test=${not empty sessionScope.userSession}
  Username: ${sessionScope.userSession.username}
/c:if

-Rahul


Re: join and arrays

2005-05-26 Thread Rahul P Akolkar
Lookup the varStatus attribute of x:forEach, it will allow you to query 
for boundary cases (first/last) amongst other things and you can use that 
to decide when the trailing delimiter is not needed (for the last 
iteration of the forEach).

-Rahul

On 5/26/05, Kralidis,Tom [Burlington] [EMAIL PROTECTED] wrote:
 
 Hi,
 
 I have a JSP which parses an XML document and inserts records into a DB.
 
 For multiple XML elements, I do the following:
 
 sql:transaction dataSource=${ds_devgeodb}
  sql:update
  insert into service_endpoints (keywords) values
  ('x:forEach
 select=$doc/WMT_MS_Capabilities/Service/KeywordList/Keyword
 var=kwx:out select=text()/,/x:forEach')
  /sql:update
 /sql:transaction
 
 Which works okay, except that the values in the DB end up as:
 
 keyword1,keyword2,keyword3,
 
 ..whereas I would prefer
 
 keyword1,keyword2,keyword3
 
 (i.e. without the trailing comma)
 
 I checked the fn:join() function, which looks like it would do the
 trick, but how does one set an array in JSTL?
 
 Any advice would be appreciated.
 
 Thanks
 
 ..Tom
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 


Re: counter in forEach tag?

2005-05-26 Thread Rahul P Akolkar
varStatus is good here too, it can give you the count of the current 
iteration. With that, for example, you can do a modulo 2 operation for 
alternating bgcolors or style classes.

-Rahul


Scott Purcell [EMAIL PROTECTED] wrote on 05/26/2005 12:58:20 PM:

 Hello,
 I have this scenario come up occasionally, and have to opt to JSP 
 expressions on the page for a work-around.
 
  c:choose
   c:when test=${assetCollection == null}
  nothing
   /c:when
   c:otherwise
 c:forEach var=asset items=${assetCollection}
 
 
 BODY
 
 
   c:out value=${asset.assetId} /
 /c:forEach
   /c:otherwise
 /c:choose
 
 
 In the forEach section, I am going to create a rows in a table which
 will be different colors for each row. How can I put in a counter 
 that I can then change the row color for? Basically, I would like to
 know what asset I am on in the body.
 
 Thanks,
 Scott
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 


Re: Getting a substring

2005-05-10 Thread Rahul P Akolkar
Jakarta Taglibs has a JSTL implementation here:
http://jakarta.apache.org/taglibs/doc/standard-doc/intro.html

Please look at the EL functions library, specifically the substring 
function.

-Rahul

On 5/10/05, Darryl Pierce [EMAIL PROTECTED] wrote:
 How can one get the substring from a string value in JSTL?
 
 --
 Darryl L. Pierce [EMAIL PROTECTED]
 Visit the Infobahn Offramp: http://mcpierce.mypage.org
 Bury me next to my wife. Nothing too fancy... - Ulysses S. Grant
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 


Re: JSTL Recursion possible??

2005-05-02 Thread Rahul P Akolkar
I, for one, did not understand the question (or what the nesting you show 
has to do with JSTL recursion). Can you please try again?

Thanks,
-Rahul

On 5/2/05, Gros, Martin [EMAIL PROTECTED] wrote:
 JSTL and recursion, is this possible?
 
 e.g. walk an xml tree with same element names on different levels?
 
 a
b/
b/
c
b/
/c
c
b
b/
/b
/c
b
 /a
 
 i want an output like
 
 b
 b
 --b
 --b
 b
 b
 
 is this possible? if yes, could you provide a short example?
 
 thanks
 
 Martin
 
 


[ANN] Recent changes to the RDC sandbox taglib (was Re: [ANN] First beta release of the RDC sandbox taglib)

2005-04-25 Thread Rahul P Akolkar
A clarification is due, the recent changes do not constitute a release of 
the RDC sandbox taglib, please view Martin's note here for details:
http://marc.theaimsgroup.com/?l=taglibs-devm=111440395623056w=2

-Rahul


On 4/24/05, Rahul P Akolkar [EMAIL PROTECTED] wrote:
 The RDC sandbox taglib [
 http://jakarta.apache.org/taglibs/sandbox/doc/rdc-doc/intro.html ] has a
 new features beta 1.0 
incorrectrelease/incorrect
correctionversion/correction.
 
 Major Changes:
 1) Defining Custom Event tuples - It is possible to leverage VoiceXML
 support for user defined event (name, grammar, handler) tuples. These
 tuples can be conveniently added to the RDC configuration files.
 2) Dialog Context Switching - A recipe for switching dialog contexts 
using
 the RDC framework i.e. having the ability to leave a task (dialog)
 unfinished, initiate and complete another task and then come back to the
 earlier task, has been demonstrated.
 3) Multi-channel amazon application - This sample application uses the
 Amazon Web Services to provide users with a Small Device GUI -or- Voice
 User Interface for browsing and buying music albums [ sample 
applications
 are available in rdc-examples.war ]
 4) More documentation in rdc-doc.war [also available online at:
 http://jakarta.apache.org/taglibs/sandbox/doc/rdc-doc/index.html ]
 
 New RDC Tag:
 1) rdc:pause - Pauses until the user resumes the application.
 
 Modified RDC Tag:
 1) rdc:struts-submit - Added the ability to selectively clear some or
 all of the RDC session state.
 
 Sandbox source is here [
 http://cvs.apache.org/builds/jakarta-taglibs-sandbox/nightly/src/ ]
 RDC binaries are here [
 
http://cvs.apache.org/builds/jakarta-taglibs-sandbox/nightly/projects/rdc/
 ]
 RDC revision history is available here [
 http://jakarta.apache.org/taglibs/sandbox/doc/rdc-doc/changes.html ]
 
 -Rahul  Akolkar
 
 


[ANN] First beta release of the RDC sandbox taglib

2005-04-24 Thread Rahul P Akolkar
The RDC sandbox taglib [ 
http://jakarta.apache.org/taglibs/sandbox/doc/rdc-doc/intro.html ] has a 
new features beta 1.0 release.

Major Changes: 
1) Defining Custom Event tuples - It is possible to leverage VoiceXML 
support for user defined event (name, grammar, handler) tuples. These 
tuples can be conveniently added to the RDC configuration files.
2) Dialog Context Switching - A recipe for switching dialog contexts using 
the RDC framework i.e. having the ability to leave a task (dialog) 
unfinished, initiate and complete another task and then come back to the 
earlier task, has been demonstrated.
3) Multi-channel amazon application - This sample application uses the 
Amazon Web Services to provide users with a Small Device GUI -or- Voice 
User Interface for browsing and buying music albums [ sample applications 
are available in rdc-examples.war ]
4) More documentation in rdc-doc.war [also available online at: 
http://jakarta.apache.org/taglibs/sandbox/doc/rdc-doc/index.html ]

New RDC Tag: 
1) rdc:pause - Pauses until the user resumes the application.

Modified RDC Tag:
1) rdc:struts-submit - Added the ability to selectively clear some or 
all of the RDC session state. 

Sandbox source is here [ 
http://cvs.apache.org/builds/jakarta-taglibs-sandbox/nightly/src/ ]
RDC binaries are here [ 
http://cvs.apache.org/builds/jakarta-taglibs-sandbox/nightly/projects/rdc/ 
]
RDC revision history is available here [ 
http://jakarta.apache.org/taglibs/sandbox/doc/rdc-doc/changes.html ]

-Rahul  Akolkar


Re: c:when problem

2005-04-21 Thread Rahul P Akolkar
c:when  test=${nc.Response=='Exchange Failure'  !empty nc.readyDate}

On 4/21/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 Hi There,
 i have a strange problem when i am using a when clause with multiple
 conditions, ie
 
 c:choose
 c:when  test=${nc.Response=='Exchange Failure'}  ${!empty 
nc.readyDate}
 Planned
 /c:when
 c:when  test=${nc.Response!='SUCCESS'}
 ${nc.Response}
 /c:when
 c:otherwise
 Enabled
 /c:otherwise
 /c:choose
 
 for my example I know that Response = 'Exchange Failure' and that there 
is  a
 readyDate.  However the condition never evaluates to true.  ie i  would
 expect the word planned to be printed, but it isn't.  Is there something 
i've over
 looked here?
 
 thx in advance pg
 
 


Re: packing images and style sheets with a taglib

2005-04-19 Thread Rahul P Akolkar
 I have a taglib that I am packaging up as a jar 
 and I'm trying to figure out how I can package it
 with images and style sheets that could be 
 referenced in a relative path like img 
 src=/mytaglibimages/car.gif in the taglib code. 

Not sure if you can get relative paths to work with no overhead to the 
taglib user. 

One possibility is to serve the resources using a servlet that maps to the 
url pattern /mytaglibimages/* (or some such). This allows you to pack the 
resources and the servlet in your distro, but the user needs to add the 
servlet definition/mapping to the deployment descriptor (which, arguably, 
might be less error-prone, less of an overhead and easier to document).

-Rahul

P.S.- If you choose to put the servlet in, package java.util.jar provides 
the necessary classes.


Re: packing images and style sheets with a taglib

2005-04-19 Thread Rahul P Akolkar
  It also means you have to deal with cache 
 headers, so that you're not serving up the
 same images to the same browser again and again.

Very true, cache, response-type, in short, you have to behave like a good 
web server ;-) However, its definitely manageable, and by pulling some of 
the overhead upon the taglib author, it aims for taglib user convenience. 
OTOH, the vanilla solution seems to be an auxillary resource bundle (not 
in the i18n sense) users need to download and plop into each app/war. So.

-Rahul


Re: Retrieve a session attribute

2005-04-14 Thread Rahul P Akolkar
 I thought a JSP would share the same session within
 the servlet if a session already exists in the
 container. JSP is eventually translated into servlet
 code, doesn't it? 

 I insert the log message code in the servlet before
 getting to the JSP and find that a session already
 exists at the point. If a session in JSP is unrelated
 with a session in servlet, how these two share session
 attributes?

Again, the page directive specifies whether the JSP joins a session (if 
one is already associated with the current request -- as in your case). By 
specifying the attribute value false, you're saying you do not want to 
join the session, and hence, waiving your ability to access anything 
within the session.

Please read the related bit here:

http://java.sun.com/products/jsp/tags/syntaxref.fm7.html

-Rahul


Re: c:forEach problem

2005-03-29 Thread Rahul P Akolkar
 c:forEach var=directory
 items=CONTEXT_STRUCTURE.directories 

EL expression for items? String argument will be treated as a CSV.

-Rahul


Re: Odd behavior of Number/String conversion??

2005-03-08 Thread Rahul P Akolkar
Rick wrote:

 Thanks Rahul for the info. I'm wondering which would have 
 less overhead behind the scenes... using the replace like
 you have it above or storingwhat I want to replace in
 a temp var? The reason I ask is this operation will have
 to actually be repeated several times within an outer loop.

For your example, it doesn't matter.

First off, performance discussions will be container specific. In the 
reference implementation (tomcat/jasper), when o.a.j.compiler.Generator 
gets you the Servlet class to compile, you'll find a bunch of 
PageContextImpl.proprietaryEvaluate() calls in the code, which are in turn 
using commons.el to do the actual EL evaluation. An rtexpr true tag 
attribute will be sent to commons.el expression evaluator impl as-is, a 
standalone EL expression is broken down in an ordered list of ELNode.Text, 
ELNode.Root, ELNode.Function nodes (broken down once per JSP mod) so only 
the true expression snippets make it to EL evaluation. There are a bunch 
of StringBuffer manipulations along most of these steps, fn:replace() has 
its own StringBuffer manipulations, and in the larger scheme of things, 
for the example we're discussing, the difference in overheads is 
definitely nothing to lose sleep over ;-) Take your pick.

If you want to pursue this, try a simple (t2-t1) timing study on the two 
options. I'd be very surprised if either option comes out a clear winner.

-Rahul


Re: Odd behavior of Number/String conversion??

2005-03-07 Thread Rahul P Akolkar
 trying to convert String field. to type java.lang.Doublesnip
 I even tried using the fn:trim tag which is supposed to return a String

In short, the spec says so :-) 

Remember, + is not string concatenation in JSPs, it is an arthmetic 
operator. The rogue argument here is not the index (so trimming the index 
won't help), its the String field., and the dot triggers the String to 
Double coercion (again, as per the spec).

 there must be a way to display this in one expression?

c:set var='theField' value=${metaProps[fn:replace('field.*.type', '*', 
fieldNum)]}/

Conceptually, a fn:join is a better fit here, but I'm not too keen on 
creating arrays in JSPs ;-) Finally, if temporary variables is what you're 
after, 'theField' would be the next in line, although readability has its 
own benefits.

-Rahul


Re: Taglib / context-param question

2005-02-09 Thread Rahul P Akolkar
 If I put the hex values
 of the colors in the context-param area of the web.xml file, how do you
 call them?

pageContext.
getServletContext().getInitParameter(insert-context-param-name-here);

-Rahul


Changes to the RDC sandbox taglib

2005-02-06 Thread Rahul P Akolkar
The RDC sandbox taglib [ 
http://jakarta.apache.org/taglibs/sandbox/doc/rdc-doc/intro.html ] has a 
new features pre beta release. There have been a multitude of code 
enhancements.

Major Changes: 
1) Rule based directed dialog strategy for rule based dialog management 
across child RDCs using the rdc:group container. Illustrates the 
benefits of pluggable dialog management strategies at the group level. [ 
Example: rulebased-conditions.jsp in rdc-examples.war ]
2) RDC template, a mechanism for rapid prototyping of components in the 
RDC framework.  [ Example: simple-template-test.jsp in rdc-examples.war ]
3) Better formalism for authoring components 
4) More documentation in rdc-doc.war [also available online at: 
http://jakarta.apache.org/taglibs/sandbox/doc/rdc-doc/index.html ]

New RDC Tags: 
1) rdc:struts-errors - Plays out any errors messages from the preceding 
struts action as VoiceXML prompts
2) rdc:template - As mentioned above
3) rdc:number - RDC used to collect a number

Sandbox source is here [ 
http://cvs.apache.org/builds/jakarta-taglibs-sandbox/nightly/src/ ]
RDC binaries are here [ 
http://cvs.apache.org/builds/jakarta-taglibs-sandbox/nightly/projects/rdc/ 
]
RDC revision history is available here [ 
http://jakarta.apache.org/taglibs/sandbox/doc/rdc-doc/changes.html ]

-Rahul  Akolkar


Re: trying to create a Html table from a Taglib

2005-01-29 Thread Rahul P Akolkar
 The the tag lib will receive two parameters: the list off skills and
 the number of columns.

snip

 Can I pass a collection, a list, to a tag lib? how?

The c:forEach tag [JSTL core] will allow you to iterate over items in a 
collection, you may add the tr and td elements appropriately before 
and after each item [the varStatus attribute of the c:forEach tag will 
allow you to take care of tracking the item count for the number of 
columns bit and the special case for the last item]. You can also do the 
same in a tag impl and create your own JSP tag.

There are some HTML table generating tags already out there, so you might 
want to look at what those offer first.

-Rahul


Re: Struts integration

2005-01-17 Thread Rahul P Akolkar
 well, how else would I know if that's just a string I need
 to send verbatim to the client, or if I need to retieve the actual
 URL another way?  of course, the resul will be an href attribute
 sent to the client anyway.
 

You're tempting me to reply, so let me blame you for this email ;-) We can 
continue this offline (w.r.t this list) if needed.

Its always going to be a string sent verbatim to the client, irrespective 
of struts/no struts. The struts machinery comes into play once the client 
follows the href on the anchor (think of it as a servlet mapping that you 
as the taglib author don't have to worry about).

 
 are you saying that I don't need to import any Struts specific Jars?

Probably not, if you can rely on HTTP name-value pairs to submit the form 
data to go along with. The part that is most unclear to me in this 
discussion is what your anchor tag will submit to struts. It makes sense 
when the tag submits some data to support operations on the application 
model that the struts controller will use to determine the next view.

-Rahul


Re: Mixing JSTL with scriptlet and problematic evaluation order

2004-12-13 Thread Rahul P Akolkar
c:url var=encodedUrl 
value=Blah.do?sortId=${sortId}...title=${titleText}.../

onclick=javascript:window.open('${encodedUrl}', ...)



 Because I couldn't find a nice JSTL solution, I tried it with a mixture
 of JSTL and the scriptlet:
 
 ...title=' + '%= URLEncoder.encode(c:out value='${titleText}'/,
 UTF-8) %'

 Guess what this results in?
 Well, the scriptlet part must be getting interpreted first, so the
 URLEncoder.encode gets that c:out value... string literal as input,
 instead of getting the output of c:out.  So that doesn't work either.
 
 Here is a bit more of the JavaScript call in question:
 
 onclick=javascript:window.open('Blah.do?sortId=c:out
 value=${sortId}/..title=' + '%= URLEncoder.encode(c:out
 value='${titleText}'/, UTF-8) %', 'Foobar'

jsp:include and internet explorer

2004-11-30 Thread Rahul P Akolkar

Return Receipt
   
Your  jsp:include and internet explorer
document   
:  
   
was   Rahul P Akolkar/Watson/IBM   
received   
by:
   
at:   11/30/2004 10:51:25  
   





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: JSTL converts ' to #039;

2004-10-29 Thread Rahul P Akolkar
Don't escape XML in the JavaScript bit.

%@ taglib prefix=c uri=http://java.sun.com/jsp/jstl/core; %
c:set var=foobar value=Foo's Moos /
html
headscript language=JavaScriptalert(c:out value='${foobar}' 
escapeXml='false' /);/script/head
body bgcolor=white
c:out value=${foobar} /
/body
/html

-Rahul


Re: [INPUT] Is input:text .../ producing the correct HTML?

2004-10-23 Thread Rahul P Akolkar
 Is this a non-impacting bug?


This will be helpful (W3C HTML and XHTML FAQ):

http://www.w3.org/MarkUp/2004/xhtml-faq

-Rahul


RE: Error: org.xml.sax.SAXParseException: Content is not allowed in prolog.

2004-10-22 Thread Rahul P Akolkar
c:import var=nieuwsXML url=nieuws.xml 
  x:parse doc=${nieuwsXML} var=nieuwsDOC  /
/c:import

-Rahul


Re: How to avoid the line breaks when a tag file used within javascript?

2004-10-21 Thread Rahul P Akolkar
This thread has gotten too long to ignore :-)

trimSpaces probably won't do it for you.

As my bit, I tried this trivial JSP:

%@ taglib prefix=c uri=http://java.sun.com/jsp/jstl/core; %%--
--%tag attr=foo('jsp:include page=test.jsp /')%--
--%anotherTag /

where test.jsp is another trivial JSP as follows:

%@ taglib prefix=c uri=http://java.sun.com/jsp/jstl/core; %%--
--%A, c:if test=${true}%--
--%B, %--
--%/c:ifC

I don't have a newline after /c:ifC, and I get this output:

tag attr=foo('A, B, C')anotherTag /

Ugly code? Yes. But I believe the output is similar to what you want from 
your example.

Now why it doesn't work for you is another issue. I'm using Tomcat and 
Emacs.

-Rahul


Re: VoiceXML RDC with return element

2004-09-21 Thread Rahul P Akolkar
Looks like you are all set. The submit URI defaults to the JSP page 
hosting the RDC tag.

Sidebar:

Think of each RDC as a conversation with the user, with potentially 
multiple round trips. As an example,

rdc:date id=myDate minDate=01012004 maxDate=01012005
  confirm=true echo=true /

might lead to this use case (prompts might differ, you can customize the 
prompts for your application using a custom XML config ... customization 
examples are available in the distribution):

S: Please specify a date.
U: *silence--timeout*
S: I did not hear anything. Please specify a date.
   // client-side no-input event
U: january second two thousand five 
S: Please specify an earlier date. 
   // Round Trip 1: input did not meet contraints
U: january second two thousand four
S: I think you said january second two thousand four. Is that right? 
   // Round Trip 2: input was good ... JSP author said confirm=true
U: Yes
S: OK, january second two thousand four. Got it.
   // Round Trip 3: confirmed value ... JSP author said echo=true

Note that the same date RDC tag produces different VXML when it executes 
server-side depending on where it is in this conversation and what the 
user just said. Submitting to the same JSP page hosting the RDC is done 
underneath the hood (by defaulting submit).

-Rahul



 Thank you, Rahul. You answered my question. :)
 Anyway, I think I'm having setup problem. The content returns from 
date-test.jsp has
 
 ..
script src=/rdc-examples/.grammar/nbest.js/
var name=dateResultNBest expr=serializeNBest()/
submit 
next=/rdc-examples/date-test.jsp;jsessionid=4C96B24FB06E4408691A9BB
 08E4E84F7 namelist=dateResultNBest/
  /filled
 /field
 
 It shouldn't have it since I didn't use submit attribute in 
rdc:date, correct?
 Besides installing rdc-examples.war from 
jakarta-taglibs-sandbox-rdc-20040921.tar.gz, do I need to do anything 
else?
 
 Thanks again,


Re: VoiceXML RDC with return element

2004-09-20 Thread Rahul P Akolkar
I don't understand what you mean by generate RDC with return element. 
A RDC can be used in any VoiceXML form, and whether that form is 
referenced as a subdialog elsewhere does not change the RDC behavior (and 
hence, you shouldn't have to create a RDC that can be used in 
subdialog).

The underlying principle that might help here is the fact that whenever a 
RDC completes execution (and hence, has a value that is legal within the 
constraints set via the tag attributes) its value appears as a PageContext 
variable with the same name as the ID of the RDC. As an example, here is a 
parent VXML page (which might as well be a JSP page):

?xml version=1.0 encoding=UTF-8 ? 
vxml  version=2.0 xml:lang=en-US  xmlns=http://www.w3.org/2001/vxml; 

form
subdialog name=subdia src=test.jsp#return_example
filled
promptValue is value 
expr=subdia.dateReturned //prompt
/filled
/subdialog
/form
/vxml

Where test.jsp is like so (Grab date-test.jsp from the examples in the 
distribution and replace the form element with the following):

  form id=return_example 
rdc:date id=myDate minDate=01012004 maxDate=01012005
  confirm=true echo=true /

c:if test=${!(empty myDate)}
block
var name=dateReturned expr='${myDate}' /
return namelist=dateReturned /
/block
/c:if
  /form

Note that you are doing nothing special because the RDC is within a form 
referenced as a subdialog.

-Rahul



Soonthorn A wrote:

 Hi,

 Does anyone has an example that generate RDC with return element? 

 I just learn about jsp taglib today and looked at RDC's tag lib files 
and config files. I couldn't find anything relate to return.  Is
 VoiceXML's return element in your current model? 

 Basically, what I tried to do is to create a RDC that can be used in 
subdialog. 

 Thanks,