Re: s:if test condition

2010-06-27 Thread Bill Bohnenberger
Yes, that is why I said Since 'activated' is a String,...

On Sun, Jun 27, 2010 at 3:47 PM, Dale Newfield d...@newfield.org wrote:

 lucas owen wrote:

 Bill Bohnenbergerbill98...@gmail.com

 Since 'activated' is a String, try swapping your single  double quotes,
 e.g. s:if test='%{warning.activated==Y}'

 
  that was it!!!

 The key is understanding *why* it makes a difference.

 The reason is that a single character demarcated by single quotes is not a
 String, it is a character.  The character 'Y' is not equal to the String
 Y.


 http://struts.apache.org/2.1.8.1/docs/why-wont-the-if-tag-evaluate-a-one-char-string.html

 -Dale

 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org




Re: s:if test condition

2010-06-26 Thread Bill Bohnenberger
Since 'activated' is a String, try swapping your single  double quotes,
e.g.
s:if test='%{warning.activated==Y}'

-Bill

On Sat, Jun 26, 2010 at 11:28 AM, lucas owen sr.ilus...@gmail.com wrote:

 Hi Struts 2 users:

 I was wondering if you can use a s:if test based on a pojo's
 attribute value:

 POJO:

 public class Warning{

 String text;
 String activated; // Y or N

 }

 JSP:

 s:if test=*%{warning==null}*

 -- *Warning* null!

 /s:if

 s:else

 -- *Warning* not null!

 -- Activated: s:property value=*warning.activated*/

 s:if test=*warning.activated == 'Y' *

 -- *Warning* *activated*.

 /s:if

 s:else

 -- *Warning* *deactivated*.

 /s:else

 /s:else

 The first test (check null value) works OK, but the second always goes
 through the else part.

 I have tried test=*%{warning.activated == 'Y' } and
 *test=*%{#warning.activated
 == 'Y' } *too but it doesnt work either.

 I dont know what is wrong, s:property value=*warning.activated*/ shows
 the value correctly...



 I know I can use an auxiliar boolean variable depending on the value Y/N
 but
 I would like to know why it doesnt work this way.

 THANKS IN ADVANCE



version conflict?

2010-02-19 Thread Bill Bohnenberger
Struts 2 documentaion at *
http://struts.apache.org/2.x/docs/building-the-framework-from-source.html*
implies (at the bottom of the page) that only java 1.5 is required. But when
I deploy my app to a tomcat 5.5.27 server using jdk 1.5.0_20, I get the
UnsupportedClassVersionError below. Am I right in believing that this error
is because some struts class file has been compiled with a later java
version?

My webapp uses jar files from struts 2.1.8.1

Tomcat stdout:

Feb 19, 2010 11:32:50 AM org.apache.catalina.core.AprLifecycleListener
lifecycleEvent
INFO: The Apache Tomcat Native library which allows optimal performance in
production environments was not found on the java.library.path: F:\Program
Files\Java\jdk1.5.0_20\bin;.;F:\WINDOWS\system32;F:\WINDOWS;F:\Program
Files\Java\jdk1.5.0_20\jre\bin;F:/Program
Files/Java/jre1.5.0_20/bin/client;F:/Program
Files/Java/jre1.5.0_20/bin;F:\WINDOWS\system32;F:\WINDOWS;F:\WINDOWS\System32\Wbem;F:\Program
Files\Common Files\Roxio Shared\DLLShared\;F:\Program Files\Common
Files\Adobe\AGL;F:\development\thinkmap\apache-ant-1.7.1\bin;F:\development\jdk1.6.0_16\bin;F:\development\mysql\bin;f:\util;F:\Program
Files\QuickTime\QTSystem\;F:\development\sun\sdk\bin;F:\Sun\SDK\bin
Feb 19, 2010 11:32:50 AM org.apache.coyote.http11.Http11BaseProtocol init
INFO: Initializing Coyote HTTP/1.1 on http-9081
Feb 19, 2010 11:32:50 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 875 ms
Feb 19, 2010 11:32:50 AM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Feb 19, 2010 11:32:50 AM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/5.5.27
Feb 19, 2010 11:32:50 AM org.apache.catalina.core.StandardHost start
INFO: XML validation disabled
Feb 19, 2010 11:32:51 AM
com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
INFO: Parsing configuration file [struts-default.xml]
Feb 19, 2010 11:32:51 AM
com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
INFO: Unable to locate configuration files of the name struts-plugin.xml,
skipping
Feb 19, 2010 11:32:51 AM
com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
INFO: Parsing configuration file [struts-plugin.xml]
Feb 19, 2010 11:32:51 AM
com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
INFO: Parsing configuration file [struts.xml]
Feb 19, 2010 11:32:51 AM
com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
INFO: Loading global messages from global-messages
Feb 19, 2010 11:32:52 AM org.apache.catalina.core.StandardContext
filterStart
SEVERE: Exception starting filter struts2
*java.lang.UnsupportedClassVersionError: Bad version number in .class file*
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at
org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1876)
at
org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:889)
at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1353)
at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1232)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2357)
at java.lang.Class.getConstructor0(Class.java:2671)
at java.lang.Class.getConstructor(Class.java:1629)
at
com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.verifyAction(XmlConfigurationProvider.java:403)
at
com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addAction(XmlConfigurationProvider.java:354)
at
com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addPackage(XmlConfigurationProvider.java:468)
at
com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadPackages(XmlConfigurationProvider.java:264)
at
org.apache.struts2.config.StrutsXmlConfigurationProvider.loadPackages(StrutsXmlConfigurationProvider.java:111)
at
com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:193)
at
com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:55)
at
org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:374)
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:418)
at
org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:69)
at
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:51)
at
org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:221)
at
org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:302)
  

