Re: Can JSTL xml tags use a Document object in scope or does it require parse first?

2005-01-20 Thread Bill Siggelkow
Rick Reumann wrote:
::SammyRulez:: wrote the following on 1/20/2005 10:24 AM:
according to Bill Siggekow reference x:transform acept
org.w3c.dom.Document object as vule of doc attribute.

But will that only work in conjuction with applying an XSLT style sheet 
to it? I want to be able to use the x:out tags as if just dealing with 
the JSTL parsed doc.

The JSTL spec implies that you can the XML document that represents the 
context can be a DOM object or as the internal representation based on 
my interpretation of the following section from the x:parse section.
=
var and varDom

If var is used, the type of the resulting object is not defined by this 
specification.
This allows implementations to use whatever they deem best for an efficient
implementation of the XML tagset. varDom exposes a DOM document, allowing
collaboration with custom actions. Objects exposed by var and varDom can 
both be
used to set the context of an XPath expression.
==

If this doesn't work, then I suggest exposing a Reader from the bean and 
then parsing it with x:parse (of course, this would mean that you 
probably parsed the thing twice :(

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


RE: Struts integration

2004-11-02 Thread Bill Siggelkow
Here's a way w/o using JSP 2.0 EL:
bean:define id=loginLabel
  bean:message key=label.login/
/bean:define
wall:input type=submit value=%= loginLabel % /

Bill Siggelkow
[EMAIL PROTECTED]
 
 

 -Original Message-
 From: luca [mailto:[EMAIL PROTECTED] 
 Sent: Tuesday, November 02, 2004 3:28 AM
 To: Tag Libraries Users List
 Subject: Struts integration
 
 
 Guys, I need to integrate a new tag-lib into the JSP views of 
 an existing Struts application.
 Here is my problem. I now have:
 
 anchor
go ...
  :
/gobean:message key=label.login / /anchor
 
 This should become:
 
 wall:input type=submit value=bean:message 
 key=label.login / /
 
 Alas, this is not possible. Any idea how this can be achieved?
 I hear there's an EL port which makes EL variables work for 
 Struts tags too. Can it help in this case?
 
 A scriptlet-based solution will do too.
 
 In case you are curious, this is the tag-lib I'm integrating with:
 
 http://wurfl.sourceforge.net/java/tutorial.php
 
 Thanks
 
 Luca
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 


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



RE: forEach and hibernate

2004-10-21 Thread Bill Siggelkow
Well, ... this is just a guess ... 
If some of the properties are lazy loaded and you close the Hibernate
session before reaching the JSP page -- then you will not be able to access
those properties. If this is the case, there are a couple of Solutions.

1) Acquire the Hibernate Session from a ServletFilter that creates and
disposes of the Session.
2) In the Action, call the getters of the lazy loaded properties (or there
may be a better Hibernate) way to load the lazy loaded properties.
3) Don't use lazy loading for he object in question.

-Bill Siggelkow
 
 

 -Original Message-
 From: Lorenzo Sicilia [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, October 21, 2004 5:43 AM
 To: Tag Libraries Users List
 Subject: forEach and hibernate
 
 Hi to all,
 
 I have an action in struts framerwork that it use hibernate.
 
 .., snippets begin ...
 List l = (List) sf.find(from UserSession  where nick_name = 
 ?,loginForm.getUserName(), Hibernate.STRING); us = 
 (UserSession)l.get(0); session.setAttibute(user,us); ... 
 snippets end ...
 
 
 in jstl I want show all properties and value of my bean.
 
 I can use forEach?
 I have tried but I get nothing.
 
 thanks in advace
 
 Regards Lorenzo
 
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 


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



Re: Using a localized pattern with fmt:formatNumber

2004-09-14 Thread Bill Siggelkow
Helios -- you're pretty much right. My reason is basically academic; let 
me exlain -- The Struts bean:write tag applies the pattern as a 
localized pattern if the pattern is retrieved using the formatKey 
attribute. I was basically trying to find out if there was a way to 
emulate this behavior in JSTL. In actuality, the Struts approach yields 
a bug (27636) in that if the pattern is not defined in the resource 
bundle than the pattern specified in the default bundle may very well

Helios Alonso wrote:
Maybe you have to explain why you need to localize your pattern.  I 
mean, can't you use a non-localized pattern even if you have one for 
each locale?

At 16:50 13/09/2004 -0400, you wrote:
Is it possible to apply a localized pattern when using the 
fmt:formatNumber tag?

In other words, I would like the following to work correctly if my 
locale is some European locale like Russian:

Say,I have a Double with a value of 12345.34
fmt:formatNumber value=${dblValue} pattern=# ##0,00/
This does not apply the pattern as a localized pattern ... it does 
work correctly if the pattern is *not* localized as in:

fmt:formatNumber value=${dblValue} pattern=#,##0.00/
The reason I am asking is that the Struts bean:write tag supports 
pulling the format String from a resource bundle; but the value is 
treated as a localized pattern. I am trying to get equivalent behavior 
with the fmt:formatNumber tag.

Let me know if I have not explained this adequately :)
- Bill Siggelkow
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

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


Re: page redirect problem in jstl or jsp?

2004-08-18 Thread Bill Siggelkow
What happens if you go to directly to the page from your browser? Do u
also get a 404? If so, then the problem is with the action mapping and
not the redirect. Perhaps a typo in your struts-config.xml.


