Re: [S2.0.8] datetimepicker.... is it a train wreck?

2007-06-17 Thread Torsten Römer
Well, now I gave also jscalendar a try, and I think it is the best DHTML
calendar I have seen until now. It has all the features I wanted, like
date and time selection, internationalisation, styles  even themes, it
is higly configurable and very easy to integrate.

So I have chosen jscalendar now, and finally I am done with my
registration form... :-)

Torsten

Mark P Ashworth schrieb:
 Good Day,
 
 Thanks once again.
 
 Regards,
 Mark P Ashworth
 http://www.connext.co.za
 
 
 
 Jeromy Evans - Blue Sky Minds wrote:
 Mark P Ashworth wrote:
 Good Day,

 Thank you for your help. I created properties that return string
 representations of the date  time values and I use the jscalendar
 component
 to select the date  times. Seems to work just grand. I have only one
 issue
 that if the date string could parsed then it does not report the
 exception
 even though I throw ParseException in those properties. Should I be using
 validation to parse the submitted values?

 Regards,
 Mark P Ashworth
 http://www.connext.co.za
   
 Great!  Yes, don't throw an exception in your property setter as it will 
 just be lost.  Convert it to a Date if you can.
 Then use the date validator to check the actual Date property.  It will 
 call any getter you name in the xml file, so point it at a Date getter, 
 not the String.
 Alternately implement Validatable in your action and implement your own 
 logic in the validate method.

 Also, if you keep a reference to the String value and provide a getter 
 for it, you can return the original (invalid) value back to the form if 
 it fails validation (although I'm not sure that jscalendar will accept
 it).

 This is a link how to use the Validatable interface:
 http://today.java.net/pub/a/today/2006/01/19/webwork-validation.html

 Hope that makes sense.

 -
 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: [S2] Could not parse struts.locale setting

2007-06-14 Thread Torsten Römer
I am a bit confused now:

- It seems when the app starts in the course of Tomcat starting up,
there is no warning
- When the app starts in the course of stopping/starting or reloading in
Tomcat Manager, the warning still appears
- However my the locale I set as constant in struts.xml seems to apply
now (en_GB vs. platform setting de_DE)

So, as long as the setting actually applies (first after Tomcat
restart?) I can of course live with the warning :-)

Torsten

