RE: non-ascii characters

2004-03-16 Thread Daniel Lipofsky
> I have a database with ISO 3166 country
> names and codes that I use to populate an html:select. There 
> is one country in the list that contains a non-ascii 
> character and I want to make sure it shows up properly. That 
> country is listed in HTML as ÅLAND ISLANDS
> 
> I have two questions regarding this non-ascii:
> 1) How should I encode it in my (mysql)
> database? Right now I put it in with the character reference 
> as written above.
> 
> 2) Assuming I leave it the way it is in
> the database as stated in 1) above, how
> do I get the html tag machinery to not
> attempt to escape the ampersand? This
> is the code I am using:
> 
> 
> 
>property="value" labelProperty="label"/> 

RTFM.
You want filter="false".

Also if you are using struts 1.1 you can use
html:optionsCollection instead of
html:options.  You will find it much nicer.
Specifically you will not have to declare you
value and label.  In either case you will want
filter="false".

- Dan


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



RE: a security framework!

2004-03-11 Thread Daniel Lipofsky
I did something similar.  I extended each struts HTML tag
to take a rule and evaluate it in doStartTag.
It then returns SKIP_BODY to hide it or
super.doStartTag() to show it.  Similarly doEndTag()
returns EVAL_PAGE to hide it or super.doEndTag()
to show it.  I actually have 3 security levels and
I call setDisabled() to disable the field if it
is visible but not editable.  It's not hard.
- Dan