Gao Di wrote:
 i use struts framework in my project,and use the jstl
 in the jsp page.now i want to write a page which will
 auto forward to a struts action class,but whatever i
 use jstl or jsp ,it can't find the url either.
 in jstl i use:c:redirect url=SearchAction.do/
 and in jsp i use:
 jsp:forward page=SearchAction.do/
 if i change the url to xxx.jsp or a simple hello
 world servlet,it's ok.but if i use struts
 action,evertime i got page 404,url not found.
 cause i think the struts action is also a servlet in
 essential,maybe there is a way to solve this problem.
 
 _
 Do You Yahoo!?
 150MP3
 http://music.yisou.com/
 
 http://image.yisou.com
 1G1000
 http://cn.rd.yahoo.com/mail_cn/tag/1g/*http://cn.mail.yahoo.com/event/mail_1g/


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



Re: page redirect problem in jstl or jsp?

2004-08-18 Thread Bill Siggelkow
Works for me, Gao. I have the following JSP which redirects to an Action
 without a hitch.

%@ page contentType=text/html;charset=UTF-8 language=java %
%@ taglib uri=http://java.sun.com/jstl/core; prefix=c %

html
head
  titleTest/title
/head
body bgcolor=white
c:redirect url=/ViewStep1.do/
/body
/html


Gao Di wrote:

 it's ok ah,if i typed page directly,u can write some
 sample and try it .
 
  --- Bill Siggelkow [EMAIL PROTECTED] 
 
What happens if you go to directly to the page from
your browser? Do u
also get a 404? If so, then the problem is with the
action mapping and
not the redirect. Perhaps a typo in your
struts-config.xml.


Gao Di wrote:

i use struts framework in my project,and use the

jstl

in the jsp page.now i want to write a page which

will

auto forward to a struts action class,but whatever

i

use jstl or jsp ,it can't find the url either.
in jstl i use:c:redirect url=SearchAction.do/
and in jsp i use:
jsp:forward page=SearchAction.do/
if i change the url to xxx.jsp or a simple hello
world servlet,it's ok.but if i use struts
action,evertime i got page 404,url not found.
cause i think the struts action is also a servlet

in

essential,maybe there is a way to solve this

problem.


 _
 
Do You Yahoo!?
150MP3
http://music.yisou.com/

http://image.yisou.com
1G1000


 http://cn.rd.yahoo.com/mail_cn/tag/1g/*http://cn.mail.yahoo.com/event/mail_1g/
 


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

 
 
 
 _
 Do You Yahoo!?
 150MP3
 http://music.yisou.com/
 
 http://image.yisou.com
 1G1000
 http://cn.rd.yahoo.com/mail_cn/tag/1g/*http://cn.mail.yahoo.com/event/mail_1g/


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



RE: page redirect problem in jstl or jsp?

2004-08-18 Thread Bill Siggelkow
Your problem is the mapping -- if you want any path ending in .do to be a
Struts Action you need to define the servlet mapping as:
servlet-mapping 
servlet-nameaction/servlet-name 
url-pattern*.do/url-pattern
/servlet-mapping

Trust me, there's nothing wrong with Struts when it comes to your problem.