Gabriel Belingueres wrote:
 I'm getting the same warning setting the constant in the struts.xml
 file. Didn't test using struts.properties.
 
 Upgrading to v2.0.8 didn't solve the problem either.
 
 2007/6/13, Danny Hurlburt [EMAIL PROTECTED]:
 I was getting the same warning. I was able to remove the warning by
 creating a
 /WEB-INF/classes/struts.properties file with struts.locale=en_GB

 I am however not able to set the locale via the constant element in
 struts.xml
 althought the documentation at
 http://struts.apache.org/2.0.6/docs/constant-configuration.html
 states that you can.

 Torsten Römer wrote:
  Everytime my app starts, I see this in the log:
 
  13.06.2007 23:50:27 org.apache.struts2.config.Settings getLocale
  WARNUNG: Settings: Could not parse struts.locale setting, substituting
  default VM locale
 
  I put
 
  constant name=struts.locale value=en_GB /
 
  in my struts.xml, but I still get the error (and the default VM locale
  is used, which I don't want)
 
  Torsten
 
  -
  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: [S2.0.8] datetimepicker.... is it a train wreck?

2007-06-14 Thread Torsten Römer
What concerns me is the loading time of a page that contains one or more
datetimepickers. Especially in the company network here (very fast but
behind a proxy), it sometimes takes a minute or more to load such a page
while my little Linux box here almost freezes. More or less the same
happens on the Windoze XP notebook.

I wonder if it's worth to challenge the user's patience just to have
some fancy looking date picker.

Torsten

Musachy Barroso wrote:
 Al just to answer your question straight, yes, it is a train wreck and I
 would advise not to use it until 2.1 comes out.
 
 regards
 musachy
 
 On 6/13/07, Al Sutton [EMAIL PROTECTED] wrote:


 That page seems offer no help for me at all.  As a side note, the bug I
 mentioned in my original email means that the example in the page doesn't
 work under certain conditions.

 What bit of that page did you think might help me?

 Btw, please don't post more links to your site, I'm not really interested
 in
 boosting your google ad counts, I'd prefer a solution to getting
 formatLength=medium working.


 -Original Message-
 From: Deepak Kumar [mailto:[EMAIL PROTECTED]
 Sent: 13 June 2007 11:52
 To: Struts Users Mailing List
 Subject: RE: [S2.0.8] datetimepicker is it a train wreck?

 Hi,

 Just read Datetime picker example at
 http://www.roseindia.net/struts/struts2/date/struts-2-datetimepicker.shtml

 .



 Thanks


 -Original Message-
 From: Al Sutton [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, June 13, 2007 4:11 PM
 To: 'Struts Users Mailing List'
 Subject: [S2.0.8] datetimepicker is it a train wreck?


 I've been trying to do some work with datetime picker in 2.0.8 and it
 seems
 to me it's a real mess.

 In my action I have;

 public Date getReportStartDate() {
 return reportStartDate;
 }

 public void setReportStartDate(Date reportStartDate) {
 this.reportStartDate = reportStartDate; }

 Now, here comes the fun part, If I put the following in the JSP things
 kind
 of work;

 s:datetimepicker label=Start date name=reportStartDate/

 The reason I say kind of is because the date is shown in US format
 (mm/dd/), which is confusing for european users, so I switched to;

 s:datetimepicker label=Start date name=reportStartDate
 formatLength=medium/

 Which then generates the error Invalid field value for field
 reportStartDate., and yes, this is the ONLY change made.

 I though about trying a custom date format and saw
 https://issues.apache.org/struts/browse/WW-1917 which basically makes it
 not
 an option.


 So, my question is, am I doing something dumb, or does it really break so
 easily?, and if so is it of any real use to non-US users to whom the
 mm/dd/ date format is just wrong?


 -
 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: [S2.0.8] datetimepicker.... is it a train wreck?

2007-06-14 Thread Torsten Römer
 I'll be replacing that with the one Torsten
 emailed about earlier at the first opportunity I get:
 
 http://www.mattkruse.com/javascript/calendarpopup/
 

I just gave that a try myself and I ran into a few issues:

- The placement of the div popup is not as smart as with
datetimepicker, in my case it was partially outside the browser window.
Could be fixed with CalendarPopup.offsetX/offsetY.

- The tabs of an s:tabbedPanel obscured the calendar. Fixed by adding
z-index:2 to the style of the popup div

- The month/year navigation would just close the popup. Seems to be an
issue with S2 tags and onmouseup event handlers (described under note 4
in CalendarPopup.js). Worked around by commenting c.autoHide() in
CalendarPopup.js, which means the popup is only closed when picking a
date. Because this is not very userfriendly, I added a small function to
toggle the visibility of the popup when clicking on the anchor,
something like

function toggle() {
  if(document.getElementById(popup).style.visibility == 'visible') {
cal1.hideCalendar();
  }
  else {
cal1.select(document.forms[0].dateAsString,'anchor1','-MM-dd');
  }
}

Now I just have to apply some custom style to the calendarpopup and I
finally got pretty much what I wanted...

Torsten

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



DateTimePicker Internet Explorer

2007-06-13 Thread Torsten Römer
The DateTimePicker looks very nice on Linux/Firefox but on Windows/IE
the font is too small and the arrows to change week  month are not
shown: http://luniks.net/DateTimePicker.png

I tried to increase the font size by placing a modified version of
DatePicker.css from struts-core.jar into my webapp and specifying the
URL as templateCssPath but without success. I tried different URLs but I
am unsure how it should look like.

I also noticed that a page that contains a DateTimePicker loads quite slow.

Torsten

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



Re: Standalone DatePicker?

2007-06-13 Thread Torsten Römer
As the DateTimePicker is actually a Dojo widget I'd assume you can also
use it without Struts2:

http://dojotoolkit.org/

But I'd rather use this JavaScript calendar:

http://www.mattkruse.com/javascript/calendarpopup/

Torsten

Christopher Schultz schrieb:
 All,
 
 I am a user of Struts 1 and I've seen a lot of discussion of the S2 date
 picker lately. I have a need for a date picker and I'd like to know if
 there is a way to use this widget without actually running S2 under the
 hood.
 
 I realize that the tag library is probably just generating a number of
 script and link tags that could be used directly. Has anyone done
 this before successfully? My web searches mostly resulted in posts to
 this list using it in the standard way.
 
 Can anyone point me towards any documentation for using this without the
 struts tags themselves?
 
 Thanks,
 -chris

-
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]



[S2] Could not parse struts.locale setting

2007-06-13 Thread Torsten Römer
Everytime my app starts, I see this in the log:

13.06.2007 23:50:27 org.apache.struts2.config.Settings getLocale
WARNUNG: Settings: Could not parse struts.locale setting, substituting
default VM locale

I put

constant name=struts.locale value=en_GB /

in my struts.xml, but I still get the error (and the default VM locale
is used, which I don't want)

Torsten

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



Re: Programmatic Validation in Action

2007-06-09 Thread Torsten Römer
I put my validation code in the validate() method and use addFieldError().

To avoid validation to be performed on initial form display, I made a
mapping like this:

action name=reservation_*
class=net.luniks.bagpowerride.page.Reservation
method={1}
  result name=success type=tilesbookedTiles/result
  result name=input type=tilesreservationTiles/result
  result name=error type=tileserrorTiles/result
/action

and call the action reservation_input. Struts knows then that it
should not perform validation.

The form itself then calls the action reservation.

It works fine for me, just that special characters (üöä...) in the typed
values are sometimes messed up when the form is redisplayed on
validation error :-(

Torsten

Matt Luce schrieb:
 Has anyone attempted to use programmatic validation in Struts 2?  When I
 add an actionError and return INPUT, it properly goes back to the page
 with the form, but it does not keep the values that I typed.  Shouldn't
 that work?  This is how it worked in Struts 1.
 
 
 package com.company.action;
 
 import com.opensymphony.xwork2.ActionSupport;
 
 
 public class ExampleValidateAction extends ActionSupport
 {
 
private string attribute;
 
public String execute() throws Exception
{
 
// complicated validation logic.  Too complicated for xml validation
this.addActionError(Validation Error);
return INPUT;
 
 
}
 
public string getAttribute()
{
   return attribute;
}
 
public void setAttribue(String attr)
{
   this.attribute = attr;
}
 
 }
 
 

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



[S2] Problems with special characters

2007-06-06 Thread Torsten Römer
I am experiencing quite strange problems with special characters such as
odiaresis and aring (ä,å,ö):

- Sometimes already when the form is redisplayed on validation error

- When the form values are inserted into the database

- When the form values are sent as text email

The strange thing is, that this doesn't always happen. Sometimes the
characters are displayed fine, sometimes they are shown as question mark.

A similar  also strange problem is when using getText() in the action.
It seems that depending on the locale set by the user, special
characters might get messed up as well.

Is this a problem with charsets? Encoding? Is there some JVM parameter
or Struts2 configuration that I could play with?

Torsten


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



s:radio/s:checkboxlist and primitive properties

2007-06-05 Thread Torsten Römer
I tried to use primitive types/arrays of primitives as name property
of s:radio and s:checkboxlist.

It works fine, but the state is not maintained because the
ContainUtil.compare() method returns false as it compares e.g. an
Integer and a Sting using Object.equals().

Is there a reason why we can't use primitives like in for example
s:checkbox?

I patched my own ContainUtil.compare() and it seems to work fine now -
should I log a JIRA issue/RFE?

Hope I haven't overlooked an existing issue/post on this!

Torsten

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



Re: [S2] s:radio/ map to boolean property not checked

2007-06-05 Thread Torsten Römer
I think you have the same problem as I just had. Because you put the
values as literals in s:radio, the tag ends up comparing a String
true against a Boolean true which of course returns false.

Could you try the tag like this:

s:radio label=autoActivate name=serviceData.autoActivate
 list=#{true:'true', false:'false'} /

Torsten

Vincent Lin schrieb:
 I have a java bean serviceData with a Boolean property autoActivate in my
 action.
 And I wrote a s:radio/ tag in my JSP:
 
 s:radio label=autoActivate name=serviceData.autoActivate
list=#{'true':'true', 'false':'false'} /
 
 But the default radio button is not checked in my page.
 (While autoActivate is true the radio button of 'true' should be checked,
 but it isn't.)
 
 It works when I map s:select/ to java 1.5 enum, but it doesn't work
 when I
 map s:radio to java.lang.Boolean.
 Did I do anything wrong?
 
 Thanks.
 

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



Re: s:radio/s:checkboxlist and primitive properties

2007-06-05 Thread Torsten Römer
Sorry I just realize I didn't use the tag the right way. I had String
literals in my list instead of the actual primitives/objects...

Now of course it works just fine without any patching!

Slowly, but I am getting there ;-)

Torsten

Torsten Römer schrieb:
 I tried to use primitive types/arrays of primitives as name property
 of s:radio and s:checkboxlist.
 
 It works fine, but the state is not maintained because the
 ContainUtil.compare() method returns false as it compares e.g. an
 Integer and a Sting using Object.equals().
 
 Is there a reason why we can't use primitives like in for example
 s:checkbox?
 
 I patched my own ContainUtil.compare() and it seems to work fine now -
 should I log a JIRA issue/RFE?
 
 Hope I haven't overlooked an existing issue/post on this!
 
 Torsten
 
 -
 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: Struts2 Dynamic Checkboxes

2007-06-04 Thread Torsten Römer
Ah, I am such a dingbat... the beans in my list contained a property
with the same name as I used for the Collection property in the backing
bean. So when the tag was checking if the option was there or not it was
looking at some boolean property of that bean instead into the Collection.

Not before I downloaded the Struts2 source and debugged the
ListUIBean.compare() method I realized that ;-)

So this answers my question, and I am happy to say that my dynamic
checkboxes now work perfectly!

The Dingbat

Torsten Römer schrieb:
 I think I found an OK solution but one thing does not work and I don't
 understand why.
 
 So what I am doing is creating single checkboxes in an iterator,
 disabling the automatically generated label through a modified simple
 theme and creating my custom labels:
   
 s:iterator value=cars
   s:label
 s:checkboxlist templateDir=template
 template=checkboxlist.ftl
 theme=nolabel
 name=car
 list=%{''+name}/   
 s:text
 name=format.moneyrounds:param value=price//s:text
 s:property value=name/
   /s:label  
   /s:iterator
 
 cars is a List of simple beans with, among other, a name property.
 The car property is a Collection. When I check a checkbox and submit
 the form, I can see that an XWorkList containing the value is passed to
 setCar().
 BUT: When the form is redisplayed, as because of a validation error, the
 getCar() method is not called and the checkbox is not checked.
 
 Can anyone tell me why?
 
 If I move the s:checkboxlist tag outside the s:iterator, it works,
 but like this I can't create my custom labels, which is what this is all
 about...
 
 Torsten
 
 Torsten Römer schrieb:
 Well, why not try both ways... it will be a good exercise no matter what.

 I'll get back when I have some interesting experiences to share with.

 Thanks again!

 Torsten

 Dave Newton schrieb:
 --- Torsten Römer [EMAIL PROTECTED] wrote:
 I see there is no point in what I am trying to do.
 Oh, I don't know about that.

 You could use a map (or list) for the checkbox values
 and gather up the result values that way, couldn't
 you? 

 You just need to pre-populate the map (or list) in the
 action before hitting the view.

 d.




 Be
  a better Globetrotter. Get better travel answers from someone who knows. 
 Yahoo! Answers - Check it out.
 http://answers.yahoo.com/dir/?link=listsid=396545469

 -
 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: Disable label re-select tab

2007-06-04 Thread Torsten Römer
The selectedTab attribute of course does the trick.

Is there also an easy way to know which tab was selected when the form
was submitted?

Torsten

Musachy Barroso schrieb:
 To select the tab, use the selectedTab attribute on tabbedPannel. For
 your
 label question check this FAQ:
 
 http://cwiki.apache.org/WW/why-do-the-form-tags-put-table-tags-around-controls.html
 
 
 musachy
 
 On 5/22/07, Torsten Römer [EMAIL PROTECTED] wrote:

 I have 2 beginners questions that I can't seem to figure out:

 - How can I make tags like s:radio not to create any label and create
 my own label (using for example the s:label tag)?

 - What is the easiest way to re-select the selected tab of a
 s:tabbedPanel when redisplaying the form? I have a String type
 property for the current tab in my backing bean but I am unsure how to
 use it.

 Torsten

 -
 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: Struts2 Dynamic Checkboxes

2007-05-30 Thread Torsten Römer
I think I found an OK solution but one thing does not work and I don't
understand why.

So what I am doing is creating single checkboxes in an iterator,
disabling the automatically generated label through a modified simple
theme and creating my custom labels:

s:iterator value=cars
  s:label
s:checkboxlist templateDir=template
template=checkboxlist.ftl
theme=nolabel
name=car
list=%{''+name}/ 
s:text
name=format.moneyrounds:param value=price//s:text
s:property value=name/  
  /s:label
/s:iterator

cars is a List of simple beans with, among other, a name property.
The car property is a Collection. When I check a checkbox and submit
the form, I can see that an XWorkList containing the value is passed to
setCar().
BUT: When the form is redisplayed, as because of a validation error, the
getCar() method is not called and the checkbox is not checked.

Can anyone tell me why?

If I move the s:checkboxlist tag outside the s:iterator, it works,
but like this I can't create my custom labels, which is what this is all
about...

Torsten

Torsten Römer schrieb:
 Well, why not try both ways... it will be a good exercise no matter what.
 
 I'll get back when I have some interesting experiences to share with.
 
 Thanks again!
 
 Torsten
 
 Dave Newton schrieb:
 --- Torsten Römer [EMAIL PROTECTED] wrote:
 I see there is no point in what I am trying to do.
 Oh, I don't know about that.

 You could use a map (or list) for the checkbox values
 and gather up the result values that way, couldn't
 you? 

 You just need to pre-populate the map (or list) in the
 action before hitting the view.

 d.




 Be
  a better Globetrotter. Get better travel answers from someone who knows. 
 Yahoo! Answers - Check it out.
 http://answers.yahoo.com/dir/?link=listsid=396545469

 -
 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: how to check if page has been displayed (rendered) by the browser

2007-05-30 Thread Torsten Römer
Couldn't you use the JavaScript Load event to know when the page has
been completely rendered, and postpone your reload until then?

Torsten

Greg Stasica schrieb:
 hi,
 
 My problem is that I've a big JSP page with a lot of scriptlets and a 
 JavaScript which basically reloads the whole page every 5s. The problem is 
 that my JavaScript makes a request to the server before the user has a 
 chance to see the whole page.
 Is it possible to read somehow that the page was sent to the browser and 
 that the browser has completed rendering its content? 
 
 
 
 
 -
 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: S2 tag property calls with arguments?

2007-05-28 Thread Torsten Römer
I should have a closer look at this... seems all very useful to know!

Thanks again!

Torsten

Sami Dalouche schrieb:
 Hi,
 
 OGNL is yet another language  that one can use to access properties and
 methods. You can see it as a simplified language (like Groovy or Java
 itself) that is focused on data binding. 
 
 To KISS, in Java, you would access your properties using :
 
 obj.getProperty1().getProperty2().methodCall()
 
 in OGNL, the syntax would be :
 obj.property1.property2.methodCall()
 
 
 In Java, you choose the object on which you apply the getProperty1()
 method. In OGNL, the object is implicit, and is called a context map. 
 A context Map is just a simple Hash Map where one of the objects is
 chosen as the ROOT. 
 
 Struts2 has arbitrarily chosen to choose the Value Stack as the ROOT.
 So, that means that all the properties you call and your action's
 properties. 
 Another popular web framework, Tapestry, also uses OGNL. The Component /
 Page in Tapestry is the OGNL ROOT. 
 
 Hope that helps,
 Sami Dalouche
 
 
 Le lundi 28 mai 2007 à 01:21 +0200, Torsten Römer a écrit :
 Thanks Sami,

 That did definetely help, was just what I was looking for!

 In Struts2, properties are accessed using the OGNL language
 Somehow I haven't really realized what this actually means...

 Torsten

 Sami Dalouche schrieb:
 Hi,

 Not sure if I understand your question correctly, but it seems you are
 trying to make a Java method call from your View.

 In Struts2, properties are accessed using the OGNL language. The OGNL
 reference is available from http://www.ognl.org/.

 In particular, it is possible to make any method call using OGNL, using
 the simple syntax :
 myMethod(param1, param2)

 so, in your case, it could be
 getVehicles('car')

 Hope that helps,
 Regards,
 Sami Dalouche

 Le dimanche 27 mai 2007 à 20:15 +0200, Torsten Römer a écrit :
 I guess this has been asked before but I have trouble finding an answer,
 if it is somehow possible to give arguments to property calls in tags.
 For example, if I'd have vehicles as list attribute in s:select,
 that I could give literal arguments like car or motorcycle and have
 a method like getVehicles(String type) { ... } in my backing bean.

 A simple yes or no would already be very helpful :-)

 Torsten

 -
 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]
 
 
 

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



S2 tag property calls with arguments?

2007-05-27 Thread Torsten Römer
I guess this has been asked before but I have trouble finding an answer,
if it is somehow possible to give arguments to property calls in tags.
For example, if I'd have vehicles as list attribute in s:select,
that I could give literal arguments like car or motorcycle and have
a method like getVehicles(String type) { ... } in my backing bean.

A simple yes or no would already be very helpful :-)