Re: struts 2, writing a custom tag that is able to access objects in ActionContext using OGNL

2010-02-01 Thread Bill Bohnenberger
Hi Jake,

I have a custom table tag that needs Value Stack access, too.
Here's how I do it:

package...

import org.apache.struts2.views.jsp.TagUtils;
import org.apache.struts2.util.MakeIterator;

public class TableTag extends SimpleTagSupport
{
private String list;

public void doTag() throws JspException
{
ValueStack stack = TagUtils.getStack((PageContext)getJspContext());
Iterator iterator = MakeIterator.convert(stack.findValue(list));
while (iterator.hasNext())
{
...
}
}

public void setList(String list)
{
this.list = list;
}
}

Of course list is one of my custom tag's attributes and appropriately
defined in my TLD.

Cheers,
Bill


On Mon, Feb 1, 2010 at 5:04 AM, Jake Vang vangj...@googlemail.com wrote:

 i found something helpful here. it works.

 http://struts.apache.org/2.1.8.1/docs/access-to-valuestack-from-jsps.html



 On Mon, Feb 1, 2010 at 7:34 AM, Jake Vang vangj...@googlemail.com wrote:
  i was wondering if it was possible to write a custom tag that is able
  to access objects in the ActionContext using OGNL? i'm not sure if
  this is a correct question.
 
  my problem is that i have a form. the form is posted to an action. the
  action has getters/setters for the form fields. i then forward to
  form-success.jsp. on this page, i can use the struts taglibs to access
  the information posted. for example, s:property value=email/.
  however, if i have a custom tag, how do i access email from the
  ActionContext? for example, customTabLib:showEmail value=email/,
  doesn't work. the tag displays the value, email. i also tried a
  couple of things too that didn't work.
 
  customTagLib:showEmail value=#email/
  customTagLib:showEmail value=%{#email}/
 
  is there a class/interface that i can extend/implement in struts 2
  that would easily help me get the value of email from the
  ActionContext in my custom tag?
 
  thanks.
 

 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org




Re: struts 2, writing a custom tag that is able to access objects in ActionContext using OGNL

2010-02-01 Thread Bill Bohnenberger
Aye, but whoops, I forgot this one :)

import com.opensymphony.xwork2.util.ValueStack;

Cheers,
Bill