Bill Siggelkow
[EMAIL PROTECTED]
 
 

 -Original Message-
 From: Gao Di [mailto:[EMAIL PROTECTED] 
 Sent: Wednesday, August 18, 2004 9:25 PM
 To: Tag Libraries Users List
 Subject: Re: page redirect problem in jstl or jsp?
 
 maybe there is something wrong in my config files?
 
 struts-config.xml
 action-mappings
   action path=/SearchAction 
   type=com.adt.action.log.SearchAction
   name=SearchForm  
   input=/index.jsp 
   scope=request 
   forward name=success path=/vnp_list.jsp /
   /action
 /action-mappings
 
 web.xml
 servlet-mapping 
   servlet-nameaction/servlet-name 
   url-pattern/do/*/url-pattern
 /servlet-mapping
 
 but in another jsp,i use form's action,it's ok.
 html:form styleId=form1 action=SearchAction.do
 
  --- Bill Siggelkow [EMAIL PROTECTED] 
  Works for me, Gao. I have the following JSP which redirects to an 
  Action  without a hitch.
  
  %@ page contentType=text/html;charset=UTF-8
  language=java %
  %@ taglib uri=http://java.sun.com/jstl/core;
  prefix=c %
  
  html
  head
titleTest/title
  /head
  body bgcolor=white
  c:redirect url=/ViewStep1.do/
  /body
  /html
  
  
  Gao Di wrote:
  
   it's ok ah,if i typed page directly,u can write
  some
   sample and try it .
   
--- Bill Siggelkow [EMAIL PROTECTED]
  
   
  What happens if you go to directly to the page
  from
  your browser? Do u
  also get a 404? If so, then the problem is with
  the
  action mapping and
  not the redirect. Perhaps a typo in your struts-config.xml.
  
  
  Gao Di wrote:
  
  i use struts framework in my project,and use the
  
  jstl
  
  in the jsp page.now i want to write a page which
  
  will
  
  auto forward to a struts action class,but
  whatever
  
  i
  
  use jstl or jsp ,it can't find the url either.
  in jstl i use:c:redirect url=SearchAction.do/ and in 
 jsp i use:
  jsp:forward page=SearchAction.do/ if i change the url to 
  xxx.jsp or a simple
  hello
  world servlet,it's ok.but if i use struts action,evertime i got 
  page 404,url not found.
  cause i think the struts action is also a servlet
  
  in
  
  essential,maybe there is a way to solve this
  
  problem.
  
  
  
 
 _
   
  Do You Yahoo!?
  150MP3
  http://music.yisou.com/
  
  http://image.yisou.com
  1G1000
  
  
  
 
 http://cn.rd.yahoo.com/mail_cn/tag/1g/*http://cn.mail.yahoo.co
 m/event/mail_1g/
   
  
  
  
 
 -
   
  To unsubscribe, e-mail:
  [EMAIL PROTECTED]
  For additional commands, e-mail:
  [EMAIL PROTECTED]
  
   
   
   
  
 
 _
   Do You Yahoo!?
   150MP3
   http://music.yisou.com/
   
   http://image.yisou.com
   1G1000
  
 
 http://cn.rd.yahoo.com/mail_cn/tag/1g/*http://cn.mail.yahoo.co
 m/event/mail_1g/
  
  
 
 -
  To unsubscribe, e-mail:
  [EMAIL PROTECTED]
  For additional commands, e-mail:
  [EMAIL PROTECTED]
  
   
 
 _
 Do You Yahoo!?
 150MP3
 http://music.yisou.com/
 
 http://image.yisou.com
 1G1000
 http://cn.rd.yahoo.com/mail_cn/tag/1g/*http://cn.mail.yahoo.co
 m/event/mail_1g/
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 


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



Re: Adding user input

2004-08-17 Thread Bill Siggelkow
Nic -- I have a strong bias towards using Struts -- while there is a 
learning curve you are going to end up with App that grow as needed.

If Struts seems overkill, then go with more traditional Model 2
JSP - Servlet - JSP
If this seems unrealistic, try encapsulating intermediary stuff (DB 
access) in a JavaBean.

Personally, I don't write apps that perform stuff like direct DB access 
using tags on a JSP page.

Nic Werner wrote:
Hi,
   I have two pages, one with a form to input/update data and then the 
second which 'handles' the data w/logic.

Now, I want to add an intermediary page that looks at the inputted data, 
does some DB stuff etc, and then asks the user if they want to continue 
or go back.

- I could just pass the params from 1st to 2nd to third page, but it 
seems clunky. Any suggestions? Has anybody done any tag work to make 
this cleaner?

- Nic
--
Nic Werner
Sonoma State University

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


Re: Using Config.set(session, Config.FMT_LOCALE, locale);

2004-08-13 Thread Bill Siggelkow
Yes, that's essentially what I was doing ... interestingly enough, I 
solved the problem by updating to taglibs-standard 1.1.1. Before I was 
using the jstl.jar and standard.jar included in Struts 1.2.1.

Kris Schneider wrote:
Strange, because the following seems to work:
web.xml:

web-app

context-param
param-namejavax.servlet.jsp.jstl.fmt.localizationContext/param-name
param-valueMessages/param-value
/context-param

/web-app
WEB-INF/classes/Messages.properties:

msg=Messages
WEB-INF/classes/Messages_ru.properties:
---
msg=Messages_ru
fmtlocale.jsp:
--
%@ page contentType=text/plain %
%@ page import=java.util.Locale %
%@ page import=javax.servlet.jsp.jstl.core.Config %
%@ taglib prefix=fmt uri=http://java.sun.com/jstl/fmt; %
% Config.set(session, Config.FMT_LOCALE, new Locale(ru)); %
msg: fmt:message key=msg/
output:
---
msg: Messages_ru
Is that basically the equivalent of what you're doing?
Quoting Bill Siggelkow [EMAIL PROTECTED]:

I have created a Struts action similar to one suggested by Kris 
Schneider to change the current locale for both Struts and JSTL.

In the action after creating a locale based on user input I make the 
following two calls:

// reset the Struts locale
session.setAttribute(Globals.LOCALE_KEY, locale);
// reset the JSTL locale
Config.set(session, Config.FMT_LOCALE, locale);
I then redirect to the page where I display some text based on the locale.
The Struts bean:message works perfectly - however, the JSTL fmt:message 
does not work -- by the way, I do have the LocalizationContext pointing 
to my ApplicationResources through the web.xml context-param.

Interestingly enough, if I do use fmt:setLocale locale=ru/ on the 
before the fmt:message key=foo/ it works!

Does anyone have any ideas on why the Config.set(...) is not working?
Bill Siggelkow


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


Using Config.set(session, Config.FMT_LOCALE, locale);

2004-08-12 Thread Bill Siggelkow
I have created a Struts action similar to one suggested by Kris 
Schneider to change the current locale for both Struts and JSTL.

In the action after creating a locale based on user input I make the 
following two calls:

// reset the Struts locale
session.setAttribute(Globals.LOCALE_KEY, locale);
// reset the JSTL locale
Config.set(session, Config.FMT_LOCALE, locale);
I then redirect to the page where I display some text based on the locale.
The Struts bean:message works perfectly - however, the JSTL fmt:message 
does not work -- by the way, I do have the LocalizationContext pointing 
to my ApplicationResources through the web.xml context-param.

Interestingly enough, if I do use fmt:setLocale locale=ru/ on the 
before the fmt:message key=foo/ it works!

Does anyone have any ideas on why the Config.set(...) is not working?
Bill Siggelkow
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: can i use jstl replace struts bean tags?

2004-08-03 Thread Bill Siggelkow
The JSTL can easily replace many of the Struts tags.  The c:out tag is
equivalent to bean:write. To iterate you can use the c:forEach tag
instead of the Struts logic:iterate

Keep in mind that you still use Struts to provide the controller and you
will continue to use the Struts html tags for form creation.

?ffb8?ffdf ?ffb5?ffc f?= wrote:
 i am developping a project based on struts,and i also
 want to use jstl1.1 in the jsp page.in my action
 class,i have return a Iteratorobject like this:
 Iterator iter = service.getLogs(querySentence, page);
 request.setAttribute(logs, iter);
 but i don't know how to get it in jstl,while in struts
 u can use bean:write tag,so i wonder if it is
 possible in jstl1.1?
 
 _
 Do You Yahoo!?
 
 http://image.yisou.com
  
 100
 http://cn.rd.yahoo.com/mail_cn/tag/100m/*http://cn.promo.yahoo.com/minisite/100m/


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



Re: can i use jstl replace struts bean tags?

2004-08-03 Thread Bill Siggelkow
First, I strongly suggest you read some documentation -- Sun has a nice
online tutorial that you can find at ...

http://java.sun.com/webservices/docs/1.0/tutorial/doc/JSTL.html

For your specific request, it would be done something like ...

c:forEach items=${logs}.../c:forEach

If this doesn't make sense to you -- read the docs ;)

?ffb8?ffdf ?ffb5?ffc f?= wrote:

  --- Bill Siggelkow [EMAIL PROTECTED] 
 
The JSTL can easily replace many of the Struts tags.
 The c:out tag is
equivalent to bean:write. To iterate you can use
the c:forEach tag
instead of the Struts logic:iterate

Keep in mind that you still use Struts to provide
the controller and you
will continue to use the Struts html tags for form
creation.

?ffb8?ffdf
?ffb5?ffc f?= wrote:

i am developping a project based on struts,and i

also

want to use jstl1.1 in the jsp page.in my action
class,i have return a Iteratorobject like this:
Iterator iter = service.getLogs(querySentence,

page);

request.setAttribute(logs, iter);
but i don't know how to get it in jstl,while in

struts

u can use bean:write tag,so i wonder if it is
possible in jstl1.1?



 _
 
Do You Yahoo!?

http://image.yisou.com
 
100


 http://cn.rd.yahoo.com/mail_cn/tag/100m/*http://cn.promo.yahoo.com/minisite/100m/
 


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

 
 
 
 thank your reply,can u tell me how to use forEach
 tag to get the request.setAttribute(logs, iter)
 values which i set in the action.
 cause in jsp script,i can use
 %request.getAttribute()%,but in jstl,i don't know
 how to do :(
 
 _
 Do You Yahoo!?
 
 http://image.yisou.com
  
 100
 http://cn.rd.yahoo.com/mail_cn/tag/100m/*http://cn.promo.yahoo.com/minisite/100m/


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



RE: [JSTL] Indexed array variable

2004-06-01 Thread Bill Siggelkow
I don't think that JSTL is going to be able to create array elements. I
think you will need to allocate the array ahead of time. Maybe someone else
can clarify this a little more.


Bill Siggelkow
[EMAIL PROTECTED]
 

-Original Message-
From: Derek Mahar [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, June 01, 2004 5:10 PM
To: Tag Libraries Users List
Subject: [JSTL] Indexed array variable

How does one create and assign elements to an indexed array variable in JSTL
or the Expression Language? c:set seems lacking in this respect.

Derek



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



Re: sql:query ... use Bind Variables?

2004-04-20 Thread Bill Siggelkow
AFAIK, the SQL statement *must* be a prepared statement to use sql:param.

Roy Benjamin wrote:
If you use the sql:param .. form, does the tag in some
way optimize to use a bind variable and a prepared statement?
It seems this could be done.  I'll also check the source.

Thanks

Roy


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


Re: http://java.sun.com/jsp/jstl/functions

2004-04-13 Thread Bill Siggelkow
[EMAIL PROTECTED] wrote:
I am having trouble finding info on this tag library.  The link works but
does not bring me to a page where functions information is available.  I've
searched the mailing list archive with no luck.  I've searches the
documentation that came with the standard tag library with no luck.  I've
also gone to the Jakarta.apache.org site and could not find a tag library
named functions.
 
Any links available?

http://java.sun.com/products/jsp/jstl/1.1/docs/tlddocs/index.html

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


RE: How to use request.isUserInRole(role) from JSTL?

2004-04-05 Thread Bill Siggelkow
With Struts --
logic:present role=role1
  Do stuff 
/logic:present

You can even check if a user has one of a list of roles using a
comma-separated list

logic:present role=role1,role2
  Do stuff
/logic:present 


Bill Siggelkow
[EMAIL PROTECTED]
 

-Original Message-
From: Zsolt Koppany [mailto:[EMAIL PROTECTED] 
Sent: Monday, April 05, 2004 2:54 PM
To: Tag Libraries Users List
Subject: How to use request.isUserInRole(role) from JSTL?

Hi,

how can I do the following from JSTL (struts-1.1)?
%
if (request.isUserInRole(...))
...
%
Zsolt
 


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


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



RE: Beans static method in non static way

2004-04-05 Thread Bill Siggelkow
Well, I don't mean to sound like a OO-snob, but I have to say that if you
have a lot of static methods than it means that your code is written more
like a procedural language than an object-oriented one.

That being said, if you have to de4al with thte static methods than the best
way I would think is to use the wrappers like you are doing.  I mean, the
method you access with JSTL are object properties -- properties mean state
-- so, static methods mean no state -- since I think it is completely
reasonable to not be able to access static methods -- aside from the
technical/implementation reasons.

Another approach is to turn your classes with the static methods into
singletons and change the static methods to instance methods on the
singleton.

That is all I can say for now as I need to get back to watching my the
Jackets!  


Bill Siggelkow
[EMAIL PROTECTED]
 

-Original Message-
From: Andrew Stevens [mailto:[EMAIL PROTECTED] 
Sent: Monday, April 05, 2004 9:08 PM
To: '[EMAIL PROTECTED]'
Subject: Beans static method in non static way


Hello,

I have read most of the discussion on JSTL1.0/1.1. 
Especially concerning static member/methods defining functions and all that
jazz.

Here's my question. WHY if I create an instance of a bean and put it in a
scope (ie: request) can I not access static methods from the instance?
I mainly use the JSTL core taglib.

I can understand not being able to access a static method from a Class like:
SomeClass.getSomeStaticValue(). Because an instance is never created.
But I don't see why there's a limitation that stops me from accessing that
static method from an instance of the class (bean). 
I think it's called accessing a static method in a non static way (?).
The really tedious part is I can create a bean which wraps any static
methods I need to access with non-static methods. Which works fine. 
But this introduces more code and less clarity/readability. I might argue
that defining functions in JSTL1.1 will be even more overhead.

Please share your thoughts. Can anyone provide an approach to make this
easily doable? Otherwise I have to convince some developers to re-code about
200 classes to provide another method which is not static, and just returns
the results of the static equivalent.

Thanks.


GOLDMAN SACHS JBWERE PTY LTD DISCLAIMER

Goldman Sachs JBWere Pty Ltd and its related entities distributing this
document and each of their respective directors, officers and agents (the
Goldman Sachs JBWere Group) believe that the information contained in this
document is correct and that any estimates, opinions, conclusions or
recommendations contained in this document are reasonably held or made as at
the time of compilation.  However, no warranty is made as to the accuracy or
reliability of any estimates, opinions, conclusions, recommendations (which
may change without notice) or other information contained in this document
and, to the maximum extent permitted by law, the Goldman Sachs JBWere Group
disclaims all liability and responsibility for any direct or indirect loss
or damage which may be suffered by any recipient through relying on anything
contained or omitted from this document.

Goldman Sachs JBWere does not represent or warrant the attached files are
free from computer viruses or other defects.  The attached files are
provided, and may only be used, on the basis that the user assumes all
responsibility for any loss, damage or consequence resulting directly or
indirectly from use.


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


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



RE: Beans static method in non static way

2004-04-05 Thread Bill Siggelkow
Thanks for the clarification, Andrew.  JSTL is predicated on the JavaBeans
component model and is such getter methods are expected to be instance
variables.  And I certainly understand your limitations as far as the code.
I think in a lot of cases, a getMaxLength() method would be an instance
method that uses a static field.

However, since you indicated that you cannot change these things -- if you
are using a JSP 2.0 container like Tomcat 5 than you could use JSPs support
for static methods described here:
http://www.javaworld.com/javaworld/jw-05-2003/jw-0523-calltag-p2.html

If you do not or cannot do this then another option is to load your static
data into the servlet context using a servlet.  


Bill Siggelkow
[EMAIL PROTECTED]
 

-Original Message-
From: Andrew Stevens [mailto:[EMAIL PROTECTED] 
Sent: Monday, April 05, 2004 10:30 PM
To: 'Tag Libraries Users List'
Subject: RE: Beans static method in non static way


Thanks v.much for your reply. To the contrary, I don't have a lot of static
methods, but many objects each with one or two static methods.

For example: we have a class called 'Subject' (yep nothing special -
building HTML forms here). Classes like Subject are provided to me in a
package.
Subject has static getMaxLength(). If this was accessible in JSTL it will
make my life as the web guy a lot simpler.
Instead I have to create a class like SubjectHolder which has a Subject
property and a method which calls this.subject.getMaxLength().
(This is starting to sound like Struts Form Beans etc... but I have found
them limiting and for now choose to avoid them) Then JSTL also starts to
look like ${thing.subjectHolder.subject.maxLength}.

If Subject class has a max length, any instance also has a max length. I
don't see how this suggests state? Can you elaborate?
I can't really dictate the way these classes are designed. Wrappers it may
have to be (in the order of 10's to 100's!).

Cheers,
AS

-Original Message-
From:   Bill Siggelkow [SMTP:[EMAIL PROTECTED]
Sent:   Tuesday, 6 April 2004 11:31
To: 'Tag Libraries Users List'
Subject:RE: Beans static method in non static way

Well, I don't mean to sound like a OO-snob, but I have to say that
if you
have a lot of static methods than it means that your code is written
more
like a procedural language than an object-oriented one.

That being said, if you have to de4al with thte static methods than
the best
way I would think is to use the wrappers like you are doing.  I
mean, the
method you access with JSTL are object properties -- properties mean
state
-- so, static methods mean no state -- since I think it is
completely
reasonable to not be able to access static methods -- aside from the
technical/implementation reasons.

Another approach is to turn your classes with the static methods
into
singletons and change the static methods to instance methods on the
singleton.

That is all I can say for now as I need to get back to watching my
the
Jackets!  


Bill Siggelkow
[EMAIL PROTECTED]
 

-Original Message-
From: Andrew Stevens [mailto:[EMAIL PROTECTED] 
Sent: Monday, April 05, 2004 9:08 PM
To: '[EMAIL PROTECTED]'
Subject: Beans static method in non static way


Hello,

I have read most of the discussion on JSTL1.0/1.1. 
Especially concerning static member/methods defining functions and
all that
jazz.

Here's my question. WHY if I create an instance of a bean and put it
in a
scope (ie: request) can I not access static methods from the
instance?
I mainly use the JSTL core taglib.

I can understand not being able to access a static method from a
Class like:
SomeClass.getSomeStaticValue(). Because an instance is never
created.
But I don't see why there's a limitation that stops me from
accessing that
static method from an instance of the class (bean). 
I think it's called accessing a static method in a non static way
(?).
The really tedious part is I can create a bean which wraps any
static
methods I need to access with non-static methods. Which works fine. 
But this introduces more code and less clarity/readability. I might
argue
that defining functions in JSTL1.1 will be even more overhead.

Please share your thoughts. Can anyone provide an approach to make
this
easily doable? Otherwise I have to convince some developers to
re-code about
200 classes to provide another method which is not static, and just
returns
the results of the static equivalent.

Thanks.


GOLDMAN SACHS JBWERE PTY LTD DISCLAIMER

Goldman Sachs JBWere Pty Ltd and its related entities distributing
this
document and each of their respective

Re: javax

2004-04-02 Thread Bill Siggelkow
Martin Nad wrote:

Hi!

Dose Anybody knows where i can get the javax full
packet.
i mean javax.sql, javax.mail and the others.
javax just means that the package is a Java extension -- not part of the 
core.  There is not one packet that contains all of the 'javax' 
extensions.  Many of the javax APIs are specified by the J2EE-related specs.

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


Re: x:set and c:out

2004-04-02 Thread Bill Siggelkow
I believe that you are getting the []'s because the actual object 
created by the x:set is a Node -- try using x:out instead of c:out

Bill Siggelkow

Lorenzo Sicilia wrote:

hi to the list,

I have this snippets (many tks to Martin Cooper):
x:parse xml=${pageContext.request.reader} var=xmlDoc/
x:set select=$xmlDoc/packet var=myValue /
c:out value=${myValue}  escapeXml=false /
and a small xmlDoc from a flash form like this:
packet type=1
row/
row/
/packet
The output in html page is quite good:
[packet type=1row /row //packet]
Why there are the brachets?

I can remove there but I don't understand why there are this brachets.

any idea?

regards Lorenzo


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


RE: Novice question about using Constants in when tags

2004-04-02 Thread Bill Siggelkow
Jeff, a startup servlet is just a way of setting up and configuring a
servlet so that it starts up when the application server is started.  This
is configured using the load-on-startup element in the servlet def in the
web.xml as follows:

  servlet
servlet-namemyStartupServlet/servlet-name
servlet-classcom.foo.StartupServlet/servlet-class
load-on-startup1/load-on-startup
  servlet

Then for the servlet you simply implement the init() method and with
something like the following:

init() {
  ServletContext ctx = this.getServletContext();
  Map map = new HashMap();
  map.put(foo, bar);
  ctx.setAttribute(Constants, map);
}

If you already have a servlet that you load on startup you can put this code
in its init method.

Bill Siggelkow
[EMAIL PROTECTED]
 

-Original Message-
From: Jeff Brewer [mailto:[EMAIL PROTECTED] 
Sent: Friday, April 02, 2004 7:52 PM
To: Tag Libraries Users List
Subject: Re: Novice question about using Constants in when tags

Thanks very much Bill, I was able to make your first suggestion work by
placing the code in the servlet that also creates my er object and
forwards to my JSP page. It works but I'm fairly certain it's not the
startup servlet you were referring to. I searched through apache.org in
the Tomcat section for awhile but didn't find anything that looked like what
you were talking about. I wonder if you would be kind enough to point me in
the right direction/resource where I can find out more about the startup
servlets?

Thanks again for your help!

- Original Message -
From: Bill Siggelkow [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, March 31, 2004 9:32 PM
Subject: Re: Novice question about using Constants in when tags


 Good question, Jeff. Unfortunately, there is not a direct way of doing
 this.  There are generally two approaches:

 1) Store the values of the constants as application context variables
 with the context being initialized through a startup servlet (or via a
 Plugin if you were using Struts)

 In the startup servlet you would have:

 this.getServletContext().setAttribute(INTRO, new Integer(1));

 then your JSTL would look like:

 c:when test=${er.updateStatus == INTRO}

 2) store a Map of these values in the application context -- something
like:

 Map constants = new HashMap();
 constants.put(INTRO, new Integer(1)); //...
 this.getServletContext().setAttribute(Constants, constants);

 then your JSTL would look like:

 c:when test=${er.updateStatus == Constants.INTRO}

 Jeff Brewer wrote:
  I'm new to Java and JSP and Tag Libraries and ran into what is probably
more of a style question than a technical question.
 
  I'm using something like this in my JSP page:
 
  c:choose
  c:when test=${er.updateStatus == 1}
  pmessage one/p
  /c:when
  c:when test=${er.updateStatus == 2}
  pmessage two/p
  /c:when
  c:when test=${er.updateStatus == 3}
  pmessage three/p
  /c:when
  /c:choose
 
  ... but I wasn't content because a week from now when I come back and
look at this code I'm not going to remember what 1, 2, or 3 means. Then I
got the bright idea of trying to define some constants in my er class
something like this
 
   public static final int INTRO = 1;
   public static final int MISSING_EMAIL_ADDRESS = 2;
   public static final int INVALID_EMAIL_ADDRESS = 3;
 
  ... so that I could do something like this...
 
  c:choose
  c:when test=${er.updateStatus == er.INTRO}
  pmessage one/p
  /c:when
  c:when test=${er.updateStatus == er.MISSING_EMAIL_ADDRESS}
  pmessage two/p
  /c:when
  c:when test=${er.updateStatus == er.INVALID_EMAIL_ADDRESS}
  pmessage three/p
  /c:when
  /c:choose
 
  ...which I thought would greatly improve the readability and
maintainability of my JSP page (it's easy to see that message 2 should be
displayed if a Missing Email Address situation exists). Those of you very
familiar with jstl will no doubt recognize that this won't work (something I
discovered through trial and error).
 
  Is there some way I can rewrite my expressions that works with these
constants?
  Have you run into a similar situation and can you suggest a way to make
my crude code a bit more friendly?
 
  Thanks in advance,
  Jeff


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






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


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



Re: Newbie Question Regarding Iterate tag

2004-03-31 Thread Bill Siggelkow
Mark,

The object referred to by row will be a Vo.  Assuming your Vo has a 
getFoo() method you can do something like:

logic:iterate id=row name=plans
  bean:write name=row property=foo/
/logic:iterate
Alternatively, you could use the JSTL forEach tag:

c:forEach var=row items=plans
  c:out value=${row.foo}/
/c:forEach
Mark Glass wrote:

I am building a Struts application which places an ArryList of  Vo objects into the request. (request.setAttribute(plans, listOfVo);). In the JSP file I want to iterate through the list, get each Vo to populate a row of a table. How do I do this with the Struts iterate tag?

My code looks like:

logic:iterate id=row name=plans

bean:write name=row property=??/

/logic:iterate



Thanks



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


Re: Novice question about using Constants in when tags

2004-03-31 Thread Bill Siggelkow
Good question, Jeff. Unfortunately, there is not a direct way of doing 
this.  There are generally two approaches:

1) Store the values of the constants as application context variables 
with the context being initialized through a startup servlet (or via a 
Plugin if you were using Struts)

In the startup servlet you would have:

this.getServletContext().setAttribute(INTRO, new Integer(1));

then your JSTL would look like:

c:when test=${er.updateStatus == INTRO}

2) store a Map of these values in the application context -- something like:

Map constants = new HashMap();
constants.put(INTRO, new Integer(1)); //...
this.getServletContext().setAttribute(Constants, constants);
then your JSTL would look like:

c:when test=${er.updateStatus == Constants.INTRO}

Jeff Brewer wrote:
I'm new to Java and JSP and Tag Libraries and ran into what is probably more of a style question than a technical question.

I'm using something like this in my JSP page:

c:choose
c:when test=${er.updateStatus == 1}
pmessage one/p
/c:when
c:when test=${er.updateStatus == 2}
pmessage two/p
/c:when
c:when test=${er.updateStatus == 3}
pmessage three/p
/c:when
/c:choose
... but I wasn't content because a week from now when I come back and look at this code I'm not going to remember what 1, 2, or 3 means. Then I got the bright idea of trying to define some constants in my er class something like this

 public static final int INTRO = 1;
 public static final int MISSING_EMAIL_ADDRESS = 2;
 public static final int INVALID_EMAIL_ADDRESS = 3;
... so that I could do something like this...

c:choose
c:when test=${er.updateStatus == er.INTRO}
pmessage one/p
/c:when
c:when test=${er.updateStatus == er.MISSING_EMAIL_ADDRESS}
pmessage two/p
/c:when
c:when test=${er.updateStatus == er.INVALID_EMAIL_ADDRESS}
pmessage three/p
/c:when
/c:choose
...which I thought would greatly improve the readability and maintainability of my JSP page (it's easy to see that message 2 should be displayed if a Missing Email Address situation exists). Those of you very familiar with jstl will no doubt recognize that this won't work (something I discovered through trial and error).

Is there some way I can rewrite my expressions that works with these constants?
Have you run into a similar situation and can you suggest a way to make my crude code 
a bit more friendly?
Thanks in advance,
Jeff


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


Re: xml (JDOM) question

2004-03-29 Thread Bill Siggelkow
Chris, you should be able to add the JDOM object into the servlet 
context from the servlet -- something like:

this.getServletContext.setAttribute(jdomObject, jdomObject);

Then use a RequestDispatcher to forward to your JSP.

Johnson, Chris wrote:

Is it possible to (or how would you) attach a JDOM object (if possible)
as an application attribute in a servlet and then forward to a jsp page
to process it?
 
Currently I'm doing the opposite, I'm starting with a jsp page and then
doing an import which is calling a servlet that's outputting text/xml.
I'm then x:parse'ng that and using xslt from there.  But I want to start
controlling things from the servlet side instead, and pushing the output
(JDOM currently) to the jsp page(s).
 
I don't seem to be finding an answer to this in all of the stuff I've
read.
 
BTW, I've gone the route of using java code in the jsp page using
scripting elements (%...%), but I was doing the looping and formatting
that way as well and it was REALLY ugly.  But, if I had to use a hybrid
approach, I will (i.e. using scripting to convert the Element to a
string for parsing with x:parse or something like that).
 
Anyway, hopefully I made some sense.  Any help would be much
appreciated.
 
Thanks,
Chris



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


Re: EL access to a bean property... ?

2004-03-26 Thread Bill Siggelkow
Roy, if you are using JSP 2.0 (e.g. with Tomcat 5) and JSTL 1.1 you can 
do the following:

[EMAIL PROTECTED] isELIgnored=false%
%@ taglib uri=http://java.sun.com/jsp/jstl/functions; prefix=fn %
Map size is ${fn:length(TableRows)}

Roy Benjamin wrote:

Very interesting, so wrapping would work, but you can't
just expose a Bean property.
I've switched to c-rt for now, 

Thanks!

On Fri, 2004-03-26 at 10:35, Kris Schneider wrote:

Maps are treated differently than regular JavaBeans so that you can't access
bean properties. For example, every object has a bean property called class,
but you won't get any output if you try ${map.class}. It's even more fun to try
and get at a map's empty property ;-). If all you're concerned with is
testing whether a map is empty or not, you can use ${not empty map}. If you
really need the size of the map, you could try the Unstandard taglib:
http://jakarta.apache.org/taglibs/sandbox/doc/unstandard-doc/intro.html

Or do something like create a wrapper bean for collections that exposes a size
property and delegates to the wrapped collection.
Quoting Roy Benjamin [EMAIL PROTECTED]:


I am displaying the values in a TreeMap using forEach tag.
However, I only want to do this if the map is not empty.
I also need to display the count of entries in the map at
the top of the page.
In TreeMap, size/size() is not a Bean Property (no?) so I tried
in-line subclassing to expose the property:
%
 TreeMap treeMap = new TreeMap() {
 public int getSize(){return size();}
   };
 pageContext.setAttribute(TableRows,treeMap);
%
now much later I try:

TD
Search Results:nbsp;c:out value=${TableRows.size}/nbsp;found.
/TD
I could just count things as they are added to the map
over a series of SQL queries, but it seemed to me this
was the better solution.. only the EL expression is null.
I'm sure I'm doing something wrong

Thanks

Roy


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


Re: XML XPath expression help

2004-03-26 Thread Bill Siggelkow
Dylan, you could try using x:set to expose the sourceID as a variable 
that then referenced in the inner x:forEach like the following:

x:forEach select=$news//eachNewsArticle
  x:set select=sourceID var=source/
  tr
td
  x:out select=articleDate /
/td
x:forEach select=$newsSources//[EMAIL PROTECTED]
...
It should work but I have not actually tried it so YMMV ...

Dylan MacDonald wrote:

Hi -

Last week I had a question about writing an XPath expression that would
retrieve only the first few records from an XML source.  I got an immediate
response which worked perfectly.  Hopefully I'll have the same luck with
this question.
I have a JSP page that displays a list of random internet articles that I
use in my corporate intranet.  The list includes the article title and a
link to the article, as well as the source and the link to the source's
website.
While the articles are all unique, the sources are not.  Rather than
duplicate the name and URL of each source for each article, I would create a
second XML file for the sources, assign a unique ID to each source and then
reference that ID in my articles XML file.  Then, on the JSP page itself, I
would import both XML files and then just use some kind of XPath expression
in the forEach statement to compare the IDs.  Well, this doesn't work, at
least the way I did it.  It just gives me an error.
I'm sure my code has many problems, but I think the two main ones are: can
you even import two separate XML files with JSTL; and secondly, my XPath
expression is probably wrong.  Anyway if anyone has any clues, I'd surely
appreciate it.
Below is my sample code:

news.xml

allNewsArticles
eachNewsArticle
articleDateOctober 31, 2003/articleDate
articleTitleMore quality along the supply chain/articleTitle
articleUrlhttp://english.lz-net.de/news/webtechnews/pages/showmsg.prl?id=3
097/articleUrl
sourceIDlz/sourceID
/eachNewsArticle
/allNewsArticles


newsSources.xml

allNewsSources
eachNewsSource
sourceIDam/sourceID
sourceTitleApparel Magazine/sourceTitle
sourceUrlhttp://www.apparelmag.com//sourceUrl
/eachNewsSource
/allNewsSources


articles.jsp

c:import var=news_xml url=news.xml /
c:import var=newsSources_xml url=newsSources.xml /
x:parse var=news xml=${news_xml} /
x:parse var=newsSources xml=${newsSources_xml} /
--snip--

x:forEach select=$news//eachNewsArticle
tr
td
x:out select=articleDate /
/td
x:forEach select=$newsSources//eachNewsSource[sourceID =
'$news//eachNewsArticle/sourceID']
td
a href=x:out select='sourceUrl' /x:out select=sourceTitle 
//a
/td
/x:forEach
td
a href=x:out select='articleUrl' /x:out 
select=articleTitle
//a
/td
/tr
/x:forEach


Dylan MacDonald
Senior Web Designer
GNX
phone: 415-283-3715



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


[OT]test

2004-03-18 Thread Bill Siggelkow
test

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


Re: ANN: JSTL Quick Reference

2004-03-18 Thread Bill Siggelkow
Henri,
  I learned JSTL from Shawn's book as well as the spec -- the guide I 
wrote is more of a deskside quick guide.  Kind of like the foldout chart 
that comes with the O'Reilly HTML  -- only more verbose than that. 
Basically, I was looking for something I could easily hold in my lap and 
quickly flip through.  In addition to what Shawn have my doc provides a 
short example demonstrating the tag (when needed) -- In addition I cover 
EL and EL functions (JSTL 1.1) ... I also provide listing of some useful 
XPath functions.

Henri Yandell wrote:
I've always used the appendix to Shawn Bayern's JSTL in Action. What does
this have above and beyond that? Is it JSTL 1.1 specific?
Hen

On Thu, 18 Mar 2004 [EMAIL PROTECTED] wrote:


I noticed that there seems to be demand for a JSTL Quick Reference.  When I was learning JSTL a couple of months ago I put together such a document and I thought others might find it of use.  It can be downloaded from http://www.jadecove.com/jstl-quick-reference.pdf.  The only downside about the document is that you have to make a book out of it yourself.  I call this self-binding :)  All feedback is most appreciated and if anyone would like to assist in publishing this document I will be glad to talk about it.

Bill Siggelkow
Jade Cove Solutions
www.jadecove.com
[EMAIL PROTECTED]
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


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