Torsten

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



Re: S2 tag property calls with arguments?

2007-05-27 Thread Torsten Römer
Thanks Sami,

That did definetely help, was just what I was looking for!

 In Struts2, properties are accessed using the OGNL language

Somehow I haven't really realized what this actually means...

Torsten

Sami Dalouche schrieb:
 Hi,
 
 Not sure if I understand your question correctly, but it seems you are
 trying to make a Java method call from your View.
 
 In Struts2, properties are accessed using the OGNL language. The OGNL
 reference is available from http://www.ognl.org/.
 
 In particular, it is possible to make any method call using OGNL, using
 the simple syntax :
 myMethod(param1, param2)
 
 so, in your case, it could be
 getVehicles('car')
 
 Hope that helps,
 Regards,
 Sami Dalouche
 
 Le dimanche 27 mai 2007 à 20:15 +0200, Torsten Römer a écrit :
 I guess this has been asked before but I have trouble finding an answer,
 if it is somehow possible to give arguments to property calls in tags.
 For example, if I'd have vehicles as list attribute in s:select,
 that I could give literal arguments like car or motorcycle and have
 a method like getVehicles(String type) { ... } in my backing bean.

 A simple yes or no would already be very helpful :-)

 Torsten

 -
 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: Disable label re-select tab

2007-05-23 Thread Torsten Römer
Thanks Jeromy,

I think I will try to create my own theme.

I am just wondering why the behaviour of (some of) the tags is
different; i.e. that s:radio always creates a label while s:checkbox
doesn't if theme=simple.

Torsten

