Re: Dynamic form fields with s:div and ajax

2008-09-02 Thread Kropp, Henning

Hello Gainty,

thanks for your reply and effort!

I do specify the href as />. Sorry I left that out. This calls the AddObjectAction, which 
populates the List of objects in the prepare method. This works greate! 
But I simply cant target the div with the action in the div.


In your doc you use a static jsp where I use the Action to render the 
jsp and initialize a List of objects. Than I want the same div and the 
same Action to render the same jsp with the previously initialized List 
of objects and in the action do something to the List either delete or 
add an object. And either way I try its not working.


Targeting the same div (in your doc 'one') results in not having the 
list on the request. Using the formId results in not getting the the 
list on the request. I know it works if I leave out the target on the 
div (in your doc 'one') but still the div needs to be rendered again to 
make it visible. It works when I target a different div. But how do 
override the other div.


regards

Martin Gainty schrieb:

from doc located at 
http://www.roseindia.net/struts/struts2/struts2uitags/div.shtml
you would either need to specify where the href value is coming from
   

  id="one"
  theme="ajax"
  href="%{test}">



OR


use the supplied value from property

  Output: 
  Firstname : 
  




for results returned from action class populating a div tag
Div 1




Martin 



__ 

Disclaimer and confidentiality note 
Everything in this e-mail and any attachments relates to the official business of Sender. This transmission is of a confidential nature and Sender does not endorse distribution to any party other than intended recipient. Sender does not necessarily endorse content contained within this transmission. 




  

Date: Tue, 2 Sep 2008 21:22:51 +0200
From: [EMAIL PROTECTED]
To: user@struts.apache.org
Subject: Dynamic form fields with s:div and ajax

Hello,

I am trying a common scenario, where I want to dynamically create form 
fields and either add or remove some fields. The fields are a List of 
objects. I using the following approach described in short:


AddObjectAction:
List myObjectList;
   prepare(){if == null (3x) add ... else add 1x}
   String delete(){ myObjectList.remove(int listPostion) }

home_jsp:

  
  formId="form"> 
   


addObjectAction-success.jsp:

  
   
 
  ..

   href="%{deleteObject[#stat.index]" />