> -Original Message-
> From: Mailing List [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, March 10, 2004 8:17 PM
> To: [EMAIL PROTECTED]
> Subject: a security framework!
> 
> Hi,
> I'm developing a web application with struts framework.I want 
> to design some jsp pages that support security at pages 
> level.The security that I want to be supported is that some 
> components of each page can be shown for certain user.I mean 
> that for each user deponds on his access to the system we can 
> show some components of each page and does'nt show other 
> components.Each user deponds on his type and access at the 
> system just can see his own pages.can you offer a good 
> framework for this goal that be compatible with struts framework.
>   
> Regards
> 

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



expanding <%=...%>

2004-02-24 Thread Daniel Lipofsky
In the JSP below, <%=p1%> will expand the way I expect.
But <%=p2> does not.  Does anyone know why and how to
fix it?  Using HTML-EL is not a good option because my
real case uses custom tags that extend the HTML taglib.

<%@ taglib uri="struts-html"  prefix="html" %>

<% String foobar = "FooBar", p1 = "popupSrcForm", p2 = "Form"; %>




Thanks,
Dan


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



RE: Mroe then one resource message file

2004-02-19 Thread Daniel Lipofsky
See
http://www.systemmobile.com/articles/strutsMessageResources.html 

> Does anybody know of a way to define more than one default 
> message resources in struts 1.1.


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



iterate over list of maps

2004-02-06 Thread Daniel Lipofsky
I want to iterate over a list where each object in the
list is a map, and print values from the map.  The problem,
of course, is Map is not a bean - no getters and setters.
Do I have to wrap each map in a bean, or is there a
more clever approach.

(I am pretty much stuck with list:iterate, not c:forEach,
because I am actually using a specialize tag that extends
list:iterate).

Thanks,
Dan

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



RE: bean:write question

2004-01-26 Thread Daniel Lipofsky
Or replacing all newlines with "".
Either should work, but  might look nicer.

This is not a struts issue ... just a basic
fact of how HTML works.
- Dan

> -Original Message-
> From: Hien Q Nguyen [mailto:[EMAIL PROTECTED]
> Sent: Saturday, January 24, 2004 4:30 PM
> To: Struts Users Mailing List
> Subject: Re: bean:write question
> 
> 
> how about wrapping your content inside the  tag?
> 
> 
> On Jan 24, 2004, at 11:37 AM, Allen Jordan wrote:
> 
> > Hello all,
> > I am trying to display a file name and the contents of the file in a
> > jsp. My formbean  object contains 2 Strings (filename and contents).
> > The problem I am having is the file contents are displayed in one
> > continues string, without line breaks. Is there anyway to do this
> > without using "iterate"?
> > Thanks all.
> 
> 
> -
> 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: bean:write and apostrophes

2004-01-22 Thread Daniel Lipofsky
No, that doesn't fix it.  It needs to be encoded.
It just needs to be encoded as "Dan\'s Test"
or even as "Dan\'s" but not as "Dan's".
The problem is that the brower converts '
back to a single quote early on in the game,
and then the single quote prematurely ends the string I
am trying to pass to the Javascript method, which
causes a Javascript exception.
Thanks,
Dan

> -Original Message-
> From: Yee, Richard K,,DMDCWEST [mailto:[EMAIL PROTECTED]
> Sent: Thursday, January 22, 2004 4:39 PM
> To: 'Struts Users Mailing List'
> Subject: RE: bean:write and apostrophes
> 
> 
> Dan,
> Try using the filter="false" attribute of the bean:write tag. 
> That will
> disable the encoding of characters that are sensitive to HTML.
> 
> 
> -Richard
> 
> -Original Message-
> From: Daniel Lipofsky [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, January 22, 2004 4:18 PM
> To: [EMAIL PROTECTED]
> Subject: bean:write and apostrophes
> 
> 
> If I use 
> to write out the value "Dan's Test"  I get "Dan's".
> But this is giving me problems with Javascript.
> 
> THIS FAILS:
> Dan's Test
> 
> BUT THIS WORKS:
> Dan's Test
> 
> But I don't know how to get the second form.
> I can reverse the single quotes and double quotes
> in javascript - then it works for the test case above
> but fails for strings with double quotes.
> 
> Has anyone solved this problem?
> I am using IE 6.0 as my browser as struts 1.1.
> Here is the full test cases:
> 
> <% session.setAttribute("x","Dan's Test"); %>
> <% session.setAttribute("y","The \"other\" test"); %>
> ')">x1  href="javascript:alert('')">y1  href='javascript:alert("")'>x2  href='javascript:alert("")'>y2
> 
> Thanks,
> Dan
> 
> 
> 
> -
> 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]



bean:write and apostrophes

2004-01-22 Thread Daniel Lipofsky
If I use 
to write out the value "Dan's Test"  I get "Dan's".
But this is giving me problems with Javascript.

THIS FAILS:
Dan's Test

BUT THIS WORKS:
Dan's Test

But I don't know how to get the second form.
I can reverse the single quotes and double quotes
in javascript - then it works for the test case above
but fails for strings with double quotes.

Has anyone solved this problem?
I am using IE 6.0 as my browser as struts 1.1.
Here is the full test cases:

<% session.setAttribute("x","Dan's Test"); %>
<% session.setAttribute("y","The \"other\" test"); %>
')">x1
')">y1
x2
y2

Thanks,
Dan



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



RE: How to retreive ApplicationResources properties ?

2004-01-22 Thread Daniel Lipofsky

See  http://www.systemmobile.com/articles/strutsMessageResources.html

In an Actions you can get the resource bundle like
getResources(HttpServletRequest request)

Inside taglib code you can do
RequestUtils.message(pageContext, bundle, locale, key);

- Dan

> -Original Message-
> From: AMIR-TAHMASSEB Marc [mailto:[EMAIL PROTECTED]
> Sent: Thursday, January 22, 2004 5:24 AM
> To: [EMAIL PROTECTED]
> Subject: How to retreive ApplicationResources properties ?
> 
> 
> Hi, 
> i wonder to kno if its possible to access the 
> ApplicationResources properties on another way than using  a 
> bean like :
> 
> 
> A generate a part of code in a JSP class. and this code has 
> to use some properties available in ApplicationResources.
> If i use  then this one is 
> no interpreted by struts and in the client side i retrieve 
> '' in the source code 
> instead of the value of my.property.
> 
> I don't if it's possible to use something like 
> getProperty("my.property") ?
> 
> Thank's
> 
> Marc
> 
> --
> Marc AMIR-TAHMASSEB
> [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: editor

2004-01-22 Thread Daniel Lipofsky
Maybe you want a beautifier rtaher than an editor?
Like tidy: http://tidy.sourceforge.net/
It works for HTML and XML.  I haven't tried
using it for JSPs but I see some mention of
it in the discussion group.
- Dan

> -Original Message-
> From: dirk [mailto:[EMAIL PROTECTED]
> Sent: Thursday, January 22, 2004 4:27 AM
> To: Struts Users Mailing List
> Subject: editor
> 
> 
> Does anybody knows a good and free struts editor ? 
> Does anybody knows an editor that is able to make code more 
> readable, user friendlier...
> eg. formatting the following code:
> 
>  bla
> 
> into:
> 
> 
>   bla
>  
> 
> 
> Thanks !
> 

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



RE: Handling Missing Message Key

2004-01-07 Thread Daniel Lipofsky

I would suggest you extend PropertyMessageResources.
Overide constructor so that returnNull=true always.
Override getMessage to call super.getMessage(),
check for null, if null return key.
Very simple.  You probably have to extend the factory too.
- Dan

> -Original Message-
> From: Brian Styles [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, January 07, 2004 1:18 PM
> To: [EMAIL PROTECTED]
> Subject: Re: Handling Missing Message Key
> 
> 
> 
> Thanks for the reply Kris,
> 
> I think that setting the null property to true is probably 
> the way to go.
> I even found an exactly similar thread as what I want to do 
> from this June.
> Unfortunately there seems to be no definate answer.
> 
> http://www.mail-archive.com/[EMAIL PROTECTED]/msg
> 69627.html
> 
> Anyone have any idea how to get rid of the "???"s
> 
> 
> >From: Kris Schneider <[EMAIL PROTECTED]>
> >Reply-To: "Struts Users Mailing List" 
> <[EMAIL PROTECTED]>
> >To: Struts Users Mailing List <[EMAIL PROTECTED]>
> >Subject: Re: Handling Missing Message Key
> >Date: Wed,  7 Jan 2004 15:16:11 -0500
> >
> >Pretty sure you'd have to handle that yourself. It's 
> probably cleaner to do 
> >it
> >in an action.
> >
> >Action class:
> >
> >String dbProp = ...;
> >MessageResources messages = getResources(request);
> >String message = dpProp;
> >if (messages.isPresent(dbProp)) {
> >   message = messages.getMessage(dbProp);
> >}
> >request.setAttribute("message", message);
> >
> >JSP:
> >
> >
> >
> >Or I suppose you could write your own tag...
> >
> >Quoting Brian Styles <[EMAIL PROTECTED]>:
> >
> > > Hi all,
> > >
> > > I'm using the i8ln features in the struts bean tag library
> > >
> > > I populate a form bean with info from the database, and 
> this info acts 
> >as
> > > the key in a resource bundle so that I can add a 
> international versions
> > > using
> > >
> > > 
> > >
> > > however, I would very much like the actual underlying 
> property to be 
> >written
> > >
> > > out if the key doesn't exist in the resource bundle, 
> rather than getting 
> >the
> > >
> > > nasty missing message key exception. Is this possible?
> > >
> > > thanks very much,
> > > Brian
> >
> >--
> >Kris Schneider 
> >D.O.Tech   
> >
> >-
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]
> >
> 
> _
> The new MSN 8: advanced junk mail protection and 2 months FREE* 
> http://join.msn.com/?page=features/junkmail
> 
> 
> -
> 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: html:select example

2003-12-30 Thread Daniel Lipofsky
> Would someone show me a very simple example of the use of an 
> html:select tag? I did not understand its use.
> 
> I'd appreciate any simple example.


  
  


The select tag can contain a list of option tags, or an options or
optionsCollection tag or any combination.  Here I use 1 option tag to
provide a blank default and a optionsCollection tag with a collection
of LabelValueBean objects to provide the rest of the list (the fact
that the collection contains LabelValueBean objects makes the syntax
much simplier as you don't have to specify the label or value
properties.  The value that matches the value of "someProperty"
will automatically be selected.

- Dan

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



RE: Easy question: iterate

2003-12-24 Thread Daniel Lipofsky
<%
LabelValueBean[] lvArray = new LabelValueBean[] {
new LabelValueBean("label1", "value1"),
new LabelValueBean("label2", "value2"),
new LabelValueBean("label3", "value3"),
new LabelValueBean("label4", "value4") };
request.setAttribute("lvArray", lvArray);
%>

 -
 -



> -Original Message-
> From: e-denton Java Programmer [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, December 24, 2003 10:24 AM
> To: Struts Users Mailing List
> Subject: Easy question: iterate
> 
> 
> Sorry to bother you with an easy question, but I can't find 
> the answer.
> 
> I want to iterate over Category_VO[] which is stored in a 
> session attribute.
> I read that it can be done, but I can't find an example for 
> raw arrays.
> 
> Here's what I have (which probably doesn't even make sense):
> 
>   id="category"
>  collection="com.cnw.portal.database.Category_VO"
>  type="com.cnw.portal.database.Category_VO"
>  scope="session">
>  
> 
> 
> 
> Thanks!
> 
> will

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



RE: Select without selected value

2003-12-24 Thread Daniel Lipofsky
Or you can override the form value like this

If the value you set doesn't exist then nothing will
be selected.  Which means the first item will be
selected, because something always is (if we are talking
about a dropdown and not a multiselect).  But you can
always add a blank first item like this


- Dan

> -Original Message-
> From: Mark Lowe [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, December 24, 2003 8:02 AM
> To: Struts Users Mailing List
> Subject: Re: Select without selected value
> 
> 
> Just don't set the form value.
> 
> 
> On 24 Dec 2003, at 15:15, AKostylev wrote:
> 
> > I want to have select element without any selected values 
> by default.
> > I can do this by setting selectedIndex=-1 or
> > value='not_existing_value' in JavaScript.
> > Can I do this with Struts functionality?
> >
> >
> > 
> -
> > 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: problem

2003-12-24 Thread Daniel Lipofsky
If I am understanding correctly you just want

which will pull the value from the "name" property of the bean.
If you specify a value in the tag it oiverrides what is in
the bean.
- Dan

> I want to use an update user details page in my application 
> which uses a
> form to display the current user details and updates any changes. Im
> having problems displaying the information of the user bean 
> in the value
> property.
>  
> What I want is 
> 
>  
> Ive tried the following which is giving me errors:
>  property="name" />" />

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



RE: [OT] Date Problem

2003-12-19 Thread Daniel Lipofsky
Try java.sql.Timestamp.
RTFM for the differences between Date, Time, and Timestamp.
- Dan

> -Original Message-
> From: Raj Yadav [mailto:[EMAIL PROTECTED]
> Sent: Friday, December 19, 2003 3:42 PM
> To: [EMAIL PROTECTED]
> Subject: [OT] Date Problem
> 
> 
> Hi All,
> 
> I have date stored in a flat log file like this:
> 
> Mon Dec 15 00:00:52 2003
> 
>  
> 
> I read the log file and get this date as a String.
> 
> I want to insert this date into a Oracle table.
> 
> My method is like this:
> 
> public static java.sql.Date StringToDate(String date)
> 
> {
> 
> java.sql.Date retDate = null;
> 
> try
> 
> {
> 
> String incomingDate = date;
> 
> SimpleDateFormat formatter = new SimpleDateFormat("EEE MMM d
> HH:mm:ss   
> ");
> 
> java.util.Date d = formatter.parse(incomingDate);
> 
> retDate = new java.sql.Date(d.getTime());
> 
> System.out.println("retDate = " + retDate);
> 
> //retDate = (java.sql.Date)formatter.parse(incomingDate);
> 
> }
> 
> catch(ParseException prsEx)
> 
> {
> 
> System.out.println("Parsing Exception in Utils = " + prsEx);
> 
> }
> 
> return retDate;
> 
> }
> 
>  
> 
> It is inserting only MM/dd/ and not the time.
> 
> How do i insert the whole date with the time
> 
>  
> 
> thanks,
> 
> -raj
> 
>  
> 
> 
> 
> -
> 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: [OT] HTML Select box

2003-12-19 Thread Daniel Lipofsky

I agree.  I think it would be bizarre and confusing to the user
to try and select many things from a dropdown.  Nobody does this.
Maybe you want to use a popup (DHTML or separate window) if
you really need to save real estate.  Otherwise use a
multiselect with multiple lines.
- Dan

>  From a GUI perspective, how would you select multiple things in a 
> drop-down? I can't actually recall ever seeing this type of widget 
> anywhere (irrespective of HTML).
> 
> Could you send an example?
> 
> Jerry Jalenak wrote:
> 
> >Hi All,
> >
> >Can't seem to find a way to do this, even though I've seen it done (I
> >think).  What I need is a HTML select box where the size 
> parameter=1 (so I
> >get a true drop-down, not a scrolling box) AND the ability to select
> >multiple options within the select box.  Right now if I set 
> the multiple
> >parameter I get a scrolling box.  I'm using an 
> optionsCollection tag to
> >generate my option list (not that I think it has anything to 
> do with my
> >problem  8-)  I suspect there is a JavaScript solution out 
> there, but I
> >can't seem to google it.  Does anyone have any ideas?
> >
> >TIA!
> >
> >Jerry Jalenak

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



RE: Drop Down - Code and Description

2003-12-11 Thread Daniel Lipofsky

In the setDescription pass a string which includes both
code and description call.

Or if you don't want to change that object
just create a list of LabelValueBean objects
which has the right content.

or use

  
TEXT TO BE DISPLAYED HERE
  ...
...

- Dan


> Wit, 
> 
>   My baseAbstractVO Class has only setter & getter methods. 
>   The baseAbstractVO.vehicleLineList is an arrayList 
> which contains
> code and Description in the form of an temp Object.
> 
>   if (rs.getString(1) != null) {
>   
> commonVO.setCode(rs.getString(1).trim());
>   } else {
>   commonVO.setCode("");
>   }
> 
>   if (rs.getString(2) != null) {
>   
> commonVO.setDescription(rs.getString(2).trim());
>   } else {
>   
> commonVO.setDescription("");
>   }
>   arrayList.add(commonVO);
> 
>   
> 
>   The arrayList is the vehicleLineList... 
> 
> Warm Regards
> Shreekanth
> 
> 
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]
> Sent: Thursday, December 11, 2003 4:42 PM
> To: Struts Users Mailing List
> Subject: Re: Drop Down - Code and Description
> 
> 
> Dear Shree:
> 
> Can you copy-and-paste the code for the JavaBean that was referred by 
> request (or session).getAttribute("baseAbstractVO")?
> 
> wit
> 
> 
> 
> 
> 
> 
> "Rama, Shreekanth (K.)" <[EMAIL PROTECTED]>
> 12/11/2003 04:33 PM
> Please respond to "Struts Users Mailing List"
> 
>  
> To: "Struts Users Mailing List" 
> <[EMAIL PROTECTED]>
> cc: 
> Subject:Drop Down - Code and Description
> 
> 
> Hi ALL, 
> 
>  I have a problem in the drop down in the 
> application..
>  
>   property="baseAbstractVO.vehLineCode" size="1">
>   property="baseAbstractVO.vehicleLineList" value ="code"
> label="description"/>
>  
>  
> 
>  I want to have both code and description of 
> the selected 
> item from
> the drop down box. 
> 
> Any Help Pls ?? 
> 
> Regards
> Shreekanth 

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



RE: getting the form name

2003-12-09 Thread Daniel Lipofsky

There are 2 ways, and I did both, just to be anal
and because I didn't know which was best.

  FormTag form = (FormTag) pageContext.
  getAttribute(Constants.FORM_KEY, PageContext.REQUEST_SCOPE);
  if (form == null)
  form = (FormTag) findAncestorWithClass(this, FormTag.class);
  if (form == null)
  throw new JspException("...");
  String formName = form.getBeanName();

- Dan

> -Original Message-
> From: Jarnot Kari Contr HQ SSG/STN [mailto:[EMAIL PROTECTED]
> Sent: Monday, December 08, 2003 5:57 AM
> To: Struts Users Mailing List
> Subject: RE: getting the form name
> 
> 
> You could do this:
> FormTag htmlForm = (FormTag) TagSupport.findAncestorWithClass(this,
> FormTag.class);
> String actionFormName = htmlForm.getBeanName();
> 
> -Original Message-
> From: Arne Brutschy [mailto:[EMAIL PROTECTED] 
> Sent: Monday, December 08, 2003 7:42 AM
> To: Struts Users Mailing List
> Subject: getting the form name
> 
> 
> Hello,
> 
> I'm trying to subclass the TextTag.java. I need to get the form name 
> assiciated with this input field. How can I retrieve this? As I 
> understand it right, the form field gets the name of the form 
> from the 
> associated actionmapping. But how can I get the form tag, the 
> text tag 
> is nested in?
> 
> Regards,
> Arne
> 
> 
> -
> 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: using ApplicationResources in jsp...

2003-12-05 Thread Daniel Lipofsky

Struts has a class called RequestUtils and you can call
RequestUtils.message(pageContext, bundle, locale, key);

But maybe you should be creating your array in the Action
and passing storing it in the Form for the JSP to grab.
Then you can get messages in an action like this:
// default bundle
MessageResources mr1 = getResources(request);
String s1 = mr1.getMessage("welcome.message");
// some other bundle
MessageResources mr2 = getResources(request, "alt_bundle");
String s2 = mr2.getMessage("welcome.message");
- Dan

> -Original Message-
> From: AMIR-TAHMASSEB Marc [mailto:[EMAIL PROTECTED]
> Sent: Friday, December 05, 2003 6:16 AM
> To: Struts Users Mailing List
> Subject: RE: using ApplicationResources in jsp...
> 
> 
> because i have to put it on an array of String and then i use 
> this array in the code by a generic code.
> 
> > -Message d'origine-
> > De : Jimmy Emmanual [mailto:[EMAIL PROTECTED]
> > Envoyé : vendredi 5 décembre 2003 15:10
> > À : 'Struts Users Mailing List'
> > Objet : RE: using ApplicationResources in jsp...
> > 
> > 
> > why do you need to? why not just:
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > -Original Message-
> > From: AMIR-TAHMASSEB Marc 
> [mailto:[EMAIL PROTECTED]
> > Sent: Friday, December 05, 2003 9:07 AM
> > To: Struts Users Mailing List
> > Subject: RE: using ApplicationResources in jsp...
> > 
> > 
> > because i need to get the value of my property inside a <% ... %>
> > 
> > > -Message d'origine-
> > > De : Hunziker Dennis [mailto:[EMAIL PROTECTED]
> > > Envoyé : vendredi 5 décembre 2003 15:03
> > > À : 'Struts Users Mailing List'
> > > Objet : RE: using ApplicationResources in jsp...
> > > 
> > > 
> > > why not try the following:
> > > 
> > > 
> > > -Original Message-
> > > From: AMIR-TAHMASSEB Marc 
> > [mailto:[EMAIL PROTECTED] 
> > > Sent: Freitag, 5. Dezember 2003 15:01
> > > To: [EMAIL PROTECTED]
> > > Subject: using ApplicationResources in jsp...
> > > 
> > > 
> > > Hi,
> > > i wonder to know if it's possible to use a property in 
> > > ApplciationResources
> > > in  the jsp code.
> > >  
> > > I want to do something like this :
> > >  
> > > 
> > > <%@ page language="java" %>
> > > <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
> > > <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
> > > <%@ taglib uri="/WEB-INF/struts-template.tld" prefix="template" %>
> > > <%@ taglib uri="/WEB-INF/struts-logic.tld"prefix="logic" %>
> > > <%
> > > String title = title.from.ressources; // i don't know how 
> > > to access it !
> > > %>
> > > 
> > > 
> > > <%=title%>
> > > 
> > > 
> > >  
> > >  
> > >  
> > > --
> > > Marc AMIR-TAHMASSEB
> > > [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]
> > 
> > 
> 
> -
> 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: Log4j with Struts

2003-12-05 Thread Daniel Lipofsky
> 
>  String str = new String(LogonAction.class.getName()); 
> 

This is completely off-topic, but using
new String(String)
is almost always wasteful.  Strings are
immutable, so there is no need to copy them.
- Dan

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



RE: optionsCollection with another default value

2003-11-24 Thread Daniel Lipofsky

Use one  tag followed by the
 tag.
- Dan

> -Original Message-
> From: Frank Schaare [mailto:[EMAIL PROTECTED]
> Sent: Monday, November 24, 2003 3:15 AM
> 
> Hallo,
> 
> i´ve made a select from an optionsCollection Tag. The values are read 
> from a hashmap like
> value1 = one
> value2 = two
> value3 = three
> 
> Now i´d like to set a default value for this select, which is 
> NOT PART 
> of my HashMap, f.e "please select..." The rendered select should look 
> like this:
> please select...
> one
> two
> three
> 
> is there any way to achieve this result in struts ?

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



RE: Generate a Drop-Down ???

2003-11-14 Thread Daniel Lipofsky
If I understand your question you are just looking for

  

- Dan

> I put the bean on the method execute on myAction
> 
> ArrayList formatosArquivos = new ArrayList();
> 
> formatosArquivos.add("CSV");
> 
> formatosArquivos.add("XML");
> 
> formatosArquivos.add("Algorithmics");
> 
> ProdutoView produto = new ProdutoView();
> produto.setFormatosArquivos(formatosArquivos);
> 
> session.setAttribute("produtoView",produto);
> 
> 
> So, How I generate a drop-down list on the next Jsp page???

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



tag body output

2003-11-13 Thread Daniel Lipofsky

(this is really a taglib question, not struts,
so my apology for being off-topic)

I am designing a security tag which shows or
nukes its body depending on the user.

I got it to work, although I have a question
as to why the simplier code didn't work.
I am just learning and I want to understand.

Here is the working code

public class SecurityTag extends BodyTagSupport {

protected String saveBody = null;

public int doStartTag() throws JspException {
String ts = (String) pageContext.
getAttribute("TEST-SECURITY",PageContext.SESSION_SCOPE);
if ("hide".equals(ts)) {
return SKIP_BODY;
}
return EVAL_BODY_BUFFERED;
}

public int doAfterBody() throws JspException {

if (bodyContent != null) {
saveBody = bodyContent.getString();
} else {
saveBody = null;
}
return SKIP_BODY;

}

public int doEndTag() throws JspException {
if (saveBody != null)
ResponseUtils.write(pageContext, saveBody);
return EVAL_PAGE;
}

}

My first attempt was to just call
ResponseUtils.write(pageContext, bodyContent.getString())
from doAfterBody().  WHY DIDN'T THAT WORK?
It just output nothing despite the fact that
bodyContent had the content at that point.
Thanks,
Dan

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



RE: Need a RegExp mask for: all charactors except for "\", "/" and "?"

2003-11-12 Thread Daniel Lipofsky

Do this
[^\\/?]  (one char)
[^\\/?]* (zero or more chars)

Also if in a java string don't forget to escape
the backslashes again like
"[^/?]*"

- Dan

> From: Saul Q Yuan [mailto:[EMAIL PROTECTED]
> 
> Try this,
> 
> ^[\\|\/|\?] 
> 
> or (^[\\|\/|\?])* for 0 or more matches
> 

> From: Kevin Wang [mailto:[EMAIL PROTECTED] 
> Subject: Need a RegExp mask for: all charactors except for 
> "\", "/" and
> "?"

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



logging MessageResource requests by page

2003-11-11 Thread Daniel Lipofsky
I am wanting to do some special logging
of MessageResource requests based on what
page the user makes the request from.

I looked at subclassing MessageResources
and MessageResourcesFactory - but it looks like
that won't work because in the MessageResources
class you don't have a way to access PageContext
or any info about the request object (please tell
me if you can think of a way).

However it looks like all the taglibs call
org.apache.struts.util.RequestUtils.message(...),
and they pass in the PageContext, so if I could
subclass that I could do my logging.  Unfortunately
it is mostly static methods, it looks like the
method calls would all be set at compile time,
with no chance to override.

I could of course modify every tablib class to call
a modified RequestUtils class, but I am looking for
something more elegant and less work.

Can anyone think of a solution?

(what I am really trying to is produce a list of
all keys used on a page - this will be used in a GUI tool
which lets a non-technical user fix mistranslated or 
untranslated strings they find on a page without having
to search the whole bundle)

Thanks,
Dan

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