On Mon, Feb 1, 2010 at 2:18 PM, Jake Vang vangj...@googlemail.com wrote:

 bill, thanks for including the code (especially the import statements
 so i will know where these objects/classes are coming from).

 On Mon, Feb 1, 2010 at 11:09 AM, Bill Bohnenberger bill98...@gmail.com
 wrote:
  Hi Jake,
 
  I have a custom table tag that needs Value Stack access, too.
  Here's how I do it:
 
  package...
 
  import org.apache.struts2.views.jsp.TagUtils;
  import org.apache.struts2.util.MakeIterator;
 
  public class TableTag extends SimpleTagSupport
  {
 private String list;
 
 public void doTag() throws JspException
 {
 ValueStack stack =
 TagUtils.getStack((PageContext)getJspContext());
 Iterator iterator = MakeIterator.convert(stack.findValue(list));
 while (iterator.hasNext())
 {
 ...
 }
 }
 
 public void setList(String list)
 {
 this.list = list;
 }
  }
 
  Of course list is one of my custom tag's attributes and appropriately
  defined in my TLD.
 
  Cheers,
  Bill
 
 
  On Mon, Feb 1, 2010 at 5:04 AM, Jake Vang vangj...@googlemail.com
 wrote:
 
  i found something helpful here. it works.
 
 
 http://struts.apache.org/2.1.8.1/docs/access-to-valuestack-from-jsps.html
 
 
 
  On Mon, Feb 1, 2010 at 7:34 AM, Jake Vang vangj...@googlemail.com
 wrote:
   i was wondering if it was possible to write a custom tag that is able
   to access objects in the ActionContext using OGNL? i'm not sure if
   this is a correct question.
  
   my problem is that i have a form. the form is posted to an action. the
   action has getters/setters for the form fields. i then forward to
   form-success.jsp. on this page, i can use the struts taglibs to access
   the information posted. for example, s:property value=email/.
   however, if i have a custom tag, how do i access email from the
   ActionContext? for example, customTabLib:showEmail value=email/,
   doesn't work. the tag displays the value, email. i also tried a
   couple of things too that didn't work.
  
   customTagLib:showEmail value=#email/
   customTagLib:showEmail value=%{#email}/
  
   is there a class/interface that i can extend/implement in struts 2
   that would easily help me get the value of email from the
   ActionContext in my custom tag?
  
   thanks.
  
 
  -
  To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
  For additional commands, e-mail: user-h...@struts.apache.org
 
 
 

 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org




Re: Struts, Tomcat, JNDI, JDBC without use of an ORM Library such as Hibernate

2010-01-08 Thread Bill Bohnenberger
Jazz, here's a lightweight package that so far has met all of my needs:
http://butterfly.jenkov.com/ ...

Cheers, Bill*
*
On Thu, Jan 7, 2010 at 4:30 PM, Jasvinder S. Bahra 
bbdl21...@blueyonder.co.uk wrote:

 I'll echo the Spring suggestion.  It simplifies Action-level programming by
 quite a bit.

 On the flip side, it requires some extra XML configuration, but IMO it's a
 good tradeoff.


 Spring seems to be quite popular here.  I'm somewhat reluctant because
 Spring provides a lot more than just Database Injection - and for the time
 being, DI is all I really want.

 If I cant find what I want, I guess i'll have to bite the bullet and jump
 into it.

 Thanks for the response.


 Jazz




 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org




Re: Problem with value attribute in select tag

2009-12-18 Thread Bill Bohnenberger
I do not use the value attribute in my s:select tags  they work fine.

I do always use the headerKey  headerValue attributes though.

Incidentally, the preselected (user-selected) key value is taken (stored)
using the name attribute so in your example your SelectAction should define
bla and provide setter  getter for same.

- Bill

On Fri, Dec 18, 2009 at 8:20 AM, Brian Thompson elephant...@gmail.comwrote:

 I would try

 @s.select name=bla list=list listKey=id listValue=str value=%{
 object.id} /

 -Brian



 On Fri, Dec 18, 2009 at 9:30 AM, Philipp Leusmann 
 philipp.leusm...@rwth-aachen.de wrote:

  Hi,
 
  what exactly does the value-attribute of the select tag require? Is it
 one
  element of the list provided to the list-argument? Or is it the value
 which
  eventually makes the value-attribute of the html-rendered select tag?
 
  I have something like the following and I do not find a way to work as
  expected:
 
  public class SelectAction extends ActionSupport
  {
 private ListTestObject list = new ArrayList();
 
 private TestObject object;
 
 public String execute()
 {
 TestObject to1 = new TestObject(1, foo);
 list.add(to1);
 TestObject to2 = new TestObject(2, bar);
 list.add(to2);
 object = to2;
 }
 
 [getters for the stuff above]
 
  }
 
  public class TestObject
  {
 private Integer id;
 
 private String str;
 
 public TestObject(Integer id, String str)
 {
 this.id = id;
 this.str = str;
 }
 
 [getters]
  }
 
 
 
  And in the template (using Freemarker) I tried:
 
 @s.select name=bla list=list listKey=id listValue=str
  value=object /
 
 @s.select name=bla list=list listKey=id listValue=str
 value=
  object.id /
 
 @s.select name=bla list=list listKey=id listValue=str
  value=${object.id} /
 
 @s.select name=bla list=list listKey=id listValue=str
  value=${object} /
 
  None of the above worked.
 
 
  Could anybody please tell me what the correct value-argument would be?
 
  Thanks very much,
 
   Philipp
 
 
 
  -
  To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
  For additional commands, e-mail: user-h...@struts.apache.org
 
 



Re: S2 2.1.8.1: Need custom decapitalization (or leniency similar to 2.1.6)

2009-11-26 Thread Bill Bohnenberger
What an amusing thread. It seems to me the only problem here is the arrogant
SOB that decided to defy the Bean naming conventions. LOL. (No offense
intended if he is present company :)

With affection,
Bill

On Thu, Nov 26, 2009 at 8:31 AM, Robert Graf-Waczenski r...@lsoft.comwrote:

 Rafał Krupiński schrieb:

  On Thu, Nov 26, 2009 at 4:41 PM, Robert Graf-Waczenski r...@lsoft.com
 wrote:


 approach, which is tedious work because


 [...]


 i have to go through each applicable class and
 refactor-rename each method.



 Please don't try to make us feel guilty :-)
 You'll get paid for this, we're not.

 In previous post I stated clearly: If the only problem is the number
 of methods to be changed
 not If you can change only some classes.




 Well, yes, i am getting paid for this. So the time that i need to rename
 the methods costs my employer big money.

 This is a case of true backwards incompatibility and causes trouble in
 non-trivial projects such as ours. Other projects may decide to not upgrade
 from earlier Struts versions to V 2.1.8.1, which is something i would
 definitely take serious if i were working without getting paid, because
 having your stuff used by as many people out there as possible is a major
 point of FOSS, right? Freedom of choice is the other, meaning that we could
 of course stick with V2.1.6 and patch it to our liking. I personally voted
 against the latter option and decided to go for the renaming option because
 we need some other fixes that are available in 2.1.8. And, to tell the
 truth, our choice to use getmProperty() as accessor method naming pattern
 was a bad one originally but we lived with it since the beginning and are
 now being bitten in the behind :-)

 Robert




 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org




Re: advice on building front-end rapidly