This works, but does not refresh the div objectsDiv. Using target does 
not work because objectList does not get onto the request, without 
target the objectList is on the request. I tried to set the objectList 
as a param to s:url deleteObject, this kind of works but results in a 
param intercepter exception (haven't tried a custom converter yet).
When having the div put the fields from formId="form" onto the request 
it only puts the fields onto the request that itself does not hold. In 
example only the 'anotherField'.


I think this should work this way. Why does setting target result in 
removing the myObjectList on the request? Why does s:div formId not put 
the fields on request itself holds?


Many thanks in advance


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




_
Talk to your Yahoo! Friends via Windows Live Messenger.  Find out how.
http://www.windowslive.com/explore/messenger?ocid=TXT_TAGLM_WL_messenger_yahoo_082008
  



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



Dynamic form fields with s:div and ajax

2008-09-02 Thread Kropp, Henning

Hello,

I am trying a common scenario, where I want to dynamically create form 
fields and either add or remove some fields. The fields are a List of 
objects. I using the following approach described in short:


AddObjectAction:
   List myObjectList;
  prepare(){if == null (3x) add ... else add 1x}
  String delete(){ myObjectList.remove(int listPostion) }

home_jsp:
   
 
formId="form"> 

  

addObjectAction-success.jsp:
   
 
  

 ..
 href="%{deleteObject[#stat.index]" />

   

This works, but does not refresh the div objectsDiv. Using target does 
not work because objectList does not get onto the request, without 
target the objectList is on the request. I tried to set the objectList 
as a param to s:url deleteObject, this kind of works but results in a 
param intercepter exception (haven't tried a custom converter yet).
When having the div put the fields from formId="form" onto the request 
it only puts the fields onto the request that itself does not hold. In 
example only the 'anotherField'.


I think this should work this way. Why does setting target result in 
removing the myObjectList on the request? Why does s:div formId not put 
the fields on request itself holds?


Many thanks in advance


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



Re: javascript in returned jsp through xhr

2008-08-16 Thread Kropp, Henning


--- Begin Message ---

Dear Gainty,

vielen Dank for your reply. I am very sorry but I cant supply you with a 
url. What I load into the div is the following:


<%@ include file="/common/taglibs.jsp"%>

   
   ..
   
   

src="${ctx}/scripts/calendar/calendar.js">
src="${ctx}/scripts/calendar/calendar-setup.js">
src="${ctx}/scripts/calendar/lang/calendar-${pageContext.request.locale}.js">


   Form.focusFirstElement(document.forms["traitForm"]);
   Calendar.setup(
   {
   inputField  : "form_start",  // id of the input field
   //ifFormat: "%m/%d/%Y",  // the date format
   ifFormat: Calendar._TT['TT_DATE_TIME_FORMAT'],
   showsTime   : true,
   singleClick : false,
   button  : "button_start"// id of the button
   }
);


I use the following technique to load it into the div:


   
   

  

   cssStyle="width: 100%;"
   loadingText="getText('Loading')" >


The selectTraitPage-action returns the jsp with the jcalender. The 
problem is, that clicking the button than does not result in a calendar 
view. I can use it when loaded not in the div.


I simply dont know why and are very grateful for your help. I believe 
its a matter, that the imported calender.js and/or prototype.js (which 
is needed for the calendar) can bind to the button!? So it fails.


Thx,
Henning


Martin Gainty schrieb:
can you supply the URL (which delivers the content..) and we can test 
it here

<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>

  


http://kropp.de/test";>Initial Content


Vielen Danke,
Martin
__
Disclaimer and confidentiality note
Everything in this e-mail and any attachments relates to the official 
business of Sender. This transmission is of a confidential nature and 
Sender does not endorse distribution to any party other than intended 
recipient. Sender does not necessarily endorse content contained 
within this transmission.



> Date: Sat, 16 Aug 2008 22:41:09 +0200
> From: [EMAIL PROTECTED]
> To: user@struts.apache.org
> Subject: javascript in returned jsp through xhr
>
> Hi,
>
> I am a little stuck here. A action loads a jsp into a div. For this I
> use the ajax theme (dojo) and a form submit with target. Works fine. 
The

> Problem ist, that the jsp returned by the action has javascript in it.
> Its the jcalendar. Having this jsp load normally the calendar works
> fine, but not in div.
>
> To solve this I tried executeScripts option, but that did not work. I
> searched and found out that eval might help, but I simply dont know how
> this could help.
>
> Any hints would be greatly appreciated. Many thanks in advanced!
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


Talk to your Yahoo! Friends via Windows Live Messenger. Find Out How 





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

javascript in returned jsp through xhr


Hi,

I am a little stuck here. A action loads a jsp into a div. For this I 
use the ajax theme (dojo) and a form submit with target. Works fine. The 
Problem ist, that the jsp returned by the action has javascript in it. 
Its the jcalendar. Having this jsp load normally the calendar works 
fine, but not in div.


To solve this I tried executeScripts option, but that did not work. I 
searched and found out that eval might help, but I simply dont know how 
this could help.


Any hints would be greatly appreciated.  Many thanks in advanced!

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



Re: Hibernate UserType and OGNL


Lukasz Lenart schrieb:

( also tried:  key="bid.amount.amount" /> )



This is correct

  

public Monetary getAmount() { return amount; }

and Monetary beeing:
public class Monetary implements Serializable{
  private final BigDecimal amount;
  private final Currency currency;

  public Monetary(BigDecimal amount, Currency currency) {
  this.amount = amount;
  this.currency = currency;
  }

  public BigDecimal getAmount() { return amount; }
  public Currency getCurrency() { return currency; }

I am getting either a field error or with "bid.amount.amount" :
ERROR [btpool0-2] InstantiatingNullHandler.nullPropertyValue(110) | Could
not create and/or set value back on to object
java.lang.InstantiationException: com.app.model.Monetary



Add default constructor to Monetary and will be ok


Regards
  

And one should give the Monetary proper setters. stupid me ;)

Works! Thank you!

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



Hibernate UserType and OGNL


Hi,

I am trying to implement a hibernate UserType for all the monetary 
amounts in my application. I follow the example given in "Manning - Java 
Persistence with Hibernate" Chapter 5.3 .
I am having difficulties to set and retrieve the value from a jsp due to 
a lack of understanding how this is handled. I assume it is related to OGNL.


Basically I am trying the following:
addBid.jsp:
 ( also tried: key="bid.amount.amount" /> )


Mapping:
@org.hibernate.annotations.Type ( type= 
"com.app.persistence.MonetaryUserType" )

@Column( name="amount" )
public Monetary getAmount() { return amount; }

and Monetary beeing:
public class Monetary implements Serializable{
   private final BigDecimal amount;
   private final Currency currency;

   public Monetary(BigDecimal amount, Currency currency) {
   this.amount = amount;
   this.currency = currency;
   }

   public BigDecimal getAmount() { return amount; }
   public Currency getCurrency() { return currency; }

I am getting either a field error or with "bid.amount.amount" :
ERROR [btpool0-2] InstantiatingNullHandler.nullPropertyValue(110) | 
Could not create and/or set value back on to object

java.lang.InstantiationException: com.app.model.Monetary

What am I doing wrong? What is this 
InstantiatingNullHandler.nullPropertyValue and how to trac it down?


Thanks and kind regards

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



Re: [OT] What do you code today?


Wes Wannemacher schrieb:

I've been quiet on this one, but since I finally had a breakthrough
today, I feel like talking about it :)

I started a pet project that I've been toying around in my head for a
while. As a parent, I coach a few elementary and junior high sports. It
is a volunteer thing, and if offered pay, I would refuse it (the schools
need the money more than I do). The biggest complaint that parents have
though is that they feel like we don't provide enough information, etc.
Sometimes I want to tell the parents that complain to shove it :), but
as a parent myself, I feel the same way about teachers, so I try to do a
better job each season. Since I setup a wordpress/phpBB site a while
back (which I haven't been too diligent about updating), I thought about
doing something similar. Having dealt once with wordpress/phpBB, I have
vowed to never do it again. 


In an attempt to "eat-my-own-dog-food," I decided to do this all from
scratch with s2 and friends. So, I'm creating a site that is centered
around managing a team. The goal is to make a resource for parents and
fans to discuss the teams and athletes. It will mostly be a knock-off of
other blogs and forums, but it will provide some extra functionality for
whichever sport is being managed. So, stats, pictures and videos can be
uploaded. A schedule can be viewed (and managed by coaches). Coaches can
blog about the various events (matches, tournaments, etc.). And, users
can post in a forum (polls, regular forums). 


The fun part - The site is struts 2.1.?-SNAPSHOT based using Maven,
Spring, Hibernate (JPA), SiteMesh, Acegi, and Prototype/JQuery (haven't
decided yet). I'm using the codebehind plugin and other than acegi, I've
hardly written any configuration at all! It's wonderful. The
breakthrough I had was that I've created something like 40 entities so
far and just began work on s2 actions. I was crossing my fingers that my
generic dao, codebehind and spring autowire would allow me to code by
convention and that things would work properly. Imagine my surprise when
I had my first action working in less than a few hours! When I'm done, I
may yank the guts out and post an integrated blog/forum project to
sourceforge as an example of s2/spring/sitemesh/jpa with hints of AJAX,
but that's a ways out...

-Wes


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

  

Fans are the best coach. Did you know that!?

As I understand your project I it sounds close to what certain 
'low-level' European soccer clubs are doing to raise money for their 
club. For a little fee every fan owns part of the club and over the web 
they can decide over the formation, the training schedule and what else. 
In some case the coach has to do what the people say in other case he 
simply has to justify if not doing so.
The one soccer club I know of is Ebbsfleet 
(http://www.ebbsfleetunited.co.uk/) with their project MyFootballClub 
(http://www.myfootballclub.co.uk/).


Just wanted to share this perspective.

greetz

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



Re: About Message Icons


Chen Chunwei schrieb:

Hi all,

Is there any tag can be used to display message icons? I mean icons like alert, 
error, info and etc.

Talos
Appfuse has implemented it in a way I think is very nice. Might consider 
to check it out.


kropp

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



Re: Dojo not working in Struts2.


Hi Sharath,

I am not quit sure, but I think it might help if you simply remove the 
 tag. You see dojo is already configured inside of struts 
(inside the core jar and static folder or so) to be used with it's tags 
http://struts.apache.org/2.x/docs/tag-reference.html . Since you are not 
using any of those you can just remove the . This is what the 
head template looks like: 
http://struts.apache.org/2.x/docs/ajax-head-template.html


You should thought consider using the struts2 tags.

If you plan not to do so or you want to use a newer version of dojo 
since struts is a little behind you need to configure your web.xml file, 
as I believe, to use the static filter right to point to the location of 
your ajax files:



   staticFilter
   com.bitpitch.webapp.filter.StaticFilter
   
   includes
   /scripts/dojo/*,/dwr/*
   
   

regards

sharath karnati schrieb:

Hi All,
 
   Please find 'test4Dialog.jsp' in attachment. This .jsp file is 
placed inside /WEB-INF/pages directory.
 
   When I'm accessing this .jsp with 
(http://localhost:7001/hibernate/pages/test4Dialog.jsp), it is 
displaying 'dijit.TooltipDialog' correctly.
 
   The same page I configured in struts2 action with below code
  
 

 /pages/test4Dialog.jsp
 
 
   When I try to access this page with 
URL(http://localhost:7001/hibernate/events/Dojo.action), I'm getting 
below error message in firefox console.
 
dojo is not defined

  dojo.require("dojo.parser");
 
I didn't place any dojo plugin jar files in my library? I think 
struts2 is supporting Dojo inclusively.
 
If I need to install Dojo plugin to correct this problem then where I 
can find this .jar file(dojo plugin)?
 
  Please let me know, how to correct this problem. 
 
Have a nice day.
 
Thanks,

Sharath.
 
 



Looking for last minute shopping deals? Find them fast with Yahoo! 
Search. 
 




-
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: [struts] Being driven mad by the ParametersInterceptor


Dale Newfield schrieb:

Jonny Cavell wrote:

So that brings me back to the original problem - getting all these Error
setting expression 'xxx' with value '[Ljava.lang.String;@19a82ee' 
messages
for every single parameter that doesn't have an associated setter 
method on

the action. How do I stop these errors?


Unless I'm mistaken, those are not errors, just WARNings.  You are 
free to change your logging levels so they don't make it into your log 
files.
As I am experiencing the same problems by now. I have checked and those 
messages are not logged if devMode is turned off.


-Dale

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



ParameterIntercepter throws unexpected Exception on parameter


Hi List,

the ParameterIntercepter throws the following exception at my page:

ERROR [btpool0-1] ParametersInterceptor.setParameters(204) | 
ParametersInterceptor - [setParameters]: Unexpected Exception caught 
setting 'button.regi
ster' on 'class com.webapp.action.SignupAction: Error setting expression 
'button.register' with value '[Ljava.lang.String;@62e8c8'


Well, the parameter 'button.register' is a key value for  . 
I don't understand why this Exception is thrown and have no clue how to 
track the issue down.
The SignUpAction uses besides a save() method an execute() method. The 
execute() method is primarly used to distinguish between get and post 
methodType.


Any given aspects will be appreciated.

thx


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



Re: [struts] parameter to custom tag


Thank you Dale!

Dale Newfield schrieb:

Kropp, Henning wrote:
I must add that s:set printed out the string as well. I am not quit 
sure if its supposed to, but it did.


I glossed over this--I wouldn't use s:set here, but rather c:set. 
Neither one should print the value (are you sure you didn't do that 
for debugging inside your custom tag?), but since you're trying to set 
a value to be extracted with EL, I'd use the tag library that is 
geared toward EL.


That would be:



> My understanding of struts is not as experienced so if I may ask,
why would I need an extra jsp to pre-evaluate the OGNL as string as 
you proposed?


You don't.  If you want to use EL exclusively to extract the data, 
don't use s:iterator, but rather one of the c: loop tags, then you 
won't need the "set".  If you want to use OGNL to name/manipulate/etc. 
the data, then something needs to be able to take that OGNL expression 
and evaluate it.  Your current solution to that is to have s:property 
do the work, and have c:set store the results of that work in a place 
that can then be handed off to your custom tag.  An alternate solution 
would be to enable your custom tag to evaluate OGNL directly.  So 
you'd probably have within your tag a String setter for attr that just 
stores the string expression (argExpr below), then in your doTag (or 
doStartTag, or whatever) do something like the following:


PageContext pageContext = (PageContext) getJspContext();
ValueStack valueStack = TagUtils.getStack(pageContext);

argValue = valueStack.findString(argExpr);

to ask OGNL to evaluate the expression for you and give you the 
resulting value.


So, two different solutions, neither of which need the :set tag:
(the first assumes the collection is in some space where it can be 
grabbed by EL, the second that your custom tag does it's own OGNL 
evaluation)


items="${some.el.expression.that.returns.the.collection}">

  


or


  


-Dale

-
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: [struts] parameter to custom tag


Dale Newfield schrieb:

Kropp, Henning wrote:

I figured it out. I used  for this. Thanks.


   
   
   



That will only work if the value you're trying to pass is a string.
It might also add whitespace to either end of that value (due to the 
whitespace inside your s:set tag.


Why not pass the OGNL expression to your tag as a string and evaluate 
it inside your custom tag, instead?  If you use this custom tag in 
many places, I predict the extra jsp required to pre-evaluate the 
OGNL->string will be error-prone...


-Dale

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



I must add that s:set printed out the string as well. I am not quit sure 
if its supposed to, but it did. Therefor I even had to encapsulate 
s:property with a s:param statement. Like this



  

  

  
 



This is quite a big block for little I wanted to achieve.

I thought about passing the whole list to the tag too, but somehow it 
did not feel like the right thing to do, at least as I would have done 
it. My understanding of struts is not as experienced so if I may ask, 
why would I need an extra jsp to pre-evaluate the OGNL as string as you 
proposed?


thx

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



Re: parameter to custom tag


Hi,

I figured it out. I used  for this. Thanks.


   
   
   




regards


Kropp, Henning schrieb:

Hi List,

I am new to struts2. I iterate over a list of strings. Every string in 
that list is supposed to be executed by a custom tag. I tried it in 
many fashions but its not working. I am only able to give over the 
whole list as a string with:




How to I get the  value into my custom tag?

Kind regards
Henning Kropp


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



parameter to custom tag


Hi List,

I am new to struts2. I iterate over a list of strings. Every string in 
that list is supposed to be executed by a custom tag. I tried it in many 
fashions but its not working. I am only able to give over the whole list 
as a string with:




How to I get the  value into my custom tag?

Kind regards
Henning Kropp


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



Re: localization


This would be the place to look for:
http://struts.apache.org/2.x/docs/i18n-interceptor.html

btw... There are some broken links at
http://struts.apache.org/2.x/docs/localization.html

Especially the link to sitemesh plugin ought to be:
http://struts.apache.org/2.x/docs/sitemesh-plugin.html
instead of
http://struts.apache.org/2.x/S2PLUGINS/sitemesh-plugin.html

And the links to ValidationAware, Action... are also broken.

regards

[EMAIL PROTECTED] schrieb:

http://struts.apache.org/2.x/docs/localization.html

M--
- Original Message -
Wrom: VZCMHVIBGDADRZFSQHYUCDDJBLVLMHAALPTCXLYRWTQT
To: 
Sent: Friday, November 30, 2007 8:30 AM
Subject: localization


  

my web app display message in jsp page ( using )
always in one language.
I have two localization files (package.properties and


package_it.properties
  

in the same folder), and I always get the messages in Italian language


even
  

if the client language is English (en-us).
Rather in my production environment (O.S. Windows Server 2003 English),


the
  

same web app always displaying the same messages in English language even


if
  

the client language (IE 6) is Italian (it).
I tried to do everythings but with any result.
Please help me to solve this issue.
Thanks in advance for your time.

Andrea
--
View this message in context:


http://www.nabble.com/localization-tf4909438.html#a14057085
  

Sent from the Struts - User mailing list archive at Nabble.com.


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