Jeromy Evans schrieb:
 Either:
 - create your own theme for the radio button. Use simple/radiomap.ftl
 tyo create mytheme/radiomap.ftl to exclude the label that's always
 included (recommended); or
 - do a hack: you can use html inputs in your form directly in your JSP. 
 These are also included as parameters for your post. Struts2 doesn't
 know the difference provided the name equals what struts2 expects.
 
 ie. put this in your JSP contained in your s:iterator:
 input type=radio name=car id=reservation_carBMW M5
 value=s:property value = my.property//
 
 
 Torsten Römer wrote:
 Thanks, Musachy, for the quick answer.

 I should have mentioned, that I already set theme=simple but s:radio
 would still create a label:

 s:radio theme=simple name=car list={'BMW M5'}/

 yields:

 input type=radio name=car id=reservation_carBMW M5 value=BMW
 M5/label for=reservation_carBMW M5BMW M5/label

 What I am actually trying to do is to create single radiobuttons in a
 s:iterator loop. Sounds crazy I know, but I need to place the
 radiobuttons in a specific layout so I can't use standard markup.

 All works fine, I just can't get rid of the labels :-(

 Torsten

 Musachy Barroso schrieb:
  
 To select the tab, use the selectedTab attribute on tabbedPannel. For
 your
 label question check this FAQ:

 http://cwiki.apache.org/WW/why-do-the-form-tags-put-table-tags-around-controls.html



 musachy

 On 5/22/07, Torsten Römer [EMAIL PROTECTED] wrote:

 I have 2 beginners questions that I can't seem to figure out:

 - How can I make tags like s:radio not to create any label and create
 my own label (using for example the s:label tag)?

 - What is the easiest way to re-select the selected tab of a
 s:tabbedPanel when redisplaying the form? I have a String type
 property for the current tab in my backing bean but I am unsure how to
 use it.

 Torsten

 -
 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]



Struts2 Dynamic Checkboxes

2007-05-23 Thread Torsten Römer
I guess this is a quite common issue but I seem to only find
solutions/examples for Struts1:

I have a varying number of checkboxes on a form and would like to
somehow get a list of the selected checkboxes or a map and of course it
would be nice if the checkboxes would remember their state...

Any suggestions welcome!

Torsten

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



Re: Struts2 Dynamic Checkboxes

2007-05-23 Thread Torsten Römer
It sure does and I already looked at it, but I was trying to create
single checkboxes in an s:iterator in order to be able to put them in
a custom layout.

I kind of have the same problem with radiobuttons so I guess I should
reconsider my design so I can use the default markup and thus the tags
as they are supposed to be used...

I see there is no point in what I am trying to do.

Thanks!

Torsten

Dave Newton wrote:
 --- Torsten Römer [EMAIL PROTECTED] wrote:
 I have a varying number of checkboxes on a form and
 would like to somehow get a list of the selected 
 checkboxes or a map and of course it would be nice
 if
 the checkboxes would remember their state...
 
 http://struts.apache.org/2.x/docs/checkboxlist.html
 
 Does that meet your needs?
 
 d.
 
 
 

 Building
  a website is a piece of cake. Yahoo! Small Business gives you all the tools 
 to get online.
 http://smallbusiness.yahoo.com/webhosting 
 
 -
 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: Struts2 Dynamic Checkboxes

2007-05-23 Thread Torsten Römer
Well, why not try both ways... it will be a good exercise no matter what.

I'll get back when I have some interesting experiences to share with.

Thanks again!

Torsten

Dave Newton schrieb:
 --- Torsten Römer [EMAIL PROTECTED] wrote:
 I see there is no point in what I am trying to do.
 
 Oh, I don't know about that.
 
 You could use a map (or list) for the checkbox values
 and gather up the result values that way, couldn't
 you? 
 
 You just need to pre-populate the map (or list) in the
 action before hitting the view.
 
 d.
 
 
 

 Be
  a better Globetrotter. Get better travel answers from someone who knows. 
 Yahoo! Answers - Check it out.
 http://answers.yahoo.com/dir/?link=listsid=396545469
 
 -
 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: Serious memory leak

2007-05-22 Thread Torsten Römer
You could also try to run jmap -histo PID when you get the
OutOfMemoryError; you'll probably see the same as in the NetBeans
profiler but maybe it helps to reveal the memory eater anyway.

Torsten

Balazs Michnay wrote:
 Hi,
 
 I have just downloaded NetBeans Profiler to see how my web-app performs and 
 realized that it produces serious memory leaks... The interesting part is 
 that I have nothing on my JSP but static struts tags (no dynamic content at 
 all) and it turned out that the leaks are not made by my application, but 
 made by either struts (???) or Tomcat (???) or Java itself, I don't know 
 what...
 What I discovered was that a simple page reload leads to eating up my memory 
 and - according to the profiler - the memory leak is produced by the 
 constructor of java.util.zip.InflaterInputStream allocating more and more 
 byte[] objects that cannot be garbage-collected. This class deals with 
 reading jar files. If I take a look at the source code I can clearly see that 
 it really allocates memory for byte[]:
 
 public InflaterInputStream(InputStream in, Inflater inf, int size) {
 super(in);
 if (in == null || inf == null) {
 throw new NullPointerException();
 } else if (size = 0) {
 throw new IllegalArgumentException(buffer size = 0);
 }
 this.inf = inf;
 buf = new byte[size];
 }
 
 After browsing through about 80-100 pages I get an OutOfMemory error...
 
 Interesting, huh?
 
 Where should I ask this? On a Java list? Or does this have anything to do 
 with Struts (probably not...)?
 Any ideas why this happens are welcome...
 
 Regards,
 
 BM
 
 
 

 Be
  a better Globetrotter. Get better travel answers from someone who knows. 
 Yahoo! Answers - Check it out.
 http://answers.yahoo.com/dir/?link=listsid=396545469

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



Disable label re-select tab

2007-05-22 Thread Torsten Römer
I have 2 beginners questions that I can't seem to figure out:

- How can I make tags like s:radio not to create any label and create
my own label (using for example the s:label tag)?

- What is the easiest way to re-select the selected tab of a
s:tabbedPanel when redisplaying the form? I have a String type
property for the current tab in my backing bean but I am unsure how to
use it.

Torsten

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



Re: Disable label re-select tab

2007-05-22 Thread Torsten Römer
Thanks, Musachy, for the quick answer.

I should have mentioned, that I already set theme=simple but s:radio
would still create a label:

s:radio theme=simple name=car list={'BMW M5'}/

yields:

input type=radio name=car id=reservation_carBMW M5 value=BMW
M5/label for=reservation_carBMW M5BMW M5/label

What I am actually trying to do is to create single radiobuttons in a
s:iterator loop. Sounds crazy I know, but I need to place the
radiobuttons in a specific layout so I can't use standard markup.

All works fine, I just can't get rid of the labels :-(

Torsten

Musachy Barroso schrieb:
 To select the tab, use the selectedTab attribute on tabbedPannel. For
 your
 label question check this FAQ:
 
 http://cwiki.apache.org/WW/why-do-the-form-tags-put-table-tags-around-controls.html
 
 
 musachy
 
 On 5/22/07, Torsten Römer [EMAIL PROTECTED] wrote:

 I have 2 beginners questions that I can't seem to figure out:

 - How can I make tags like s:radio not to create any label and create
 my own label (using for example the s:label tag)?

 - What is the easiest way to re-select the selected tab of a
 s:tabbedPanel when redisplaying the form? I have a String type
 property for the current tab in my backing bean but I am unsure how to
 use it.

 Torsten

 -
 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: Preparable interface getLocale(

2007-05-14 Thread Torsten Römer
Alright, thanks! I should have a look at that interceptor stack stuff
anyway, seems to be very powerful!

Torsten

Musachy Barroso schrieb:
 Yep, Dave is right. I can't think of any reason why the i18 interceptor
 wouldn't be first, but hey, it is friday! Anyway, as a workaround you can
 make your own interceptor stack.
 
 musachy
 
 On 5/11/07, Dave Newton [EMAIL PROTECTED] wrote:

 --- Torsten Römer [EMAIL PROTECTED] wrote:
  I noticed that when calling getLocale() from
  prepare(), it seems to return the system default
  locale instead of the locale set by the
  request_locale request parameter, which is the case
  when calling it from execute().
 
  Is that supposed to be like that or could this be a
  bug?

 I believe the default interceptor stack has prepare
 running before i18n.

 d.




 Give

 spam the boot. Take control with tough spam protection in the all-new
 Yahoo!
 Mail Beta.
 http://advision.webevents.yahoo.com/mailbeta/newmail_html.html

 -
 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]



Preparable interface getLocale()