2009-11-09 Thread Bill Bohnenberger
Yes, this is frequently my workflow, also. I happen to use Dreamweaver
because I am familiar with it and have it and it generates fairly clean
HTML, but any such wysiwig editor would do I am sure. I suggest you avoid
using MS Word to generate HTML, however, otherwise you will find the clean
it up phase rather daunting :)

- Bill

On Mon, Nov 9, 2009 at 8:40 AM, Burton Rhodes burtonrho...@gmail.comwrote:

 I would agree with eclipse as well. However, if you are trying to do
 design too, the typical cycle is you create 'dumb HTML' pages in a
 wysiwyg editor. Then clean up the code in eclipse and convert to JSP.
 A wysiwyg editor will most likely create bloated code. So you will
 have to clean up quite a bit, add CSS, etc. This makes dev in eclipse
 easier becuase you have a base to start from.

 On 11/9/09, Fernandes Celinio cfernan...@sopragroup.com wrote:
 
  I would recommend Eclipse. www.eclipse.org
 
 
 
  -Message d'origine-
  De : terry.gard...@sun.com [mailto:terry.gard...@sun.com]
  Envoyé : lundi 9 novembre 2009 15:15
  À : Struts Users Mailing List
  Objet : Re: advice on building front-end rapidly
 
  http://netbeans.org
 
  On Nov 8, 2009, at 4:32 PM, Farshad Rabbani wrote:
 
 
 
  Hi Dave,
 
 
  Why?! At the very least why wouldn't you use something that can edit
  and understand JSP, custom tags, etc.?
 
 
  So, what would your recommend as something to edit and understand JSP,
  custom tags etc.?
 
 
 
  That's what themes and templates are for.
 
 
 
  Do you have any specific resources you can guide me to with regards to
  themes and templates?
 
 
 
  Thanks,
 
  Farshad
 
 
 
  _
  Windows 7: Unclutter your desktop.
  http://go.microsoft.com/?linkid=9690331ocid=PID24727::T:WLMTAGL:ON:WL
  :en-US:WWL_WIN_evergreen:112009
 
 
  -
  To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
  For additional commands, e-mail: user-h...@struts.apache.org
 
 

 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org




Re: advice on building front-end rapidly

2009-11-09 Thread Bill Bohnenberger
I've used the standard edition for years, also. But for web projects I think
the enterprise edition is better because I can run my web server (Tomcat)
from within the IDE and therefore interactively debug servlet (in this case,
struts2) code.

- Bill

2009/11/9 Paweł Wielgus poulw...@gmail.com

 Hi all,
 i have been using eclipse (standard edition) + amateras jsp/html/xml
 editor for years now.
 What i like in it best is full support for CTRL+Space.
 It also has some kind of wysiwyg editor but i have never used it so i
 can't say if it's ok.
 You can check it out here:

 http://amateras.sourceforge.jp/cgi-bin/fswiki_en/wiki.cgi?page=EclipseHTMLEditor

 Best greetings,
 Paweł Wielgus.


 2009/11/9  erikwe...@mindspring.com:
  That's what I use (vim). Although my front ends are Java code and not
 HTML/CSS.
 
  Hand-coding takes longer but in my experience results in a better product
 and also in my opinion makes you a better programmer.
 
  With that said I partnered on a project with a guy who did the HTML front
 end and he got good results with Dreamweaver. I then used vim to insert the
 tag work, scriptlets, etc., into his files.
 
  Erik
 
 
  -Original Message-
 From: Musachy Barroso musa...@gmail.com
 Sent: Nov 9, 2009 12:24 PM
 To: Struts Users Mailing List user@struts.apache.org
 Subject: Re: advice on building front-end rapidly
 
 Vi
 
 just kidding, it is monday you know :)
 
 On Sun, Nov 8, 2009 at 5:39 AM, Farshad Rabbani
 farshadrabb...@hotmail.com wrote:
 
  Hello:
 
 
 
  I am currently building all my JSPs using notepad.  It is a very slow
 and tedius process to get the struts tags to align and show exactly as I
 want and also to format the page so it looks good.  Is there a tool -
 something that will allow me to quickly build well-designed pages by
 providing me with a WYSIWYG interface where I can drag and drop struts
 elements, format them and the page easily and then see what the outcome will
 look like?  If there is such a tool that you are using (and it is easy to
 configure etc. :-) ) can you please let me know.  If there isn't, how
 exactly are you all building your pages?  I apologize if this is an absurd
 question but I find myself spending unnecessary time on this issue.  Thank
 you all in advance, any advice is very much appreciated.
 
 
 
  Regards,
 
  Farshad
 
 
  _
  Find the right PC with Windows 7 and Windows Live.
 
 http://www.microsoft.com/Windows/pc-scout/laptop-set-criteria.aspx?cbid=wlfilt=200,2400,10,19,1,3,1,7,50,650,2,12,0,1000cat=1,2,3,4,5,6brands=5,6,7,8,9,10,11,12,13,14,15,16addf=4,5,9ocid=PID24727::T:WLMTAGL:ON:WL:en-US:WWL_WIN_evergreen2:112009
 
 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org
 
 
 
  -
  To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
  For additional commands, e-mail: user-h...@struts.apache.org
 
 

 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org




Re: advice on building front-end rapidly

2009-11-08 Thread Bill Bohnenberger
I use Eclipse enterprise edition:

http://eclipse.org/home/categories/index.php?category=enterprise

- Bill

On Sun, Nov 8, 2009 at 1:32 PM, Farshad Rabbani
farshadrabb...@hotmail.comwrote:



  Hi Dave,


  Why?! At the very least why wouldn't you use something that can edit and
  understand JSP, custom tags, etc.?


 So, what would your recommend as something to edit and understand JSP,
 custom tags etc.?



  That's what themes and templates are for.



 Do you have any specific resources you can guide me to with regards to
 themes and templates?



 Thanks,

 Farshad



 _
 Windows 7: Unclutter your desktop.

 http://go.microsoft.com/?linkid=9690331ocid=PID24727::T:WLMTAGL:ON:WL:en-US:WWL_WIN_evergreen:112009


Re: ognl problem with double value in form

2009-10-03 Thread Bill Bohnenberger
OK, thanks, Wes. Sorry I forgot to mention I was using 2.1.6.

Works fine with 2.1.8 jars!

Thanks again,
- Bill

On Sat, Oct 3, 2009 at 9:57 AM, Wes Wannemacher w...@wantii.com wrote:

 Which version of struts are you using? We updated the OGNL dependency
 between 2.1.6  2.1.8, so if this is a bug with the new version we'll
 have to address it. If it's a problem with an old version, try
 updating to 2.1.8 jars.

 -Wes

 On Fri, Oct 2, 2009 at 7:43 PM, Bill Bohnenberger bill98...@gmail.com
 wrote:
  I have a double in an action:
 
 private double dval;
 
  with mutators
 
 public double getDval() { return dval; }
 
 public void setDval (double dval) { this.dval = dval; }
 
  I have this form in my jsp page:
 
  s:form action=TestAction_doCommand
 s:textfield label=Double Value name=dval size=10/
 s:submit/
  /s:form
 
  Whenever I enter 0 or 0.0 in the text field, OGNL throws
 
  ognl.MethodFailedException: Method setDval failed for object
  com.rp.db.actions.testact...@16cefa8 [java.lang.NoSuchMethodException:
  setDval([Ljava.lang.String;)]
 
  BUT, it properly converts all non-zero values without complaint and even
  converts the empty string to 0.0!
 
  Is there some way I can get OGNL to accept the 0 and 0.0 values?
 
  Thanks,
  Bill B
 



 --
 Wes Wannemacher

 Head Engineer, WanTii, Inc.
 Need Training? Struts, Spring, Maven, Tomcat...
 Ask me for a quote!

 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org




ognl problem with double value in form

2009-10-02 Thread Bill Bohnenberger
I have a double in an action:

private double dval;

with mutators

public double getDval() { return dval; }

public void setDval (double dval) { this.dval = dval; }

I have this form in my jsp page:

s:form action=TestAction_doCommand
s:textfield label=Double Value name=dval size=10/
s:submit/
/s:form

Whenever I enter 0 or 0.0 in the text field, OGNL throws

ognl.MethodFailedException: Method setDval failed for object
com.rp.db.actions.testact...@16cefa8 [java.lang.NoSuchMethodException:
setDval([Ljava.lang.String;)]

BUT, it properly converts all non-zero values without complaint and even
converts the empty string to 0.0!

Is there some way I can get OGNL to accept the 0 and 0.0 values?

Thanks,
Bill B


archive?

2009-09-25 Thread Bill Bohnenberger
Is there a searchable archive for this mailing list?

- Bill


Re: archive?

2009-09-25 Thread Bill Bohnenberger
Thanks, Dale.

On Fri, Sep 25, 2009 at 12:21 PM, Dale Newfield d...@newfield.org wrote:

 Bill Bohnenberger wrote:

 Is there a searchable archive for this mailing list?


 http://www.nabble.com/Struts---User-f206.html

 -Dale

 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org




Re: archive?

2009-09-25 Thread Bill Bohnenberger
Thanks, Antonio.

On Fri, Sep 25, 2009 at 12:22 PM, Antonio Petrelli 
antonio.petre...@gmail.com wrote:

 2009/9/25 Dale Newfield d...@newfield.org:
  Bill Bohnenberger wrote:
 
  Is there a searchable archive for this mailing list?
 
  http://www.nabble.com/Struts---User-f206.html

 Or, more web 2.0:
 http://struts.markmail.org/

 Antonio

 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org




Re: uploading a .xls file

2009-09-10 Thread Bill Bohnenberger
if you use name=file in the s:file tag, your variable names should be
file, fileFileName and fileContentType

- Bill

On Wed, Sep 9, 2009 at 10:45 PM, KIRTI CHOPRA kirtichopra2...@gmail.comwrote:


 hi
 but does it make any difference it is just variable name if i am not wrong
 but i am not sure about it also
 please let me know if it makes any difference.

 Thanks!!!
 --
 View this message in context:
 http://www.nabble.com/uploading-a-.xls-file-tp25377242p25377629.html
 Sent from the Struts - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org




Re: uploading a .xls file

2009-09-10 Thread Bill Bohnenberger
Write code in your action class to copy the temp file. You'll have to
respect your application server's containment rules: I simply copy the file
to a permanent place in my application context.

On Thu, Sep 10, 2009 at 12:59 AM, KIRTI CHOPRA kirtichopra2...@gmail.comwrote:


 Thank you so much but  can you please tell me how can i save the uploaded
 file
 --
 View this message in context:
 http://www.nabble.com/uploading-a-.xls-file-tp25377242p25378975.html
 Sent from the Struts - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org




Re: Chain a global result to an action?

2009-09-10 Thread Bill Bohnenberger
This works for me:

struts
package ...

global-results
result name=error type=redirectDeadEnd/result
/global-results

...
action name=DeadEnd class=com.rp.db.actions.DeadEnd
resultdeadEnd.jsp/result
/action

...
/package
/struts

The entire action class is:

@SuppressWarnings(serial)
public class DeadEnd extends ActionSupport
{

}

and when any action returns error the deadEnd.jsp page is displayed.

- Bill

On Thu, Sep 10, 2009 at 11:49 AM, Jim Collings jlistn...@gmail.com wrote:

 Anybody know what the syntax for this is?  I don't seem to be getting it
 right.


 Jim C.

 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org




Re: Chain a global result to an action?

2009-09-10 Thread Bill Bohnenberger
I'll let someone else answer this... I've not jet used the convention plugin
(too bleeding edge for me! :)

On Thu, Sep 10, 2009 at 12:11 PM, Jim Collings jlistn...@gmail.com wrote:

 I also forgot to mention that this is a convention-plugin project.

 On Thu, Sep 10, 2009 at 3:10 PM, Jim Collings jlistn...@gmail.com wrote:
  Will I have to define the action in the struts.xml?  I'm currently
  using annotations to handle mapping.
 
  Jim C.
 
  This works for me:
 
  struts
 package ...
 
 global-results
 result name=error type=redirectDeadEnd/result
 /global-results
 
 ...
 action name=DeadEnd class=com.rp.db.actions.DeadEnd
 resultdeadEnd.jsp/result
 /action
 
 ...
 /package
  /struts
 
  The entire action class is:
 
  @SuppressWarnings(serial)
  public class DeadEnd extends ActionSupport
  {
 
  }
 
  and when any action returns error the deadEnd.jsp page is displayed.
 
  - Bill
 
  On Thu, Sep 10, 2009 at 11:49 AM, Jim Collings jlistn...@gmail.com
 wrote:
 
  Anybody know what the syntax for this is?  I don't seem to be getting
 it
  right.
 
 
  Jim C.
 
  -
  To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
  For additional commands, e-mail: user-h...@struts.apache.org
 
 
 
 

 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org




How to access enum in jsp?

2009-09-06 Thread Bill Bohnenberger
How do I reference an enum variable in an s:if test attribute?
This is the situation, and the results I get:

1) I have a enum defined as

public enum ActionState
{
NONE, INIT, LIST, ADD, EDIT, DELETE ...
}

2) I have a variable of this type in my action class:

ActionState state;

3) My jsp contains the following code (this is just an example):

state = s:property value=state/
p
s:if test=%{state == 'LIST'}true/s:if
s:elsefalse/s:else
/p

4) Here are the results in the browser:

Struts ValueStack Debug

Value Stack Contents ObjectProperty NameProperty Value
com.rp.db.actions.Test update Update mapInstructions  servletContext
org.apache.catalina.core.applicationcontextfac...@b79701 recordName
servletResponse org.apache.catalina.connector.responsefac...@22e177 save
Save locale en_US next Next state LIST cancel Cancel addContinent Add
Continent add Add upload null actionErrors [] errors {} uploadMap Upload Map
page 0 tableName  delete Delete command  uploadContentType null serv null
addRegion Add Region sessinfo null uploadImage Upload Image texts null
pageCount 0 errorMessages [] done Done edit Edit actionMessages [] pageSize
20 back Back httpSession
org.apache.catalina.session.standardsessionfac...@15d45d9 init Init
servletRequest org.apache.struts2.dispatcher.strutsrequestwrap...@a0a36 log
org.apache.log4j.log...@e2b07b uploadFileName null fieldErrors {} pageTitle
lastState NONE confirm Confirm Delete
com.opensymphony.xwork2.DefaultTextProvider texts null

Stack Context *These items are available using the #key notation*  KeyValue
com.opensymphony.xwork2.dispatcher.HttpServletRequest
org.apache.struts2.dispatcher.strutsrequestwrap...@a0a36
com.opensymphony.xwork2.ActionContext.localeen_US
com.opensymphony.xwork2.dispatcher.HttpServletResponse
org.apache.catalina.connector.responsefac...@22e177
com.opensymphony.xwork2.ActionContext.nameTest_init
com.opensymphony.xwork2.ActionContext.application
{org.apache.catalina.resources=org.apache.naming.resources.proxydircont...@10b23cf,
org.apache.catalina.WELCOME_FILES=[Ljava.lang.String;@84f566,
freemarker.configuration=freemarker.template.configurat...@12ea1dd,
javax.servlet.context.tempdir=F:\development\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\work\Catalina\localhost\marmoset,
org.apache.catalina.jsp_classpath=/F:/development/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/marmoset/WEB-INF/classes/;/F:/development/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/marmoset/WEB-INF/lib/commons-fileupload-1.2.1.jar;/F:/development/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/marmoset/WEB-INF/lib/commons-io-1.3.2.jar;/F:/development/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/marmoset/WEB-INF/lib/commons-logging-1.1.jar;/F:/development/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/marmoset/WEB-INF/lib/freemarker-2.3.13.jar;/F:/development/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/marmoset/WEB-INF/lib/javax.persistence_1.99.0.v200906021518.jar;/F:/development/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/marmoset/WEB-INF/lib/jenkov-butterfly-persistence-5.0.0.jar;/F:/development/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/marmoset/WEB-INF/lib/jstl-impl-1.2.jar;/F:/development/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/marmoset/WEB-INF/lib/junit-3.8.1.jar;/F:/development/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/marmoset/WEB-INF/lib/log4j-1.2.15.jar;/F:/development/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/marmoset/WEB-INF/lib/mysql-connector-java-5.1.7-bin.jar;/F:/development/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/marmoset/WEB-INF/lib/ognl-2.6.11.jar;/F:/development/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/marmoset/WEB-INF/lib/spring-test-2.5.6.jar;/F:/development/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/marmoset/WEB-INF/lib/standard.jar;/F:/development/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/marmoset/WEB-INF/lib/struts2-config-browser-plugin-2.1.6.jar;/F:/development/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/marmoset/WEB-INF/lib/struts2-core-2.1.6.jar;/F:/development/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/marmoset/WEB-INF/lib/tabletags-1.0.1.jar;/F:/development/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/marmoset/WEB-INF/lib/xwork-2.1.2.jar;/F:/development/Tomcat
5.5/common/classes/;/F:/development/Tomcat
5.5/common/i18n/tomcat-i18n-en.jar;/F:/development/Tomcat
5.5/common/i18n/tomcat-i18n-es.jar;/F:/development/Tomcat

Re: How to access enum in jsp?

2009-09-06 Thread Bill Bohnenberger
Ah ha! So when code the test attribute like this:

test=%{state == @com.yata.yata.actionst...@list}

it works. Thanks, Pawel!

- Bill

P.S. That syntax sux :-)

2009/9/6 Paweł Wielgus poulw...@gmail.com

 Hi Bill,
 You are comparing string with enum by == operator, so it's always false.
 Also if You see this value in debug it's the effect of toString() method.
 You can access enum like this com.something.actionst...@none
 if i remebmer correctly.

 Best greetings,
 Paweł Wielgus.





problem uploading a text file

2009-09-04 Thread Bill Bohnenberger
Ok, I'm sure I must be doing something dumb here, but I can't seem to find
it. I'm have a problem uploading a simple text file... when I try to a file
named test.txt, I get an action error message File upload error: invalid
data. and all my file variables (see below) are null when the action method
gets called.

Here's my setup:

Config:

action name=BulkUpload_* class=com.rp.db.actions.BulkUpload
method={1}
interceptor-ref name=basicStack/
interceptor-ref name=fileUpload
param name=maximumSize8192000/param
param
name=allowedTypesimage/jpeg,image/gif,text/plain/param
/interceptor-ref
interceptor-ref name=validation/
interceptor-ref name=workflow/

result name=inputbulkUpload.jsp/result
result name=done type=redirectMenu_init/result
result name=login type=redirectLogin_init/result
/action

Relevant jsp code:

s:form action=BulkUpload_doCommand method=post
enctype=multipart/form-data
s:file label=Bulk File name=upload size=45/
s:submit name=command value=Upload File/
s:submit name=command value=Cancel/
/s:form

Action excerpts:
...
private String uploadContentType;
private String uploadFileName;
private File upload;
...
public void setUpload(File upload)
{
this.upload = upload;
}
public void setUploadFileName(String uploadFileName)
{
this.uploadFileName = uploadFileName;
}
public void setUploadContentType(String uploadContentType)
{
this.uploadContentType = uploadContentType;
}

As I mentioned above, when I use this form to upload a text file named
test.txt I get the action error message File upload error: invalid data.
and all my upload... variables are null.

Thanks,
Bill


Re: problem uploading a text file

2009-09-04 Thread Bill Bohnenberger
Thanks, Chris, but I don't think that's the problem. I have another jsp page
and associated action that uploads .jpg and .gif images ok with the same
variables...the only difference is that I am tying to get the fileUpload
interceptor to accept a *.txt file. (Sorry, I should've mentioned all this
in my original post)

Bill

On Fri, Sep 4, 2009 at 12:36 PM, Chris Pratt thechrispr...@gmail.comwrote:

 I believe the documentation is incorrect on the web.  The setUpload doesn't
 take a File object, it takes a String that is the fully qualified path to
 the temporary file created by the internal upload support of struts.  So
 what you actually need is:

   public void setUpload(String upload)
   {
   this.upload = new File(upload);
   }

 (*Chris*)

 On Fri, Sep 4, 2009 at 11:40 AM, Bill Bohnenberger bill98...@gmail.com
 wrote:

  Ok, I'm sure I must be doing something dumb here, but I can't seem to
 find
  it. I'm have a problem uploading a simple text file... when I try to a
 file
  named test.txt, I get an action error message File upload error:
 invalid
  data. and all my file variables (see below) are null when the action
  method
  gets called.
 
  Here's my setup:
 
  Config:
 
 action name=BulkUpload_* class=com.rp.db.actions.BulkUpload
  method={1}
 interceptor-ref name=basicStack/
 interceptor-ref name=fileUpload
 param name=maximumSize8192000/param
 param
  name=allowedTypesimage/jpeg,image/gif,text/plain/param
 /interceptor-ref
 interceptor-ref name=validation/
 interceptor-ref name=workflow/
 
 result name=inputbulkUpload.jsp/result
 result name=done type=redirectMenu_init/result
 result name=login type=redirectLogin_init/result
 /action
 
  Relevant jsp code:
 
  s:form action=BulkUpload_doCommand method=post
  enctype=multipart/form-data
 s:file label=Bulk File name=upload size=45/
 s:submit name=command value=Upload File/
 s:submit name=command value=Cancel/
  /s:form
 
  Action excerpts:
  ...
 private String uploadContentType;
 private String uploadFileName;
 private File upload;
  ...
 public void setUpload(File upload)
 {
 this.upload = upload;
 }
 public void setUploadFileName(String uploadFileName)
 {
 this.uploadFileName = uploadFileName;
 }
 public void setUploadContentType(String uploadContentType)
 {
 this.uploadContentType = uploadContentType;
 }
 
  As I mentioned above, when I use this form to upload a text file named
  test.txt I get the action error message File upload error: invalid
  data.
  and all my upload... variables are null.
 
  Thanks,
  Bill
 



Re: problem uploading a text file

2009-09-04 Thread Bill Bohnenberger
Well, I am the one who is confused, for sure. I restarted eclipse and now I
can upload *.txt files just fine with my original xml:

   action name=BulkUpload_* class=com.rp.db.actions.BulkUpload
method={1}
result name=inputbulkUpload.jsp/result
result name=done type=redirectMenu_init/result
result name=login type=redirectLogin_init/result
/action

Arrg, this is not the first time Eclipse has refused to work properly in
hosted mode until I restarted it. But this time I totally forgot to try
that tactic :(  Sorry for the bother!

Bill

On Fri, Sep 4, 2009 at 1:41 PM, Chris Pratt thechrispr...@gmail.com wrote:

 I guess I don't understand why the interceptor would care what the content
 of the file is.  It's only job is to inject the parameters into the action.
  (*Chris*)

 On Fri, Sep 4, 2009 at 1:24 PM, Bill Bohnenberger bill98...@gmail.com
 wrote:

  Thanks, Chris, but I don't think that's the problem. I have another jsp
  page
  and associated action that uploads .jpg and .gif images ok with the same
  variables...the only difference is that I am tying to get the fileUpload
  interceptor to accept a *.txt file. (Sorry, I should've mentioned all
 this
  in my original post)
 
  Bill
 
  On Fri, Sep 4, 2009 at 12:36 PM, Chris Pratt thechrispr...@gmail.com
  wrote:
 
   I believe the documentation is incorrect on the web.  The setUpload
  doesn't
   take a File object, it takes a String that is the fully qualified path
 to
   the temporary file created by the internal upload support of struts.
  So
   what you actually need is:
  
 public void setUpload(String upload)
 {
 this.upload = new File(upload);
 }
  
   (*Chris*)
  
   On Fri, Sep 4, 2009 at 11:40 AM, Bill Bohnenberger 
 bill98...@gmail.com
   wrote:
  
Ok, I'm sure I must be doing something dumb here, but I can't seem to
   find
it. I'm have a problem uploading a simple text file... when I try to
 a
   file
named test.txt, I get an action error message File upload error:
   invalid
data. and all my file variables (see below) are null when the action
method
gets called.
   
Here's my setup:
   
Config:
   
   action name=BulkUpload_* class=com.rp.db.actions.BulkUpload
method={1}
   interceptor-ref name=basicStack/
   interceptor-ref name=fileUpload
   param name=maximumSize8192000/param
   param
name=allowedTypesimage/jpeg,image/gif,text/plain/param
   /interceptor-ref
   interceptor-ref name=validation/
   interceptor-ref name=workflow/
   
   result name=inputbulkUpload.jsp/result
   result name=done type=redirectMenu_init/result
   result name=login type=redirectLogin_init/result
   /action
   
Relevant jsp code:
   
s:form action=BulkUpload_doCommand method=post
enctype=multipart/form-data
   s:file label=Bulk File name=upload size=45/
   s:submit name=command value=Upload File/
   s:submit name=command value=Cancel/
/s:form
   
Action excerpts:
...
   private String uploadContentType;
   private String uploadFileName;
   private File upload;
...
   public void setUpload(File upload)
   {
   this.upload = upload;
   }
   public void setUploadFileName(String uploadFileName)
   {
   this.uploadFileName = uploadFileName;
   }
   public void setUploadContentType(String uploadContentType)
   {
   this.uploadContentType = uploadContentType;
   }
   
As I mentioned above, when I use this form to upload a text file
 named
test.txt I get the action error message File upload error: invalid
data.
and all my upload... variables are null.
   
Thanks,
Bill