2007-05-11 Thread Torsten Römer
I noticed that when calling getLocale() from prepare(), it seems to
return the system default locale instead of the locale set by the
request_locale request parameter, which is the case when calling it from
execute().

Is that supposed to be like that or could this be a bug?

I think the correct locale is needed also in prepare() in order to
populate controls with internationalized content. As a workaround I get
the locale directly from the request_locale parameter.

Torsten

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



Re: Problems getting started with Tiles2/S2

2007-05-11 Thread Torsten Römer
Some time ago when I started with Struts2+Tiles2 I made a simple blank
Struts2+Tiles2 webapp based on the struts2-blank-2.0.6 webapp. It
includes a Tiles2 configuration and a layout with some simple pages, and
hopefully all required JARs.

It is maybe not the perfect example but if you think it could be useful
you can download it here: http://luniks.net/struts2-tiles-blank.zip

Torsten

Rick Schumeyer wrote:
 I'm trying to follow the directions at
   http://struts.apache.org/2.x/docs/tiles-plugin.html
 but with no success.  At the moment, I am only trying to get the app
 running with tiles configured...I'm not actually using tiles yet!
 
 I get this error:
 SEVERE: Exception sending context initialized event to listener instance
 of class org.apache.struts2.tiles.StrutsTilesListener
 java.lang.NoClassDefFoundError: org/apache/commons/digester/Digester
 
 Any ideas?
 
 This is what I have done so far:
 
 1) I don't understand step 1 in the web page...I'm not using maven...do
 I need to put something somewhere or not?
 
 2) I put the contents for step 2 in my web.xml
 
 listener
  listener-classorg.apache.struts2.tiles.StrutsTilesListener/listener-class
 
 /listener
 
 3) I put the contents for step 3 in example.xml (I am using the struts
 blank application)
 
 result-types
 result-type name=tiles
 class=org.apache.struts2.views.tiles.TilesResult /
 /result-types
 
 
 4) I copied the three tiles jars into my project
 (struts2-tiles-plugin-2.0, tiles-api-2.0, tiles-core-2.0)
 The directions only mention the plugin...wouldn't I need all of them?
 
 5) I try to run the blank app and get the error.
 
 -
 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]



Good Practice for prepopulating forms?

2007-05-09 Thread Torsten Römer
I would like to hear what is good practice for prepopulating forms.

For example, I want to create a Map with options to populate a select
with, and this needs to be done before validation but also after failed
validation before the form is redisplayed.

Right now I am creating the map in the constructor of the action class
but I wonder how to handle possible errors here, for example when a
required database connection fails.

Is there a method similar to execute() that I could overwrite which is
called before validation? I tried to overwrite input() which works fine
when the form is initially displayed but input() does not seem to be
called after validation failed and the form is redisplayed.

Or should I just store the map in the session and reuse it for
subsequent requests?

Or can/should I change the scope of the action to session?

Sorry for these beginner's questions but I would like to do it the right
way from the start :-)

Torsten

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



Re: [S2] Can't make validation work

2007-05-09 Thread Torsten Römer
I just called my validation file ActionClassName-validation.xml, don't
even know what this alias is... and validation seems to work fine.

As far as I recall (can't check it right now) I did not have to set
validate=true for my form.
I am also using the ajax theme but I set it using the s:head tag,
while I set the theme of the form to simple. This is because I just want
the datetimepicker to work, but I don't want the s:form to create
markup because I want to create it manually.
This means also that validation errors are not displayed next to the
respective field but I use the s:fielderror tag instead, it creates an
 unordered list with all validation error messages.

Hope this helps you a little.

Torsten

Olivier THIERRY wrote:
 OK, it works now. Not perfectly, but it works.
 
 Actually I had to name my validation file
 CreerDmandeAbsenceAction-submitCreerDemandeAbsence-validation.xml,
 beginning
 with an uppercase letter. Then I put this file in my action package as you
 said. But it worked only when I set the validate attribute of my form to
 true in the JSP ... When I set this attribute to false, the validation
 doesn't work at all. Maybe it's because I use Ajax theme ?
 But I still have problems, when i submit my form :
 - I have a Javascript popup for each datetimepicker in my form (message :
 TypeError: row.cells has no properties)
 - There is no validation on radio buttons ...
 - When I submit my form a second time, the errors list is not reseted, so
 the remaining errors are displayed twice ...
 - The label for required fields turns to red ... but only for text fields
 and selects, but not for datetimepickers, radio buttons or textareas ...
 
 Moreover, is there a way to group the error messages on top of the form,
 and
 not besides each field (I know it was the default behaviour with Struts 1
 but can't find how to do it with Struts 2).
 
 Thanks for your help ;)
 
 Olivier
 
 2007/5/9, Guillaume Carré [EMAIL PROTECTED]:

 2007/5/9, Olivier THIERRY [EMAIL PROTECTED]:
  Well, it still doesn't work :(
  A few questions :
  - Do I have to put the xxx-validation.xml files in a specific directory
 ? I
  put them in the WEB-INF/classes directory ...

 you have to put it in the same package than your action

  - And has the first part of the validation xml file to be the action
 name
  (name attribute in struts.xml file) or the action class name ? I didn't
 find
  it clear in the documentation ...

 your validation file needs to have the following name:
 ActionName-alias-validation.xml

 in your example:
 creerDemandeAbsenceAction-submitCreerDemandeAbsence-validation.xml
 -- 
 Guillaume Carré

 -
 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: Correct usage of datetimepicker?

2007-05-09 Thread Torsten Römer
Great, that was quickly fixed :-)

I'm looking forward to 2.1.0!

Thanks!

Torsten

Musachy Barroso wrote:
 I found several problem with the datetimepicker, first (and the worst) is
 that the names of the input fields (visible and hidden) were switched.
 Second, the hidden field was storing just the date section of the RFC 3339
 format. In short, in the few cases that it worked it was because Xwork
 tries
 as a hard as possible to parse dates, using different formats.
 
 thanks
 musachy
 
 On 5/8/07, Torsten Römer [EMAIL PROTECTED] wrote:

 Done! (WW-1917)

 Hope this is useful, if I can help out in any other way please let me
 know!

 BTW there is no such locale en_UK, it should be en_GB, but unfortunately
 that wasn't the problem.

 Torsten

 Musachy Barroso schrieb:
  Can you log a jira ticket with the details on how to reproduce the
 problem?
 
  https://issues.apache.org/struts/
 
  thanks
  musachy
 
  On 5/8/07, Torsten Römer [EMAIL PROTECTED] wrote:
 
  Yes I did, and I also get that far; the datepicker shows up fine, and
 it
  inserts the picked date in the field in the format I specified using
  displayFormat - but when I submit the form I get that validation
 error.
 
  So I am still using String instead of Date and I'm currently trying to
  get the entered date validated. When this works I am already quite
 happy.
 
  The problem that occurs in case the user has JavaScript disabled I am
  BTW working around by placing an additional textfield with the same
 name
  in a noscript tag. Like this the user can at least enter a date
  manually.
 
  Torsten
 
  Musachy Barroso schrieb:
   Did you look at the examples in showcase? I know the timepicker was
  really
   broken on 2.0.6, but the datepicker was working.
  
   musachy
  
   On 5/8/07, Torsten Römer [EMAIL PROTECTED] wrote:
  
   I didn't have any struts.date.format set in my .properties files,
 but
   for testing I set it to -MM-dd in all of them but that doesn't
  seem
   to have any effect. The date is still shown in dd.MM.yy format, and
 I
   get that validation error when request_locale=en_UK.
  
   Then I also set displayFormat to -MM-dd but like this I always
 get
  a
   validation error.
  
   If I try to set saveFormat I get an exception:
   SCHWERWIEGEND: Servlet.service() for servlet jsp threw exception
   org.apache.jasper.JasperException: /page/reservation.jsp(15,1)
  Attribute
   saveFormat invalid for tag datetimepicker according to TLD
  
   The only way how I can get it to work is to use strings and parse
 the
   date myself in the action class. But like this, no validation is
 done
  at
   all.
  
   It's a pity because the datetimepicker would be extremely easy to
  use 
   it looks really nice but it doesn't seem to like me ;-)
  
   Torsten
  
   Martin Gainty schrieb:
please display contents of struts.date.format
for both *en_UK.properties and
*de_DE.properties files
   
Martin--
This email message and any files transmitted with it contain
   confidential
information intended only for the person(s) to whom this email
  message
   is
addressed.  If you have received this email message in error,
 please
   notify
the sender immediately by telephone or email and destroy the
  original
message without making a copy.  Thank you.
   
- Original Message - From: Musachy Barroso
   [EMAIL PROTECTED]
To: Struts Users Mailing List user@struts.apache.org
Sent: Monday, May 07, 2007 8:05 PM
Subject: Re: Correct usage of datetimepicker?
   
   
Using Date for the action field is the way to go. The selected
 value
  is
submited in RFC 3339 format (that can me modified using the
  saveFormat
attribute, which shouldn't have been public on the first place).
 I'm
   not
really sure how it would work if the client has javascript
 disabled.
   
musachy
   
On 5/7/07, Torsten Römer [EMAIL PROTECTED] wrote:
   
I'm a bit unsure about a few things around datetimepicker.
   
What type should the fields in my action class be? I am
 currently
   using
java.util.Date, it works fine for request_locale=de_DE but I get
 a
Invalid field value for field ... error for
 request_locale=en_UK
  and
the date redisplayed is NaN.NaN.aN. I don't quite understand
  this,
because the API doc says: The value sent to the server is
  typically
  a
locale-independent value in a hidden field as defined by the
 name
attribute - but it seems the locale matters anyway?
   
What also confuses me, is the displayFormat attribute. If I set
 it
  to
e.g. -MM-dd, I always get the Invalid field value for
 field
   ...
error, regardless of the request_locale.
I am also a bit unsure about the format and saveFormat
  attributes. I
played with them, but they did not seem to make any difference.
   
I also wonder how to handle the situation where a user has
  Javascript
disabled, in which case the date field + icon are not shown

Re: [S2] A bug in documentation for validation

2007-05-09 Thread Torsten Römer
Did you also have a look at this one:

http://struts.apache.org/2.x/docs/validating-input.html

It helped me quite a bit.

Torsten

Olivier THIERRY wrote:
 Hi,
 
 I'm not sure this is the right mailing list to talk about it, but I think
 there is a bug in the validation documentation on the struts website.
 When I open this url :
 
 http://struts.apache.org/2.0.6/docs/basic-validation.html
 
 There's an error in the step 3 so you can't see the end of the page ...
 It's the same on every pages in the documentation for validation.
 
 A bit annoying when you try to understand how to validate with Struts 2 :(
 
 Thanks in advance
 
 Olivier
 

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



Re: Good Practice for prepopulating forms?

2007-05-09 Thread Torsten Römer
Thanks, this sure does help...

I must be blind sometimes :-(

Torsten

Musachy Barroso wrote:
 This might help:
 
 http://struts.apache.org/2.0.6/docs/how-do-we-repopulate-controls-when-validation-fails.html
 
 
 musachy
 
 On 5/9/07, Torsten Römer [EMAIL PROTECTED] wrote:

 I would like to hear what is good practice for prepopulating forms.

 For example, I want to create a Map with options to populate a select
 with, and this needs to be done before validation but also after failed
 validation before the form is redisplayed.

 Right now I am creating the map in the constructor of the action class
 but I wonder how to handle possible errors here, for example when a
 required database connection fails.

 Is there a method similar to execute() that I could overwrite which is
 called before validation? I tried to overwrite input() which works fine
 when the form is initially displayed but input() does not seem to be
 called after validation failed and the form is redisplayed.

 Or should I just store the map in the session and reuse it for
 subsequent requests?

 Or can/should I change the scope of the action to session?

 Sorry for these beginner's questions but I would like to do it the right
 way from the start :-)

 Torsten

 -
 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: Correct usage of datetimepicker?

2007-05-08 Thread Torsten Römer
I didn't have any struts.date.format set in my .properties files, but
for testing I set it to -MM-dd in all of them but that doesn't seem
to have any effect. The date is still shown in dd.MM.yy format, and I
get that validation error when request_locale=en_UK.

Then I also set displayFormat to -MM-dd but like this I always get a
validation error.

If I try to set saveFormat I get an exception:
SCHWERWIEGEND: Servlet.service() for servlet jsp threw exception
org.apache.jasper.JasperException: /page/reservation.jsp(15,1) Attribute
saveFormat invalid for tag datetimepicker according to TLD

The only way how I can get it to work is to use strings and parse the
date myself in the action class. But like this, no validation is done at
all.

It's a pity because the datetimepicker would be extremely easy to use 
it looks really nice but it doesn't seem to like me ;-)

Torsten

Martin Gainty schrieb:
 please display contents of struts.date.format
 for both *en_UK.properties and
 *de_DE.properties files
 
 Martin--
 This email message and any files transmitted with it contain confidential
 information intended only for the person(s) to whom this email message is
 addressed.  If you have received this email message in error, please notify
 the sender immediately by telephone or email and destroy the original
 message without making a copy.  Thank you.
 
 - Original Message - From: Musachy Barroso [EMAIL PROTECTED]
 To: Struts Users Mailing List user@struts.apache.org
 Sent: Monday, May 07, 2007 8:05 PM
 Subject: Re: Correct usage of datetimepicker?
 
 
 Using Date for the action field is the way to go. The selected value is
 submited in RFC 3339 format (that can me modified using the saveFormat
 attribute, which shouldn't have been public on the first place). I'm not
 really sure how it would work if the client has javascript disabled.
 
 musachy
 
 On 5/7/07, Torsten Römer [EMAIL PROTECTED] wrote:

 I'm a bit unsure about a few things around datetimepicker.

 What type should the fields in my action class be? I am currently using
 java.util.Date, it works fine for request_locale=de_DE but I get a
 Invalid field value for field ... error for request_locale=en_UK and
 the date redisplayed is NaN.NaN.aN. I don't quite understand this,
 because the API doc says: The value sent to the server is typically a
 locale-independent value in a hidden field as defined by the name
 attribute - but it seems the locale matters anyway?

 What also confuses me, is the displayFormat attribute. If I set it to
 e.g. -MM-dd, I always get the Invalid field value for field ...
 error, regardless of the request_locale.
 I am also a bit unsure about the format and saveFormat attributes. I
 played with them, but they did not seem to make any difference.

 I also wonder how to handle the situation where a user has Javascript
 disabled, in which case the date field + icon are not shown at all.

 I am using Struts2 2.0.6.

 Torsten

 -
 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: Correct usage of datetimepicker?

2007-05-08 Thread Torsten Römer
Yes I did, and I also get that far; the datepicker shows up fine, and it
inserts the picked date in the field in the format I specified using
displayFormat - but when I submit the form I get that validation error.

So I am still using String instead of Date and I'm currently trying to
get the entered date validated. When this works I am already quite happy.

The problem that occurs in case the user has JavaScript disabled I am
BTW working around by placing an additional textfield with the same name
in a noscript tag. Like this the user can at least enter a date manually.

Torsten

Musachy Barroso schrieb:
 Did you look at the examples in showcase? I know the timepicker was really
 broken on 2.0.6, but the datepicker was working.
 
 musachy
 
 On 5/8/07, Torsten Römer [EMAIL PROTECTED] wrote:

 I didn't have any struts.date.format set in my .properties files, but
 for testing I set it to -MM-dd in all of them but that doesn't seem
 to have any effect. The date is still shown in dd.MM.yy format, and I
 get that validation error when request_locale=en_UK.

 Then I also set displayFormat to -MM-dd but like this I always get a
 validation error.

 If I try to set saveFormat I get an exception:
 SCHWERWIEGEND: Servlet.service() for servlet jsp threw exception
 org.apache.jasper.JasperException: /page/reservation.jsp(15,1) Attribute
 saveFormat invalid for tag datetimepicker according to TLD

 The only way how I can get it to work is to use strings and parse the
 date myself in the action class. But like this, no validation is done at
 all.

 It's a pity because the datetimepicker would be extremely easy to use 
 it looks really nice but it doesn't seem to like me ;-)

 Torsten

 Martin Gainty schrieb:
  please display contents of struts.date.format
  for both *en_UK.properties and
  *de_DE.properties files
 
  Martin--
  This email message and any files transmitted with it contain
 confidential
  information intended only for the person(s) to whom this email message
 is
  addressed.  If you have received this email message in error, please
 notify
  the sender immediately by telephone or email and destroy the original
  message without making a copy.  Thank you.
 
  - Original Message - From: Musachy Barroso
 [EMAIL PROTECTED]
  To: Struts Users Mailing List user@struts.apache.org
  Sent: Monday, May 07, 2007 8:05 PM
  Subject: Re: Correct usage of datetimepicker?
 
 
  Using Date for the action field is the way to go. The selected value is
  submited in RFC 3339 format (that can me modified using the saveFormat
  attribute, which shouldn't have been public on the first place). I'm
 not
  really sure how it would work if the client has javascript disabled.
 
  musachy
 
  On 5/7/07, Torsten Römer [EMAIL PROTECTED] wrote:
 
  I'm a bit unsure about a few things around datetimepicker.
 
  What type should the fields in my action class be? I am currently
 using
  java.util.Date, it works fine for request_locale=de_DE but I get a
  Invalid field value for field ... error for request_locale=en_UK and
  the date redisplayed is NaN.NaN.aN. I don't quite understand this,
  because the API doc says: The value sent to the server is typically a
  locale-independent value in a hidden field as defined by the name
  attribute - but it seems the locale matters anyway?
 
  What also confuses me, is the displayFormat attribute. If I set it to
  e.g. -MM-dd, I always get the Invalid field value for field
 ...
  error, regardless of the request_locale.
  I am also a bit unsure about the format and saveFormat attributes. I
  played with them, but they did not seem to make any difference.
 
  I also wonder how to handle the situation where a user has Javascript
  disabled, in which case the date field + icon are not shown at all.
 
  I am using Struts2 2.0.6.
 
  Torsten
 
  -
  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: Correct usage of datetimepicker?

2007-05-08 Thread Torsten Römer
Done! (WW-1917)

Hope this is useful, if I can help out in any other way please let me know!

BTW there is no such locale en_UK, it should be en_GB, but unfortunately
that wasn't the problem.

Torsten

Musachy Barroso schrieb:
 Can you log a jira ticket with the details on how to reproduce the problem?
 
 https://issues.apache.org/struts/
 
 thanks
 musachy
 
 On 5/8/07, Torsten Römer [EMAIL PROTECTED] wrote:

 Yes I did, and I also get that far; the datepicker shows up fine, and it
 inserts the picked date in the field in the format I specified using
 displayFormat - but when I submit the form I get that validation error.

 So I am still using String instead of Date and I'm currently trying to
 get the entered date validated. When this works I am already quite happy.

 The problem that occurs in case the user has JavaScript disabled I am
 BTW working around by placing an additional textfield with the same name
 in a noscript tag. Like this the user can at least enter a date
 manually.

 Torsten

 Musachy Barroso schrieb:
  Did you look at the examples in showcase? I know the timepicker was
 really
  broken on 2.0.6, but the datepicker was working.
 
  musachy
 
  On 5/8/07, Torsten Römer [EMAIL PROTECTED] wrote:
 
  I didn't have any struts.date.format set in my .properties files, but
  for testing I set it to -MM-dd in all of them but that doesn't
 seem
  to have any effect. The date is still shown in dd.MM.yy format, and I
  get that validation error when request_locale=en_UK.
 
  Then I also set displayFormat to -MM-dd but like this I always get
 a
  validation error.
 
  If I try to set saveFormat I get an exception:
  SCHWERWIEGEND: Servlet.service() for servlet jsp threw exception
  org.apache.jasper.JasperException: /page/reservation.jsp(15,1)
 Attribute
  saveFormat invalid for tag datetimepicker according to TLD
 
  The only way how I can get it to work is to use strings and parse the
  date myself in the action class. But like this, no validation is done
 at
  all.
 
  It's a pity because the datetimepicker would be extremely easy to
 use 
  it looks really nice but it doesn't seem to like me ;-)
 
  Torsten
 
  Martin Gainty schrieb:
   please display contents of struts.date.format
   for both *en_UK.properties and
   *de_DE.properties files
  
   Martin--
   This email message and any files transmitted with it contain
  confidential
   information intended only for the person(s) to whom this email
 message
  is
   addressed.  If you have received this email message in error, please
  notify
   the sender immediately by telephone or email and destroy the
 original
   message without making a copy.  Thank you.
  
   - Original Message - From: Musachy Barroso
  [EMAIL PROTECTED]
   To: Struts Users Mailing List user@struts.apache.org
   Sent: Monday, May 07, 2007 8:05 PM
   Subject: Re: Correct usage of datetimepicker?
  
  
   Using Date for the action field is the way to go. The selected value
 is
   submited in RFC 3339 format (that can me modified using the
 saveFormat
   attribute, which shouldn't have been public on the first place). I'm
  not
   really sure how it would work if the client has javascript disabled.
  
   musachy
  
   On 5/7/07, Torsten Römer [EMAIL PROTECTED] wrote:
  
   I'm a bit unsure about a few things around datetimepicker.
  
   What type should the fields in my action class be? I am currently
  using
   java.util.Date, it works fine for request_locale=de_DE but I get a
   Invalid field value for field ... error for request_locale=en_UK
 and
   the date redisplayed is NaN.NaN.aN. I don't quite understand
 this,
   because the API doc says: The value sent to the server is
 typically
 a
   locale-independent value in a hidden field as defined by the name
   attribute - but it seems the locale matters anyway?
  
   What also confuses me, is the displayFormat attribute. If I set it
 to
   e.g. -MM-dd, I always get the Invalid field value for field
  ...
   error, regardless of the request_locale.
   I am also a bit unsure about the format and saveFormat
 attributes. I
   played with them, but they did not seem to make any difference.
  
   I also wonder how to handle the situation where a user has
 Javascript
   disabled, in which case the date field + icon are not shown at all.
  
   I am using Struts2 2.0.6.
  
   Torsten
  
  
 -
   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

Correct usage of datetimepicker?

2007-05-07 Thread Torsten Römer
I'm a bit unsure about a few things around datetimepicker.

What type should the fields in my action class be? I am currently using
java.util.Date, it works fine for request_locale=de_DE but I get a
Invalid field value for field ... error for request_locale=en_UK and
the date redisplayed is NaN.NaN.aN. I don't quite understand this,
because the API doc says: The value sent to the server is typically a
locale-independent value in a hidden field as defined by the name
attribute - but it seems the locale matters anyway?

What also confuses me, is the displayFormat attribute. If I set it to
e.g. -MM-dd, I always get the Invalid field value for field ...
error, regardless of the request_locale.
I am also a bit unsure about the format and saveFormat attributes. I
played with them, but they did not seem to make any difference.

I also wonder how to handle the situation where a user has Javascript
disabled, in which case the date field + icon are not shown at all.

I am using Struts2 2.0.6.

Torsten

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



Re: Struts2, Tiles2 and Container Managed Security

2007-04-19 Thread Torsten Römer
I still haven't got this to work and I am starting to wonder: Am I too
dumb or is it at all possible to refer to an action or a Tiles
definition in form-login-config?

In Struts1 apps I can put a .do action in there - what is the difference
to Struts2? Is it the S1 ActionServlet vs. the S2 filter?

Torsten

Torsten Römer schrieb:
 I am trying to use Container managed security with Struts2 and Tiles2.
 
 I created a Tiles definition called loginTiles for the login page, and
 in my package called page with namespace /page, I have the following
 action:
 
 action name=* 
   result type=tiles{1}Tiles/result
 /action
 
 I am using this action as form-login-page and form-error-page in
 web.xml:
 
 form-login-config
   form-login-page/page/login.action/form-login-page
   form-error-page/page/login.action/form-error-page
 /form-login-config
 
 Now, when I try to access some protected resource, the Container managed
 security is requesting the right action, but I get a HTTP 404 error.
 If I request the same action direcly from the browser, the login page
 comes up fine.
 
 As far as I understand, Container managed security is applied before the
 struts2 filter, so when it requests the form-login-page, the filter
 should resolve it, right?
 
 Probably I got this wrong? How can I solve this?
 
 Torsten
 
 -
 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]



Struts2, Tiles2 and Container Managed Security

2007-04-16 Thread Torsten Römer
I am trying to use Container managed security with Struts2 and Tiles2.

I created a Tiles definition called loginTiles for the login page, and
in my package called page with namespace /page, I have the following
action:

action name=* 
  result type=tiles{1}Tiles/result
/action

I am using this action as form-login-page and form-error-page in
web.xml:

form-login-config
  form-login-page/page/login.action/form-login-page
  form-error-page/page/login.action/form-error-page
/form-login-config

Now, when I try to access some protected resource, the Container managed
security is requesting the right action, but I get a HTTP 404 error.
If I request the same action direcly from the browser, the login page
comes up fine.

As far as I understand, Container managed security is applied before the
struts2 filter, so when it requests the form-login-page, the filter
should resolve it, right?

Probably I got this wrong? How can I solve this?

Torsten

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



Re: Wrong Content Type text/plain

2007-04-12 Thread Torsten Römer
Thanks Teemu,

You provided the hint that solved the problem!

Because I was too lazy to check how to use the Tiles servlet I tried to use

org.apache.tiles.listener.TilesListener

instead of

org.apache.struts2.tiles.StrutsTilesListener

and already like that it works.

However the documentation states that The latter [StrutsTilesListener]
provides tighter integration with Struts features such as freemarker
integration. so I wonder if this applies to the Tiles servlet as well
and if it would be better to use it instead of the TilesListener?

Torsten


Teemu Tapper wrote:
 hello,
 we had a similar problem and we solved it by using Tiles servlet instead of
 Tiles listener.
 
 Cheers,
 Teemu
 
 
 Torsten Römer wrote:
 I added Tiles to the struts2-blank-2.0.6 example webapp and started to
 work on my application. All works just fine on my Linux/Tomcat 5.5
 development box but when I deploy the app to the provider's Linux/Tomcat
 5.5 webspace the content type is suddenly text/plain instead of
 text/html and all I see is the HTML source.

 The funny thing is, that when an action is executed through

 s:action namespace=/test name=home executeResult=true/s:action

 the content type is text/html and the page displays correctly, but when
 the same action is executed through

  s:url action= Home 

 the above described problem occurs.

 Setting something like %@ page language=java contentType=text/html;
 charset=ISO-8859-1 % in the Tiles template and even the subpages seems
 to be ignored.

 Calling a JSP directly works fine.


 

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



Re: Wrong Content Type text/plain

2007-04-12 Thread Torsten Römer

Antonio Petrelli wrote:
 2007/4/12, Torsten Römer [EMAIL PROTECTED]:
 However the documentation states that The latter [StrutsTilesListener]
 provides tighter integration with Struts features such as freemarker
 integration. so I wonder if this applies to the Tiles servlet as well
 and if it would be better to use it instead of the TilesListener?
 
 I think that this problem is solved in the Tiles SVN repository. The
 problem is that Struts 2 depends on a buggy version of Tiles 2 (yuk!).
 Do not try to replace a new build of Tiles 2 since it won't work, so
 maybe you have to wait until Tiles 2 is released and the integration
 with Struts 2 stabilizes.
 

I'll gladly wait. I'm already happy that it works now, and I am glad I
tried Struts2 after making two minor webapps with
JSF/MyFaces/Tomahawk/Tiles - maybe a cumbersome combination, but I think
Tiles is just too cool not to use it - because I feel much more
comfortable with Struts2; it seems much more intuitive, the
documentation is much better and the links to the example webapps
actually work. I consider some good Getting Started docs and a working
example app very important, as I think many beginners will give up in
frustration when they haven't got anything to work after an hour or so...

Sorry for being off-topic but I just felt like showing some appreciation
for Struts2 :-)

Torsten

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



[OT] Mascot?

2007-04-12 Thread Torsten Römer
OK, maybe I have been working too much and now I had some beer... came
to think that so many great OSS products have mascots... and in Swedish
a Struts is an Ostrich (Struthio camelus), and an Ostrich's legs  neck
look like struts, don't you agree? ;-)

http://www.wildanimalsonline.com/birds/ostrich-struthiocamelus.jpg

Maybe some artistically gifted user here could design some cool Struts
mascot in the style of the Linux penguin or so...

There actually is a logo contest:
http://www.ninsky.com/struts/logo/entries.do

And a related thread:
http://www.mail-archive.com/[EMAIL PROTECTED]/thrd50.html#11232

Torsten

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



Wrong Content Type text/plain

2007-04-11 Thread Torsten Römer
I added Tiles to the struts2-blank-2.0.6 example webapp and started to
work on my application. All works just fine on my Linux/Tomcat 5.5
development box but when I deploy the app to the provider's Linux/Tomcat
5.5 webspace the content type is suddenly text/plain instead of
text/html and all I see is the HTML source.

The funny thing is, that when an action is executed through

s:action namespace=/test name=home executeResult=true/s:action

the content type is text/html and the page displays correctly, but when
the same action is executed through

a href=s:url action=home/Home/a

the above described problem occurs.

Setting something like %@ page language=java contentType=text/html;
charset=ISO-8859-1 % in the Tiles template and even the subpages seems
to be ignored.

Calling a JSP directly works fine.

There is a Struts1 + Tiles webapp running just fine on the same webspace.

I spent some hours googling but I could not find any solution. Does
anyone have an idea what is going on and what might be the difference
between my development machine and the provider's server could cause
this problem?

Torsten

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



Re: Tiles 2 woes

2007-04-11 Thread Torsten Römer
I was recently doing the same and what gave me a headache was that even
though my IDE complains about it, it has to be

definition name=errorTiles extends=homeTiles
put name=body value=/test/error.jsp/
/definition

rather than

definition name=errorTiles extends=homeTiles
put-attribute name=body value=/test/error.jsp/
/definition

which gave me a

11-Apr-2007 17:42:15 org.apache.tiles.impl.BasicTilesContainer render
SEVERE: Error rendering tile

So maybe it's that or something similar?

Torsten


[EMAIL PROTECTED] wrote:
 I'm trying to migrate a S1 web app to S2.  Most things are working with the
 exception of Tiles.  Here is the list of things I did in case someone might
 detect a glitch;
 
 
   1. Had to download commons-digester-1.8.jar because it was not
   included in \struts-2.0.6\lib
   2. Added the three struts tiles jars to my project (plugin, core, api)
   3. Added org.apache.struts2.tiles.StrutsTilesListener to web.xml
   4. Modified struts package to extend tiles-default
   5. Copied my tiles.xml
   6. Copied my jsp files
 
 When I make an HTTPRequest to my  struts action it correctly makes the
 request of the result type tiles but I receive the following error:
 
 08:58:33,459 ERROR BasicTilesContainer:401 - Error rendering tile
 
 I have double checked all the names and file locations and this message
 doesn't give me much to go by!  After reviewing
 http://struts.apache.org/2.x/docs/tiles-plugin.html it appears the tiles
 tag
 names have been changed so I updated them accordingly.  Any clues before I
 jump?
 

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



Re: Tiles 2 woes

2007-04-11 Thread Torsten Römer
This one works for me:

http://tiles.apache.org/tags-tiles

Torsten


[EMAIL PROTECTED] schrieb:
 I'm starting to realize this!  I had a nice S1 Tiles application just die
 under S2 tiles.  Should the taglib be:
 
 http://struts.apache.org/tags-tiles or http://tiles.apache.org/tags-tiles
 
 Also what supersedes the controllerClass tag?
 
 Scott
 

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