Re: General: blankline in jsp question??

2005-03-23 Thread Jason Lea




http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jasper-howto.html

It mentions the trimSpaces on that page.



Eain Mat wrote:

  yes I can remove blank line in source  but this will cause less readability in code.
 
I like the option to trim whitespace in web.xml. can you please provide me more information or reference?
Eain


Jason Lea <[EMAIL PROTECTED]> wrote:
I do this sort of thing:

%>%>%>

So that there are no blank lines for those parts.

also for tomcat 5.5 (not sure when it was added) there is an option in 
the default web.xml

between   -->
[false] -->

Which gets rid of whitespace when it compiles the JSP page.

Eain Mat wrote:

  
  
let say I included some tag library in my jsp and everytime, I have a blank line in my source, I will have a blank line in response too. Is there way to strip off or filter out those blankline.
Eain




  
  
  


-- 
Jason Lea




No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.8.1 - Release Date: 2005.03.23

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

Re: General: blankline in jsp question??

2005-03-23 Thread Matt Raible
Eain Mat wrote:
yes I can remove blank line in source  but this will cause less 
readability in code.
I like the option to trim whitespace in web.xml. can you please provide me more information or reference?
 

Just locate the "jsp" servlet in $CATALINA_HOME/conf/web.xml and add the 
following :

   
   trimSpaces
   true
   

Eain
Jason Lea <[EMAIL PROTECTED]> wrote:
I do this sort of thing:
%>%>%>
So that there are no blank lines for those parts.
also for tomcat 5.5 (not sure when it was added) there is an option in 
the default web.xml

between   -->
[false] -->
Which gets rid of whitespace when it compiles the JSP page.
Eain Mat wrote:
 

let say I included some tag library in my jsp and everytime, I have a blank 
line in my source, I will have a blank line in response too. Is there way to 
strip off or filter out those blankline.
Eain

   

 


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


RE: Mysteriously pre-filled ActionForm?

2005-03-23 Thread David G. Friedman
Ken,

> Am I missing something?

You are indeed missing something.   Your configuration shows ACTION
CHAINING.  That has complications.  The Struts framework is internally
called and EVERY step in the RequestProcessor class is performed AGAIN using
the same data in the buffer (i.e. whatever came in with the POST or GET to
"/contactgroup.do").  THAT is why your "groupId" and "action" fields are
populated with the same data - the client never got a message to ask for
"/editcontactgroup.do" because you bypassed the client and had the framework
perform all of this behind the scenes, INTERNALLY to the webapp.

If you wish to LOSE all of that data and start fresh, I recommend you change
your forward to:



The redirect="true" sends an HTTP redirect back to the client's browser
resulting in a brand new request (and obviously a new/blank request scope).

Regards,
David ([EMAIL PROTECTED])


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



Re: General: blankline in jsp question??

2005-03-23 Thread Eain Mat
yes I can remove blank line in source  but this will cause less 
readability in code.
 
I like the option to trim whitespace in web.xml. can you please provide me more 
information or reference?
Eain


Jason Lea <[EMAIL PROTECTED]> wrote:
I do this sort of thing:

%>%>%>

So that there are no blank lines for those parts.

also for tomcat 5.5 (not sure when it was added) there is an option in 
the default web.xml

between   -->
[false] -->

Which gets rid of whitespace when it compiles the JSP page.

Eain Mat wrote:

>let say I included some tag library in my jsp and everytime, I have a blank 
>line in my source, I will have a blank line in response too. Is there way to 
>strip off or filter out those blankline.
>Eain
>
> 
>

-- 
Jason Lea




-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.8.1 - Release Date: 2005.03.23


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



Re: List Archive

2005-03-23 Thread Matt Raible
tarek.nabil wrote:
Hi,
I think the List Archive link on the main page for the Struts project is
broken. I tried it several times and it always gives me this message
Error occurred
Required parameter "listId" or "listName" is missing or invalid 

This has been the case for the past 2 weeks, I think. The current URL is
http://mail-archives.apache.org/eyebrowse/SummarizeList?listId=241
 

You might try mail-archive.com:
http://www.mail-archive.com/user%40struts.apache.org/
Matt
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


List Archive

2005-03-23 Thread tarek.nabil
Hi,

I think the List Archive link on the main page for the Struts project is
broken. I tried it several times and it always gives me this message

Error occurred
Required parameter "listId" or "listName" is missing or invalid 

This has been the case for the past 2 weeks, I think. The current URL is

http://mail-archives.apache.org/eyebrowse/SummarizeList?listId=241

Tarek Nabil

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



Mysteriously pre-filled ActionForm?

2005-03-23 Thread Keng Onn
Hi,
I'm working on an application which manages groups of email addresses, 
and I came across this puzzling scenario ["Editing contact group" function]:

On clicking an "Edit" link, 2 hidden fields in a HTML form are set - 
'groupId' to 2 (for example) and 'action' to "edit". The form ( 
ContactGroupForm) is then posted to ContactGroupAction. 
ContactGroupAction then checks to see if the action is "edit" and seeing 
that it is, returns a mapping.findForward("edit"), thus passing control 
to EditContactGroupAction (as shown in the action mappings below). At 
this point, there are NO request or session attributes set; the only 
place which contains the groupId and action is the HTML form, or rather, 
ContactGroupForm.

However, on examining the code of EditContactGroupAction and stepping 
through manually using the Eclipse debugger, I found that 
EditContactGroupForm that is passed into the execute method of 
EditContactGroupAction already has "groupId" and "action" fields 
initialised to the same values as ContactGroupForm!! I.e. the fields had 
the values 2 and "edit". The resulting presentation JSP page thus showed 
the prefilled fields of the contact group that I'm supposed to edit 
after clicking the link. Why is this so? Aren't the fields supposed to 
be null when EditContactGroupForm is first called by the action mapping 
for "editcontactgroup"?

I think it might be because the fields in both ActionForms share the 
same name, i.e. both ContactGroupForm and EditContactGroupForm have 
"groupId" and "action" fields, but nothing in the Struts documentation 
mentioned anything of this sort. Am I missing something?

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


Re: General: blankline in jsp question??

2005-03-23 Thread Jason Lea
I do this sort of thing:
<%@   taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core";
%><%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt";
%><%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions";
%>
So that there are no blank lines for those parts.
also for tomcat 5.5 (not sure when it was added) there is an option in 
the default web.xml

 
 

Which gets rid of whitespace when it compiles the JSP page.
Eain Mat wrote:
let say I included some tag library in my jsp and everytime, I have a blank 
line in my source, I will have a blank line in response too. Is there way to 
strip off or filter out those blankline.
Eain
 

--
Jason Lea

--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.8.1 - Release Date: 2005.03.23
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


General: blankline in jsp question??

2005-03-23 Thread Eain Mat
let say I included some tag library in my jsp and everytime, I have a blank 
line in my source, I will have a blank line in response too. Is there way to 
strip off or filter out those blankline.
Eain


RE: Action Mapping Forward Params

2005-03-23 Thread Rajaneesh
Richard,

  Since your are using forward , the request context is not lost. Hence the
dynamic parameter should still be availible. Hope this helps


"This message is not an official communication of SLK Software. The sender
of this message is neither acting as an agent nor in any other capacity for
or on behalf of SLK Software. SLK Software accepts no responsibility or
liability in connection with the posting of this message."




-Original Message-
From: Richard Reyes [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 22, 2005 10:25 PM
To: Struts Users Mailing List
Subject: Action Mapping Forward Params


Hello Guys,

I have a form that is called with a dymanic param in a url. Now after
saving the form succesfully or not i need to go back to the same form.
But to load the form correctly
I need the parameter I have started with. How do I include dynamic url
parameters inside
the action mappings specifically the forward element?

TIA!

Richard

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



OpenSource CRM that works with struts

2005-03-23 Thread kjc
Looking for an OpenSource CRM that integrates nicely with struts 1.2

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


RE: Validation - Mask

2005-03-23 Thread Greg Pelly
Add a ^ to the beginning of the pattern. Try changing:
  [^/$&=]+$
To
  ^[^/$&=]+$

That should work.

If you're not familiar with regular expressions, a ^ at the beginning of a
regexp matches the string starting at the beginning (just as the $ matches
at the end).  Without it, as long as _something_ comes before the forbidden
characters, the mask will return true.

To see the difference, paste this Javascript into an HTML doc.


  var pattern = /[^&$]+$/; //"this" will match in the regular expression
  alert (pattern.exec("this& is a Test")) ;

  var pattern = /^[^&$]+$/; //regexp will fail.
  alert (pattern.exec("this& is a Test")) ;


Greg

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



Re: Validation - Mask

2005-03-23 Thread Tim Christopher
I'm not a a development machine so can't test this now but you could try using:

   ^[~\$]+$

..  Also failing that you could always opt for something like
^[0-9a-zA-Z]* listing valid inputs, as opposed to a value you don't
want.

Tim Christopher

On Wed, 23 Mar 2005 16:37:47 -0800, Jaswinder Kaur <[EMAIL PROTECTED]> wrote:
> Hi all,
> 
> I want to validate a string value and make sure that it does not have "&",
> "$" or "=" character in it. I used the following code
> 
> 
>mask
>[^/$&=]+$
>
> 
> This work only if the last character is either "&", "$" or "="  else it does
> not.
> 
> Please help!!
> 
> TIA
> Jaswinder
> 
> "Attention: This message is intended only for the individual to whom it is
> addressed and may contain information that is confidential or privileged. If
> you are not the intended recipient, or the employee or person responsible for
> delivering it to the intended recipient, you are hereby notified that any
> dissemination, distribution, copying or use is strictly prohibited. If you
> have received this communication in error, please notify the sender and
> destroy or delete this communication immediately."
> ==
> 
>

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



Validation - Mask

2005-03-23 Thread Jaswinder Kaur
Hi all,

I want to validate a string value and make sure that it does not have "&",
"$" or "=" character in it. I used the following code


mask
[^/$&=]+$



This work only if the last character is either "&", "$" or "="  else it does
not.

Please help!!

TIA
Jaswinder

"Attention: This message is intended only for the individual to whom it is
addressed and may contain information that is confidential or privileged. If
you are not the intended recipient, or the employee or person responsible for
delivering it to the intended recipient, you are hereby notified that any
dissemination, distribution, copying or use is strictly prohibited. If you
have received this communication in error, please notify the sender and
destroy or delete this communication immediately."
==


Re: Validation only occurs client side

2005-03-23 Thread Bill Siggelkow
At first glance it looks okay -- I suggest you set a breakpoint in the 
ValidatorForm.validate() method (or you could override the method) to 
see if it gets called. If not, then I would look into your request 
processor (which I noticed was a custom one).

-Bill Siggelkow
On 2005-03-23 11:09:06 -0500, "tarek.nabil" <[EMAIL PROTECTED]> said:
Hi,
I'm having a really weird problem. This is the first time I use the
Validator. I expected to have some problems with client side
validations, but what I found was client side validations are working
but server side validations aren't!!
The fact that client-side validations work, I think, means that I've
done the configuration correctly. But why isn't it doing anything on the
server side?!!!
I made sure that validate is set to true on my action tags. I double
checked everything else and I believe everything is done correctly. Any
ideas?
validator-rules.xml --> the default
validation.xml has only a single formset element
   
  
 
 
 
 
  
 
struts-config.xml
  

  
  

  
  
  
  

  
  
  
  

  
I don't have any validate methods in my ApplicantForm class which
extends ValidatorForm.
Every help is appreciated.


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


Re: Iterate a character array

2005-03-23 Thread Tim Christopher
>>  <%-- Display the value. This displays correctly --%>
>> 

May sound like an obvious question but do you have the methods getChar
and setChar within your form bean?..  Also as it's nested within a
loop it may result in many instances of the input box with the same
name, so I'd imagine you'd need something like:

private String[] char;
public getChar() { return char;}
public setChar(String[] char) { this.char = char;}

Tim Christopher

On Mon, 21 Mar 2005 23:18:43 -0500, Victor Grazi <[EMAIL PROTECTED]> wrote:
> 
> I am trying to iterate through an array of characters in a JSP, binding a
> text field to each character.
> 
> The form bean (call it "form") has a method char[] getCharacters() and
> corresponding setter.
> 
> The JSP looks like this:
> 
>
>   
>Position
> <%-- Display the value. This
> displays correctly --%>
>
>
> <%-- now bind the property - this displays an exception No getter method for
> property char of bean org.apache.struts.taglib.html.BEAN' --%>
>
>
>
>
> 
> I have tried using various combinations of nested and logic iterate, and
> tried binding the property with and without ${} but no luck. At worst
> nothing compiles, and at best, the page is requiring the collection to
> return beans, and doesn't seem to want to work with a character array.
> Getting and setting form beans is really not the way I wanted to go, because
> it's too much load to transform a char string to a list of Strings, and then
> accepting a list of strings back and converting them back to characters, for
> each access, not to mention creating and GC'ing all of those extra objects.
> 
> Do you have any advice?
> 
> Thanks,
> Victor Grazi
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
>

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



Re: html: tag four buttons, one action problem

2005-03-23 Thread Jason King
Yes, you would.  If I were doing it myself I'd probably have a 2nd arg 
to the call to onclick that was the new value for the action, then you 
could do it with 1.
In an intial how-to I tend to simplify things.

...




function button_onclick( oBtn , sAction ) {
   var frm = oBtn.form ;
   frm.action = sAction;
   return true ;
}

Folashade Adeyosoye wrote:
I think with this, you would have multiple JS functions...
-Original Message-
From: Jason King [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 23, 2005 4:25 PM
To: Struts Users Mailing List
Subject: Re: html: tag four buttons, one action problem

Another thing you could do is use a js onclick handler to change the 
 element's action.
  // I'm better 
at the html/js end so you'll have to figure out how to html:submit this.

function edit_onclick( oBtn ) {
  var frm = oBtn.form ; // reference to the html form the submit button 
is in.
   frm.action = "/editaction.do" ;   // the stuff in the quotes should 
probably be replaced by some html: reference to fix the url.
   return true;
}

Folashade Adeyosoye wrote:
 

I am currently doing the same my project...
here is it...
it involves using javascript to change the buttonAction
1. must have a hidden field buttonAction
2. each (Button) submit button must have a property
3. when you click on the button the JS is involked and the hidden
filed buttonAction is set and the form is submitted
4. in your Java class, get the value of the button, if task1, do
task1, if task2 do task 2
hope that helps
-

function DoSomething(button)
{
document.forms[0].buttonAction.value=button.value;
document.forms[0].submit();
}

-


	
  
  />
		   
	  
  />
		   
  

  
     
  
  <%--

  
  --%>
	


---
   

--
 

On Wed, 23 Mar 2005 14:58:56 -0600, Scott Purcell
<[EMAIL PROTECTED]> wrote:
   

Hello,
I have a form, lets say that has a select list on it.
Under it I have the ability to
[edit], [delete], [modify] or [cancel].
Each of these buttons goes to a different 
but the form page is set for just one of the actions. And to top this off,
 

I cannot do a href_link, I need to submit the form to get the selected value
from the form.
 

We are using links, but they are css links (See below). One of my guys
 

said we could just use the javascript (see last link) and then change the
action of the form, but I was hoping there was a cleaner way.**
 

Here is the actual page links.  They appear to only do a href and not a
 

submit, but even if they did submit, I need to change action.
 

The last one calls a javascript, changes the action and submits, but I
 

feel it is not clean.
 

Is there a cleaner way to handle this.
*Optimal would be a tag that submits to a certain action:**
New
 

User
 

  Edit
 

User
 

  Delete
 

User
 

  
 

styleClass="mainLink">Cancel
 

  Foo
 

Bar**
 

I am sorry for all questions in this regard, but I could use some help.
Scott
  

 

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

   


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




RE: html: tag four buttons, one action problem

2005-03-23 Thread Folashade Adeyosoye
I think with this, you would have multiple JS functions...


-Original Message-
From: Jason King [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 23, 2005 4:25 PM
To: Struts Users Mailing List
Subject: Re: html: tag four buttons, one action problem

Another thing you could do is use a js onclick handler to change the 
 element's action.
  // I'm better 
at the html/js end so you'll have to figure out how to html:submit this.

function edit_onclick( oBtn ) {
   var frm = oBtn.form ; // reference to the html form the submit button 
is in.
frm.action = "/editaction.do" ;   // the stuff in the quotes should 
probably be replaced by some html: reference to fix the url.
return true;
}

Folashade Adeyosoye wrote:

>I am currently doing the same my project...
>
>
>here is it...
>
>it involves using javascript to change the buttonAction
>
>1. must have a hidden field buttonAction
>2. each (Button) submit button must have a property
>3. when you click on the button the JS is involked and the hidden
>filed buttonAction is set and the form is submitted
>4. in your Java class, get the value of the button, if task1, do
>task1, if task2 do task 2
>
>
>hope that helps
>
>-
>
>function DoSomething(button)
>{
>  document.forms[0].buttonAction.value=button.value;
>  document.forms[0].submit();
>}
>
>
>-
>
>
>  
> 
>   
>  property="task1" 
>  value="Add Property"   
>  onclick="DoSomething(this);"
>/>
>      
>   property="task2" 
>  value="Add Property/Sublease"  
>  onclick="DoSomething(this);"
>/>
>      
>
>  
>
>   
>
><%--
>  
>
>--%>
>   
>
>
>---
--
>
>
>
>On Wed, 23 Mar 2005 14:58:56 -0600, Scott Purcell
><[EMAIL PROTECTED]> wrote:
>  
>
>>Hello,
>>I have a form, lets say that has a select list on it.
>>Under it I have the ability to
>>[edit], [delete], [modify] or [cancel].
>>
>>Each of these buttons goes to a different 
>>
>>but the form page is set for just one of the actions. And to top this off,
I cannot do a href_link, I need to submit the form to get the selected value
from the form.
>>
>>We are using links, but they are css links (See below). One of my guys
said we could just use the javascript (see last link) and then change the
action of the form, but I was hoping there was a cleaner way.**
>>
>>Here is the actual page links.  They appear to only do a href and not a
submit, but even if they did submit, I need to change action.
>> The last one calls a javascript, changes the action and submits, but I
feel it is not clean.
>>Is there a cleaner way to handle this.
>>
>>*Optimal would be a tag that submits to a certain action:**
>>
>>New
User
>>Edit
User
>>Delete
User
>>Cancel
>>Foo
Bar**
>>
>>I am sorry for all questions in this regard, but I could use some help.
>>
>>Scott
>>
>>
>>
>>
>
>-
>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: Place message in jsp from action?

2005-03-23 Thread Fogleson, Allen
You can do this

1) create an ActionMessages object and populate it with the
ActionMessage you wish to show.

2) in the jsp include the following snippet:


  

  ${message}

  


You can of course format that however you want.

Al


-Original Message-
From: Scott Purcell [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 23, 2005 4:25 PM
To: user@struts.apache.org
Subject: Place message in jsp from action?

Hello,
 
After I complete a successful Action, and I forward to my jsp page, I
would like to display a status ... something like "New User Added".
 
Something that operates like the ActionErrors object. I tried doing this
in my Action class:
ActionErrors errors = new ActionErrors();
  // Get access to the message resources for this application
  // There's not an easy way to access the resources from an
ActionForm
  MessageResources resources =
(MessageResources)request.getAttribute( Action.MESSAGES_KEY );
  // Check and see if the access number is missing
  ActionError newError = new
ActionError("global.error.database.problem");
  errors.add(ActionErrors.GLOBAL_ERROR, newError);
 
And then tried to pull the error out (just like an form error), but the
error never shows? 

 
I figured I am missing something, or possibly there is a better way to
handle this?
 
Thanks,
Scott
 

. 
 

 

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



Re: Place message in jsp from action?

2005-03-23 Thread Jason Lea




I think you are missing the save :)

try something like this:


ActionMessages messages = new ActionMessages();
MessageResources resource = getResources(request);
...
messages.add(ActionMessages.GLOBAL_MESSAGE, new
ActionMessage("global.error.database.problem"));
saveMessages(request, messages);

then in the jsp




ActionErrors are being deprecated (from what i recall) and replaced
with ActionMessages.


Scott Purcell wrote:

  Hello,
 
After I complete a successful Action, and I forward to my jsp page, I would like to display a status ... something like "New User Added".
 
Something that operates like the ActionErrors object. I tried doing this in my Action class:
ActionErrors errors = new ActionErrors();
  // Get access to the message resources for this application
  // There's not an easy way to access the resources from an ActionForm
  MessageResources resources =
(MessageResources)request.getAttribute( Action.MESSAGES_KEY );
  // Check and see if the access number is missing
  ActionError newError = new ActionError("global.error.database.problem");
  errors.add(ActionErrors.GLOBAL_ERROR, newError);
 
And then tried to pull the error out (just like an form error), but the error never shows? 

 
I figured I am missing something, or possibly there is a better way to handle this?
 
Thanks,
Scott
 

. 
 

 

  


-- 
Jason Lea




No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.8.1 - Release Date: 2005.03.23

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

RE: Place message in jsp from action?

2005-03-23 Thread Nidel, Mike
Just having learned this last week, it's fresh in my mind.
Looks like you are missing the call to

this.saveErrors(errors);


this puts the ActionErrors into the request for your JSP
to display.

The other thing I'd say is that ActionErrors is deprecated;
you might use ActionMessages instead, which works EXACTLY
the same way. Then you would use

this.saveMessages(messages);


Good luck,

Mike


PS - not sure you need to get the MessageResources explicitly
 -- maybe that's used by other code further down your class?


> -Original Message-
> From: Scott Purcell [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, March 23, 2005 5:25 PM
> To: user@struts.apache.org
> Subject: Place message in jsp from action?
> 
> 
> Hello,
>  
> After I complete a successful Action, and I forward to my jsp 
> page, I would like to display a status ... something like 
> "New User Added".
>  
> Something that operates like the ActionErrors object. I tried 
> doing this in my Action class:
> ActionErrors errors = new ActionErrors();
>   // Get access to the message resources for this application
>   // There's not an easy way to access the resources from 
> an ActionForm
>   MessageResources resources =
> (MessageResources)request.getAttribute( Action.MESSAGES_KEY );
>   // Check and see if the access number is missing
>   ActionError newError = new 
> ActionError("global.error.database.problem");
>   errors.add(ActionErrors.GLOBAL_ERROR, newError);
>  
> And then tried to pull the error out (just like an form 
> error), but the error never shows? 
> 
>  
> I figured I am missing something, or possibly there is a 
> better way to handle this?
>  
> Thanks,
> Scott
>  
> 
> . 
>  
> 
>  
> 

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



Place message in jsp from action?

2005-03-23 Thread Scott Purcell
Hello,
 
After I complete a successful Action, and I forward to my jsp page, I would 
like to display a status ... something like "New User Added".
 
Something that operates like the ActionErrors object. I tried doing this in my 
Action class:
ActionErrors errors = new ActionErrors();
  // Get access to the message resources for this application
  // There's not an easy way to access the resources from an ActionForm
  MessageResources resources =
(MessageResources)request.getAttribute( Action.MESSAGES_KEY );
  // Check and see if the access number is missing
  ActionError newError = new ActionError("global.error.database.problem");
  errors.add(ActionErrors.GLOBAL_ERROR, newError);
 
And then tried to pull the error out (just like an form error), but the error 
never shows? 

 
I figured I am missing something, or possibly there is a better way to handle 
this?
 
Thanks,
Scott
 

. 
 

 


Re: html: tag four buttons, one action problem

2005-03-23 Thread Jason King
Another thing you could do is use a js onclick handler to change the 
 element's action.
  // I'm better 
at the html/js end so you'll have to figure out how to html:submit this.

function edit_onclick( oBtn ) {
  var frm = oBtn.form ; // reference to the html form the submit button 
is in.
   frm.action = "/editaction.do" ;   // the stuff in the quotes should 
probably be replaced by some html: reference to fix the url.
   return true;
}

Folashade Adeyosoye wrote:
I am currently doing the same my project...
here is it...
it involves using javascript to change the buttonAction
1. must have a hidden field buttonAction
2. each (Button) submit button must have a property
3. when you click on the button the JS is involked and the hidden
filed buttonAction is set and the form is submitted
4. in your Java class, get the value of the button, if task1, do
task1, if task2 do task 2
hope that helps
-

function DoSomething(button)
{
 document.forms[0].buttonAction.value=button.value;
 document.forms[0].submit();
}

-

 
	
   
   />
		   
	  
   />
		   
   
 
   
      
   
   <%--
 
   
   --%>
	


-

On Wed, 23 Mar 2005 14:58:56 -0600, Scott Purcell
<[EMAIL PROTECTED]> wrote:
 

Hello,
I have a form, lets say that has a select list on it.
Under it I have the ability to
[edit], [delete], [modify] or [cancel].
Each of these buttons goes to a different 
but the form page is set for just one of the actions. And to top this off, I 
cannot do a href_link, I need to submit the form to get the selected value from 
the form.
We are using links, but they are css links (See below). One of my guys said we 
could just use the javascript (see last link) and then change the action of the 
form, but I was hoping there was a cleaner way.**
Here is the actual page links.  They appear to only do a href and not a submit, 
but even if they did submit, I need to change action.
The last one calls a javascript, changes the action and submits, but I feel it 
is not clean.
Is there a cleaner way to handle this.
*Optimal would be a tag that submits to a certain action:**
New 
User
   Edit 
User
   Delete 
User
   Cancel
   Foo 
Bar**
I am sorry for all questions in this regard, but I could use some help.
Scott
   

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




Re: EL Mystery

2005-03-23 Thread Jason Lea




hmm, having said that, it might be weird if the default behaviour was
to filter.

eg comparing

"${company.name} is cool"

and 

"${company.name} is cool"
${companyName}

would have the second one filtered twice.

It might be possible to only filter when not inside a tag.  But that
might then look inconsistant.  bah.


Jason Lea wrote:

  
  
The default for bean:write and c:out is to filter the content.  Both
can have filtering turned off if you wish.
  
Shame the ${} notation filter by default :(
  
I didn't notice that in the documentation and assumed I could replace
all my c:out's with ${} which is nicer to write.  Would be nice if they
changed this behaviour in the next version.
  


-- 
Jason Lea




No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.8.1 - Release Date: 2005.03.23

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

Re: EL Mystery

2005-03-23 Thread Folashade Adeyosoye
Or try escaping the 


true of false depending


hope that helps...


On Wed, 23 Mar 2005 15:56:02 -0500, Jeff Beal <[EMAIL PROTECTED]> wrote:
> On Wed, 23 Mar 2005 19:38:39 +, [EMAIL PROTECTED]
> <[EMAIL PROTECTED]> wrote:
> 
> > Can some one shed some light on this mystery? Also I have heard that using 
> > EL outside of tags can be a security problem and that it is better to use a 
> >  instead.
> 
> The security part of this was mentioned on the list sometime in the
> last couple of weeks.  The  tags will escape any
> HTML-sensitive characters, but the straight EL language does not.  So,
> let's say that your variable 'EL' that you were using is a String:
> ""
> 
>  would print:
>  and the user would
> just see the characters -- no harm done.
> 
> ${EL} would just print the String, and whatever script is included in
> 'nastybad.js' would be executed on the end-user's machine.
> 
> If you are confident that the contents of your EL variable couldn't
> possibly have any harmful HTML in them, go ahead and use ${EL}.
> 
> --
> Jeff Beal
> Webmedx, Inc.
> Pittsburgh, PA USA
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
>

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



Re: html: tag four buttons, one action problem

2005-03-23 Thread Folashade Adeyosoye
I am currently doing the same my project...


here is it...

it involves using javascript to change the buttonAction

1. must have a hidden field buttonAction
2. each (Button) submit button must have a property
3. when you click on the button the JS is involked and the hidden
filed buttonAction is set and the form is submitted
4. in your Java class, get the value of the button, if task1, do
task1, if task2 do task 2


hope that helps

-

function DoSomething(button)
{
  document.forms[0].buttonAction.value=button.value;
  document.forms[0].submit();
}


-


  
 


   
  
   

  

   

<%--
  

--%>



-



On Wed, 23 Mar 2005 14:58:56 -0600, Scott Purcell
<[EMAIL PROTECTED]> wrote:
> Hello,
> I have a form, lets say that has a select list on it.
> Under it I have the ability to
> [edit], [delete], [modify] or [cancel].
> 
> Each of these buttons goes to a different 
> 
> but the form page is set for just one of the actions. And to top this off, I 
> cannot do a href_link, I need to submit the form to get the selected value 
> from the form.
> 
> We are using links, but they are css links (See below). One of my guys said 
> we could just use the javascript (see last link) and then change the action 
> of the form, but I was hoping there was a cleaner way.**
> 
> Here is the actual page links.  They appear to only do a href and not a 
> submit, but even if they did submit, I need to change action.
>  The last one calls a javascript, changes the action and submits, but I feel 
> it is not clean.
> Is there a cleaner way to handle this.
> 
> *Optimal would be a tag that submits to a certain action:**
> 
> New 
> User
> Edit 
> User
> Delete 
> User
> Cancel
> Foo 
> Bar**
> 
> I am sorry for all questions in this regard, but I could use some help.
> 
> Scott
> 
>

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



Re: EL Mystery

2005-03-23 Thread Jason Lea




The default for bean:write and c:out is to filter the content.  Both
can have filtering turned off if you wish.

Shame the ${} notation filter by default :(

I didn't notice that in the documentation and assumed I could replace
all my c:out's with ${} which is nicer to write.  Would be nice if they
changed this behaviour in the next version.



Leon Rosenberg wrote:

   
So, it's as much of security risk as bean:write? I mean you could turn the
filter off and get the same effect?

Leon

  
  
Von: Jeff Beal [mailto:[EMAIL PROTECTED]] 
Gesendet: Mittwoch, 23. März 2005 21:56
An: Struts Users Mailing List
Betreff: Re: EL Mystery

On Wed, 23 Mar 2005 19:38:39 +, 
[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:



  Can some one shed some light on this mystery? Also I have 
  

heard that using EL outside of tags can be a security problem 
and that it is better to use a  instead.

The security part of this was mentioned on the list sometime 
in the last couple of weeks.  The  tags will escape 
any HTML-sensitive characters, but the straight EL language 
does not.  So, let's say that your variable 'EL' that you 
were using is a String:
" would print:
 and the user 
> would just see the characters -- no harm done.
> 
> ${EL} would just print the String, and whatever script is 
> included in 'nastybad.js' would be executed on the end-user's machine.
> 
> If you are confident that the contents of your EL variable 
> couldn't possibly have any harmful HTML in them, go ahead and 
> use ${EL}.
> 
> --
> Jeff Beal
> Webmedx, Inc.
> Pittsburgh, PA USA
> 
> -
> 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: EL Mystery

2005-03-23 Thread Leon Rosenberg
 
So, it's as much of security risk as bean:write? I mean you could turn the
filter off and get the same effect?

Leon

> Von: Jeff Beal [mailto:[EMAIL PROTECTED] 
> Gesendet: Mittwoch, 23. März 2005 21:56
> An: Struts Users Mailing List
> Betreff: Re: EL Mystery
> 
> On Wed, 23 Mar 2005 19:38:39 +, 
> [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> 
> > Can some one shed some light on this mystery? Also I have 
> heard that using EL outside of tags can be a security problem 
> and that it is better to use a  instead.
> 
> The security part of this was mentioned on the list sometime 
> in the last couple of weeks.  The  tags will escape 
> any HTML-sensitive characters, but the straight EL language 
> does not.  So, let's say that your variable 'EL' that you 
> were using is a String:
> ""
> 
>  would print:
>  and the user 
> would just see the characters -- no harm done.
> 
> ${EL} would just print the String, and whatever script is 
> included in 'nastybad.js' would be executed on the end-user's machine.
> 
> If you are confident that the contents of your EL variable 
> couldn't possibly have any harmful HTML in them, go ahead and 
> use ${EL}.
> 
> --
> Jeff Beal
> Webmedx, Inc.
> Pittsburgh, PA USA
> 
> -
> 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]



html: tag four buttons, one action problem

2005-03-23 Thread Scott Purcell
Hello,
I have a form, lets say that has a select list on it.
Under it I have the ability to
[edit], [delete], [modify] or [cancel].
 
Each of these buttons goes to a different 
 
but the form page is set for just one of the actions. And to top this off, I 
cannot do a href_link, I need to submit the form to get the selected value from 
the form.
 
We are using links, but they are css links (See below). One of my guys said we 
could just use the javascript (see last link) and then change the action of the 
form, but I was hoping there was a cleaner way.**
 
Here is the actual page links.  They appear to only do a href and not a submit, 
but even if they did submit, I need to change action.
 The last one calls a javascript, changes the action and submits, but I feel it 
is not clean.
Is there a cleaner way to handle this.
 
*Optimal would be a tag that submits to a certain action:**
 
 
New 
User
Edit 
User
Delete 
User
Cancel
Foo 
Bar**
 
 
I am sorry for all questions in this regard, but I could use some help.
 
Scott
 
 


Re: EL Mystery

2005-03-23 Thread Jeff Beal
On Wed, 23 Mar 2005 19:38:39 +, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:

> Can some one shed some light on this mystery? Also I have heard that using EL 
> outside of tags can be a security problem and that it is better to use a 
>  instead.

The security part of this was mentioned on the list sometime in the
last couple of weeks.  The  tags will escape any
HTML-sensitive characters, but the straight EL language does not.  So,
let's say that your variable 'EL' that you were using is a String:
""

 would print:
 and the user would
just see the characters -- no harm done.

${EL} would just print the String, and whatever script is included in
'nastybad.js' would be executed on the end-user's machine.

If you are confident that the contents of your EL variable couldn't
possibly have any harmful HTML in them, go ahead and use ${EL}.

-- 
Jeff Beal
Webmedx, Inc.
Pittsburgh, PA USA

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



RE: Problem with hot deployment

2005-03-23 Thread Mark Bennett
For anyone who experiences this problem there is a fix.

http://forums.bea.com/bea/message.jspa?messageID=202463602&tstart=0

Mark

-Original Message-
From: Mark Bennett [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 22, 2005 3:04 PM
To: Struts-Users
Subject: Problem with hot deployment


I'm trying to use hot deployment on an exploded archive with Weblogic 8 and
struts 1.2.  Whenever I modify and recompile an Action I get an exception.

Does this look familiar to anyone?  Thanks!

Mark


java.lang.ClassCastException
at
org.apache.struts.action.ActionServlet.getProcessorForModule(ActionServlet.j
ava:605)
at 
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1160)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(Servle
tStubImpl.java:1006)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:419)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:315)
at
weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(W
ebAppServletContext.java:6718)
at
weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubjec
t.java:321)
at
weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
at
weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletCo
ntext.java:3764)
at
weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java
:2644)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)





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



logic:iterate Question

2005-03-23 Thread Mike Darretta
Folks,
Thanks in advance for answering this urgent question. I know it's basic, but 
I'm stumped...your help is appreciated.
I am trying to update data displayed via a  tag with nested 
 tags:
   
  type="package.name.AssetReportEntryValue">
   
   
   
   
   
   

Whenever I submit the updated form, I expect the 
'report.entries[x].numCorrected' bean property to be updated. Instead, the 
original property value is maintained.
I tried setting the bean name to "assetReportForm.report", but got the infamous 
"Cannot find bean in any scope" error.
Any help is appreciated.
Thanks,
Mike

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


RE: Action Question

2005-03-23 Thread Scott Piker
Should also point out that it's usually better to use
mapping.getInputForward() in these situations (instead of defining a
"failure" forward), since validator will always redirect the user back
to the "input" location if there's a validation error (and this is
usually the same place you want them to go for business rule
violations). 

Only time you wouldn't want to do this is if you're sending the user to
a different page/form to "fix" the business rule errors (e.g. rule
overrides).  But if the intention is to send them back to their original
form with their original data, use the input mapping.

- Scott

-Original Message-
From: Fogleson, Allen [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 23, 2005 1:26 PM
To: Struts Users Mailing List
Subject: RE: Action Question

Before forwarding to failure try this... 

Action:

  Public ActionForward execute(Mapping mapping Form form, ...) {

YourFormClass newuserbeanform = (YourFormClass)form;
.
.
.

boolean recordInsert = userbo.insertNewUser();
 
//By The way this looks backwards... I thought true was a success???
if (recordInsert) {
  request.setAttribute("newuserbean", newuserbeanform);
  actionforward = mapping.findForward("Failure");
} else {
  actionforward = mapping.findForward("Success");
}

That will make the current form available to the jsp and it should show
the data you have in it.

Al



-Original Message-
From: Scott Purcell [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 23, 2005 11:55 AM
To: user@struts.apache.org
Subject: Action Question

Hello,
 
I have a form, which has an attached bean. I am doing validation, so I
have good data going to my action.
 
In the action, I take the bean with good data, and hand it to a DTO
object which updates the database with the new user supplied
information. What can I do in the Action if my DTO object returns false
(Could not update database because of some condition).  I know I can
find a mapping and send it somewhere, but the user just filled out a
large form, and I would like to send them back to the form, where the
data is, and show them a message there. I tried using the Failure (see
below) but when it goes to the newUser.jsp page it is blank. The data
they just entered is not there.
 
 
I know how to do this in a ActionForm, but how in an Action?
 
Here is my action mapping:

  
  


 
Here is the action piece.
BeanUtils.copyProperties(usersbean, userbo);
boolean recordInsert = userbo.insertNewUser();
 
if (recordInsert) {
  actionforward = mapping.findForward("Failure");
} else {
  actionforward = mapping.findForward("Success");
}
return actionforward;
 
I just would like to be able to return them to their form where they
just entered all the data, and let them try again.
 
Thanks,
Scott

 

 

-
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: EL Mystery

2005-03-23 Thread Benedict, Paul C
Kurt,

JSP 2.0 containers have EL turned off implicitly if you are not using the
Servlet 2.4 spec. Check the top of your web.xml file -- if you see it is
referencing the 2.3 DTD, you need to change it the 2.4 schema.

Thanks,
Paul

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 23, 2005 2:39 PM
To: user@struts.apache.org
Subject: EL Mystery


I have been trying to solve a mystery concerning EL. 

We are using 4 taglibs in our project:

<%-- JSTL tag libs --%>
<%@ taglib prefix="fmt" uri="/WEB-INF/fmt.tld" %>
<%@ taglib prefix="c" uri="/WEB-INF/c.tld" %>

<%-- Struts provided Taglibs --%>
<%@ taglib prefix="html" uri="/WEB-INF/struts-html-el.tld" %>
<%@ taglib prefix="logic" uri="/WEB-INF/struts-logic-el.tld" %>

They are working fine and respond to EL included in their tags.

However, if we try to use EL outside of a tag it simply renders the EL into
the HTML.

${login.fullName} appears as ${login.fullName} on the rendered page.

 renders as the user full name.

In trying to track down why the naked EL won't work I added
isELIgnored="false" to the page directive for the page and if we are not
using any tags with EL in them it works. The naked EL will render what we
are expecting. But as soon as we have a tag with EL in a value or other
attribute the page will error on compile.

I'm confused because I thought EL was active by default and it does work in
our tags but not  outside of any tags. Once we place the isELIgnored="false"
in the page directive the EL works outside of the tags but fails when used
inside some of the tags.

Can some one shed some light on this mystery? Also I have heard that using
EL outside of tags can be a security problem and that it is better to use a
 instead.

Thanks,
Kurt

--
Kurt Williams
Marex Services
[EMAIL PROTECTED]

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





--
Notice:  This e-mail message, together with any attachments, contains 
information of Merck & Co., Inc. (One Merck Drive, Whitehouse Station, New 
Jersey, USA 08889), and/or its affiliates (which may be known outside the 
United States as Merck Frosst, Merck Sharp & Dohme or MSD and in Japan, as 
Banyu) that may be confidential, proprietary copyrighted and/or legally 
privileged. It is intended solely for the use of the individual or entity named 
on this message.  If you are not the intended recipient, and have received this 
message in error, please notify us immediately by reply e-mail and then delete 
it from your system.
--

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



EL Mystery

2005-03-23 Thread kurt . e . williams
I have been trying to solve a mystery concerning EL. 

We are using 4 taglibs in our project:

<%-- JSTL tag libs --%>
<%@ taglib prefix="fmt" uri="/WEB-INF/fmt.tld" %>
<%@ taglib prefix="c" uri="/WEB-INF/c.tld" %>

<%-- Struts provided Taglibs --%>
<%@ taglib prefix="html" uri="/WEB-INF/struts-html-el.tld" %>
<%@ taglib prefix="logic" uri="/WEB-INF/struts-logic-el.tld" %>

They are working fine and respond to EL included in their tags.

However, if we try to use EL outside of a tag it simply renders the EL into the 
HTML.

${login.fullName} appears as ${login.fullName} on the rendered page.

 renders as the user full name.

In trying to track down why the naked EL won't work I added isELIgnored="false" 
to the page directive for the page and if we are not using any tags with EL in 
them it works. The naked EL will render what we are expecting. But as soon as 
we have a tag with EL in a value or other attribute the page will error on 
compile.

I'm confused because I thought EL was active by default and it does work in our 
tags but not  outside of any tags. Once we place the isELIgnored="false" in the 
page directive the EL works outside of the tags but fails when used inside some 
of the tags.

Can some one shed some light on this mystery? Also I have heard that using EL 
outside of tags can be a security problem and that it is better to use a  instead.

Thanks,
Kurt

--
Kurt Williams
Marex Services
[EMAIL PROTECTED]

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



RE: Action Question

2005-03-23 Thread Fogleson, Allen
Before forwarding to failure try this... 

Action:

  Public ActionForward execute(Mapping mapping Form form, ...) {

YourFormClass newuserbeanform = (YourFormClass)form;
.
.
.

boolean recordInsert = userbo.insertNewUser();
 
//By The way this looks backwards... I thought true was a success???
if (recordInsert) {
  request.setAttribute("newuserbean", newuserbeanform);
  actionforward = mapping.findForward("Failure");
} else {
  actionforward = mapping.findForward("Success");
}

That will make the current form available to the jsp and it should show
the data you have in it.

Al



-Original Message-
From: Scott Purcell [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 23, 2005 11:55 AM
To: user@struts.apache.org
Subject: Action Question

Hello,
 
I have a form, which has an attached bean. I am doing validation, so I
have good data going to my action.
 
In the action, I take the bean with good data, and hand it to a DTO
object which updates the database with the new user supplied
information. What can I do in the Action if my DTO object returns false
(Could not update database because of some condition).  I know I can
find a mapping and send it somewhere, but the user just filled out a
large form, and I would like to send them back to the form, where the
data is, and show them a message there. I tried using the Failure (see
below) but when it goes to the newUser.jsp page it is blank. The data
they just entered is not there.
 
 
I know how to do this in a ActionForm, but how in an Action?
 
Here is my action mapping:

  
  


 
Here is the action piece.
BeanUtils.copyProperties(usersbean, userbo);
boolean recordInsert = userbo.insertNewUser();
 
if (recordInsert) {
  actionforward = mapping.findForward("Failure");
} else {
  actionforward = mapping.findForward("Success");
}
return actionforward;
 
I just would like to be able to return them to their form where they
just entered all the data, and let them try again.
 
Thanks,
Scott

 

 

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



Re: HTML Tag Users Guide

2005-03-23 Thread Dave Newton
Scott Purcell wrote:
following up with my select-list issue, I ended up with this next question. First off, I have been referencing the HTML tag users guide. But to be honest, it does me little use, as it does not show how to use the html:select tags, etc. Some make sense, but most do not. I am probably like others, I like to see examples, and put the logic together in that way.
 

I'm not trying to be a weenie, but I'm not sure where you ran into 
problems--the HTML API guide pretty much states precisely what needs to 
be passed to the "options" tag in order to make it work. Where did you 
and the docs diverge in understanding? (I might be mis-remembering your 
original issue, too, so feel free to whap me :)

I'll admit that sometimes the docs are sparse, but "options" especially 
seems to be pretty complete in its description for both its main use cases.

And, as always, especially on the Wiki, we can always add our own 
documentation once we figure something out, which is kinda cool :) 
Perhaps if it isn't already there we could start a thread (what are they 
called in wiki world?) with specific examples for features, like for the 
"options" tag there'd be a fragment from an Action then a bit of JSP etc.

Dave

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


Action Question

2005-03-23 Thread Scott Purcell
Hello,
 
I have a form, which has an attached bean. I am doing validation, so I have 
good data going to my action.
 
In the action, I take the bean with good data, and hand it to a DTO object 
which updates the database with the new user supplied information. What can I 
do in the Action if my DTO object returns false (Could not update database 
because of some condition).  I know I can find a mapping and send it somewhere, 
but the user just filled out a large form, and I would like to send them back 
to the form, where the data is, and show them a message there. I tried using 
the Failure (see below) but when it goes to the newUser.jsp page it is blank. 
The data they just entered is not there.
 
 
I know how to do this in a ActionForm, but how in an Action?
 
Here is my action mapping:

  
  


 
Here is the action piece.
BeanUtils.copyProperties(usersbean, userbo);
boolean recordInsert = userbo.insertNewUser();
 
if (recordInsert) {
  actionforward = mapping.findForward("Failure");
} else {
  actionforward = mapping.findForward("Success");
}
return actionforward;
 
I just would like to be able to return them to their form where they just 
entered all the data, and let them try again.
 
Thanks,
Scott

 

 


[OT] JDBC -- batch inserts & generated keys

2005-03-23 Thread Erik Weber
I have a (MySQL) batch insert scenario where I need to retrieve all the 
generated keys. What is the best approach for this? Can I take advantage 
of the new "return generated keys" feature for this?

Here are three approaches I can think of. I haven't tried any of them 
yet. Figured someone here might save me the trouble of trying all these 
one at a time.

1) could be painfully slow, but seems likely to work, and would yield 
the best error handling/recovery possibilities:

ps = c.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS);
for (int x = 0; x < n; x++) {
 ps.set(1, var[x]);
 checkResult(ps.executeUpdate());
 rs = ps.getGeneratedKeys();
 if (rs.next()) {
   list.add(rs.get(1));
 }
}
2) Would be somewhat faster and would still enable good error 
handling/recovery; will this work?

ps = c.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS);
for (int x = 0; x < n; x++) {
 ps.set(1, var[x]);
 checkResult(ps.executeUpdate());
}
rs = ps.getGeneratedKeys();
while (rs.next()) {
 list.add(rs.get(1));
}
3) Would be fastest, but would sacrifice flexibility in error 
handling/recovery (possibly); will this work?

ps = c.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS);
for (int x = 0; x < n; x++) {
 ps.set(1, var[x]);
 ps.addBatch();
}
checkResults(ps.executeBatch());
rs = ps.getGeneratedKeys();
while (rs.next()) {
 list.add(rs.get(1));
}
Thanks,
Erik

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


REPOST: Relative URLs

2005-03-23 Thread tarek.nabil
Can someone please advise me on this issue.

Thanks

-Original Message-
From: tarek.nabil 
Sent: Saturday, March 19, 2005 10:14 AM
To: user@struts.apache.org
Subject: Relative URLs

Hi everyone,

Can someone please explain how to build relative URLs that are higher in
the file hierarchy than the module. For example

/
/images/some-image.gif
/some-action.do
/folder/some-jsp.jsp

I'm building this application inside an existing application that does
not use Struts. I can not change the location of images or stylesheet
and I can not duplicate them. I get the HTMLs from the graphic designer
with the stylesheets and images as relative URLs, e.g.
../images/some-image.gif.

I thought that for the images, I can solve it with the html:img tag, but
then I discovered that I have some td tags with an image background.

I thought about URL re-writing, and then I found out I only have two
options:
1- Specify a forward for every image which is time consuming and
tedious.
2- Use the page attribute, which means that the module has to be on the
same level as the images, because the documentation states that the page
attribute has to start with a "/".

In my application, I go to the JSP directly and then through an action.
Since they're both on different levels, when I go through the action,
the images disappear. I thought about going to the JSP through an action
all the time, but I then I thought I could still face a problem if I
ever decide to switch to multiple modules.

For example, in the above setup, I would use the page attribute and
write page=3D"/images/some-image.gif". But then if I ever decide to use
multiple modules and moved my action to /some-module/some-action.do I
will not be able to change the page attribute because I can NOT say (as
far as I understand) page=3D"../images/some-image.gif".

Can someone please help me with this problem.

Thanks,
Tarek

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



Validation only occurs client side

2005-03-23 Thread tarek.nabil
Hi,

I'm having a really weird problem. This is the first time I use the
Validator. I expected to have some problems with client side
validations, but what I found was client side validations are working
but server side validations aren't!!

The fact that client-side validations work, I think, means that I've
done the configuration correctly. But why isn't it doing anything on the
server side?!!!

I made sure that validate is set to true on my action tags. I double
checked everything else and I believe everything is done correctly. Any
ideas?

validator-rules.xml --> the default

validation.xml has only a single formset element

   

  
 
 
 
 
  
  
   

struts-config.xml

  

  
  

  
  
  
  

  
  
  
  



I don't have any validate methods in my ApplicantForm class which
extends ValidatorForm.

Every help is appreciated.

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



Re: The F5 problem - Best Practice (ActionHierarchy)

2005-03-23 Thread Leon Rosenberg
On Wed, 2005-03-23 at 09:20 -0500, Brandon Mercer wrote:

This was exactly the second approach, the redirect approach :-)

Leon

> You could forward to a list action.  Something like this maybe. 
> 
> 
> 
> 
> 
>parameter="/user.html"/>
> 
>  type="org.springframework.web.struts.DelegatingActionProxy"
>   name="userForm" scope="request" parameter="method"
> validate="method">
>  
>  
> 
> 
> That way even if they do hit the ole' F5 all it does is reload the
> list.  If you want more information about doing this, or need to see
> some source code check out the equinox-struts example from:
> https://equinox.dev.java.net/servlets/ProjectDocumentList?folderID=2867&expandFolder=2867&folderID=2572
> 
> This app was found on www.raibledesigns.com/wiki/
> 
> Hope this helps.
> Brandon
> 
> 
> -
> 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: The F5 problem - Best Practice (ActionHierarchy)

2005-03-23 Thread Brandon Mercer
Bernd Schiffer wrote:

> Hi Leon.
>
> I did what you mentioned as the second approach and used a token
> (precisely: locking mechanism, because in my case it's not "delete"
> but "edit") to avoid F5 problems. But I'm not happy with that,
> because, you already said that, the user sees "edit.do" in the URL and
> not "view.do", but "view.do" is the currrent action, and not
> "edit.do", so it does not come up to user's expectations and that's
> the major point, I think. Please let me know if you find a appropriate
> solution.
>
>   Bernd
>
> Leon Rosenberg schrieb:
>
>> Hi,
>>
>> I have a problem which I think is common to many of the developers
>> one the
>> list, and where I'd like to hark to your opinions / solutions.
>
>
> I think it's a common use case in web applications, where you have to
> present a list of something, lets say a list of bikes.
> You have normally some common functionality, like ShowList, Edit/New
> (presents a dialog), Create/Update and  a Delete operation.
> Now my problem is, that after delete,create or update I normally show the
> updated list, by actually executing the Show action.
>
> I know about two ways to implement this derive the delete action from
> show
> action, and call super.execute(), or send a redirect from delete
> action to the show action.
>
> Example:
>  type="net.anotheria.bikes.action.ShowBikesAction"
> scope="request">
> 
> 
>  type="net.anotheria.bikes.action.DeleteBikeAction" scope="request">
> 
> 
>
> After bikeDelete has been called, it calls the super.execute from
> ShowBikesAction it's extending, and the updated list is presented. Works
> fine ... until the user hits the refresh button. Since the url in the
> browser is bikeDelete and not bikesShow the delete action will be
> called again. It's getting even worser with create action
> which then would actually create a second record.
>
> Now, I could avoid creating second object or trying to delete already
> deleted object by inserting an execute-once-tokens, but it feels
> like fixing a bad design, so I'd like to avoid it.
>
> Another approach I know of, is to define the delete action without a
> forward
> and actually send a redirect after the deletion is complete. This would
> solve the F5 problem, but produces an additional request from browser to
> server, and makes the whole app slower.
>
> Do you know any other solutions? I have searched for an opportunity to
> solve
> this problem with a tricky js, actually replacing the url of the
> current document in the browser without request, but i found
> none :-(
>
> Any other ideas, options?

You could forward to a list action.  Something like this maybe. 








 
 


That way even if they do hit the ole' F5 all it does is reload the
list.  If you want more information about doing this, or need to see
some source code check out the equinox-struts example from:
https://equinox.dev.java.net/servlets/ProjectDocumentList?folderID=2867&expandFolder=2867&folderID=2572

This app was found on www.raibledesigns.com/wiki/

Hope this helps.
Brandon


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



Re: HTML Tag Users Guide

2005-03-23 Thread Erik Weber
I don't know if there is anything like it for Struts tags, but Sue 
Spielman's "JSTL Practical Guide for JSP Programmers" (Morgan Kaufmann) 
is exactly what you are looking for if you also use JSTL tags. It's 200 
pages, example-based and 20 bucks.

Erik
Scott Purcell wrote:
Hello,
following up with my select-list issue, I ended up with this next question. 
First off, I have been referencing the HTML tag users guide. But to be honest, 
it does me little use, as it does not show how to use the html:select tags, 
etc. Some make sense, but most do not. I am probably like others, I like to see 
examples, and put the logic together in that way.
Finally late last night I was able to get the select-list stuff to work, but it was 
through a hack and stealing of code. I ended up using something that was a 
"LabelValueBean" and passing it values.
I own the O'Reilly struts book, and have read it many times, and through this, 
I understand how the framework works. The book is great at getting an 
understanding of the framework, but it does not go into any detail of using 
tags within the framework. The problem I am having now, is that I am wasting a 
ton of time with the logic: html: and bean: tags. I can populate my 
ActionForms, pass off to the Action  classes, but I am having trouble, or a 
lack of understanding, how to cleanly populate my JSP pages from the 
ActionForms for lists, selects, etc.
Does anyone know of any books, or links that spend some time on combining 
all these tags, struts, etc to create a full streamlined struts application? I 
shopped Amazon last night, but none seem to stand out for myself.
Thanks,
Scott


-Original Message-
From: Richard Bywater [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 22, 2005 11:13 PM
To: Struts Users Mailing List
Subject: Re: select list issues:
I assume you know about the HTML tag Users Guide?
(http://struts.apache.org/userGuide/struts-html.html)
Richard.
On Tue, 22 Mar 2005 14:35:25 -0600, Scott Purcell
<[EMAIL PROTECTED]> wrote:
 

Hello,
I am trying to do something pretty simple I would think. I am also trying to 
use html:select tags, logic, etc. to keep the project uniform.
I have a jsp page that I need to show a set of users in a select list.
So I have an action that creates a bean in memory and does not validate.

 
 

In the foo.WorkAsUser Class, I am doing a query and grabbing the data into a 
Vector:
Then I cast the form (in this action) class back to the usersbean (type).
eg:
com.UsersBean usersbean = (UsersBean)form;
Then I am setting the bean with the Vector.
usersbean.setSelectVector(vector);
So at this point, I believe to have a good vector of String names options, in 
the usersBean.
Now in the JSP page how do I incorporate this bean into something like this:
   
 
   
I cannot find the answer. I do have a form tag in this jsp page that calls once 
again for this usersbean: So I know I own the bean in the request scope, but 
how do put all this data into a select list?
Any ideas
Thanks,
Scott
   

-
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: HTML Tag Users Guide

2005-03-23 Thread Marsh-Bourdon, Christopher
Scott

Can I make a suggestion that if you want to find out about a Tag (or set of)
that you open the .tld and have a read through it.  Most tag properties
(especially in the Struts HTML tags) are quite clear from their labels.
This isn't always the case, but certainly with the ones that come with
Struts, you can kind of work them out. Those Struts HTML tag properties are
mostly pass thru to the underlying HTML tags, so it is relatively simple to
get a grasp of if you know the HTML tag itself.

I'd have a look at Bill Siggelkow's Jakarta Struts Cookbook, which covers
both 1.1 and 1.2 of Struts.

Cheers

Christopher Marsh-Bourdon
www.marsh-bourdon.com

-Original Message-
From: Scott Purcell [mailto:[EMAIL PROTECTED] 
Sent: 23 March 2005 13:56
To: Struts Users Mailing List; Richard Bywater
Subject: HTML Tag Users Guide


Hello,

following up with my select-list issue, I ended up with this next question.
First off, I have been referencing the HTML tag users guide. But to be
honest, it does me little use, as it does not show how to use the
html:select tags, etc. Some make sense, but most do not. I am probably like
others, I like to see examples, and put the logic together in that way.

Finally late last night I was able to get the select-list stuff to work, but
it was through a hack and stealing of code. I ended up using something that
was a "LabelValueBean" and passing it values.

I own the O'Reilly struts book, and have read it many times, and through
this, I understand how the framework works. The book is great at getting an
understanding of the framework, but it does not go into any detail of using
tags within the framework. The problem I am having now, is that I am wasting
a ton of time with the logic: html: and bean: tags. I can populate my
ActionForms, pass off to the Action  classes, but I am having trouble, or a
lack of understanding, how to cleanly populate my JSP pages from the
ActionForms for lists, selects, etc.


Does anyone know of any books, or links that spend some time on combining
all these tags, struts, etc to create a full streamlined struts application?
I shopped Amazon last night, but none seem to stand out for myself.

Thanks,
Scott






-Original Message-
From: Richard Bywater [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 22, 2005 11:13 PM
To: Struts Users Mailing List
Subject: Re: select list issues:


I assume you know about the HTML tag Users Guide?
(http://struts.apache.org/userGuide/struts-html.html)

Richard.

On Tue, 22 Mar 2005 14:35:25 -0600, Scott Purcell
<[EMAIL PROTECTED]> wrote:
> Hello,
> 
> I am trying to do something pretty simple I would think. I am also trying
to use html:select tags, logic, etc. to keep the project uniform.
> I have a jsp page that I need to show a set of users in a select list.
> 
> So I have an action that creates a bean in memory and does not validate.
> type="foo.WorkAsUser"
>   scope="request"
>   name="usersbean"
>   validate="false"
>   input="/jsp/admin/mainAdmin.jsp">
>   
>   
>  
> 
> In the foo.WorkAsUser Class, I am doing a query and grabbing the data into
a Vector:
> Then I cast the form (in this action) class back to the usersbean (type).
> 
> eg:
> com.UsersBean usersbean = (UsersBean)form;
> Then I am setting the bean with the Vector.
> 
> usersbean.setSelectVector(vector);
> 
> So at this point, I believe to have a good vector of String names options,
in the usersBean.
> 
> Now in the JSP page how do I incorporate this bean into something like
this:
> 
>   
> 
> 
> I cannot find the answer. I do have a form tag in this jsp page that calls
once again for this usersbean: So I know I own the bean in the request
scope, but how do put all this data into a select list?
> 
> Any ideas
> 
> Thanks,
> Scott
> 
>

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



The information contained herein is confidential and is intended solely for the
addressee. Access by any other party is unauthorised without the express
written permission of the sender. If you are not the intended recipient, please
contact the sender either via the company switchboard on +44 (0)20 7623 8000, or
via e-mail return. If you have received this e-mail in error or wish to read our
e-mail disclaimer statement and monitoring policy, please refer to 
http://www.drkw.com/disc/email/ or contact the sender. 3167



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

HTML Tag Users Guide

2005-03-23 Thread Scott Purcell
Hello,

following up with my select-list issue, I ended up with this next question. 
First off, I have been referencing the HTML tag users guide. But to be honest, 
it does me little use, as it does not show how to use the html:select tags, 
etc. Some make sense, but most do not. I am probably like others, I like to see 
examples, and put the logic together in that way.

Finally late last night I was able to get the select-list stuff to work, but it 
was through a hack and stealing of code. I ended up using something that was a 
"LabelValueBean" and passing it values.

I own the O'Reilly struts book, and have read it many times, and through this, 
I understand how the framework works. The book is great at getting an 
understanding of the framework, but it does not go into any detail of using 
tags within the framework. The problem I am having now, is that I am wasting a 
ton of time with the logic: html: and bean: tags. I can populate my 
ActionForms, pass off to the Action  classes, but I am having trouble, or a 
lack of understanding, how to cleanly populate my JSP pages from the 
ActionForms for lists, selects, etc.


Does anyone know of any books, or links that spend some time on combining all 
these tags, struts, etc to create a full streamlined struts application? I 
shopped Amazon last night, but none seem to stand out for myself.

Thanks,
Scott






-Original Message-
From: Richard Bywater [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 22, 2005 11:13 PM
To: Struts Users Mailing List
Subject: Re: select list issues:


I assume you know about the HTML tag Users Guide?
(http://struts.apache.org/userGuide/struts-html.html)

Richard.

On Tue, 22 Mar 2005 14:35:25 -0600, Scott Purcell
<[EMAIL PROTECTED]> wrote:
> Hello,
> 
> I am trying to do something pretty simple I would think. I am also trying to 
> use html:select tags, logic, etc. to keep the project uniform.
> I have a jsp page that I need to show a set of users in a select list.
> 
> So I have an action that creates a bean in memory and does not validate.
> type="foo.WorkAsUser"
>   scope="request"
>   name="usersbean"
>   validate="false"
>   input="/jsp/admin/mainAdmin.jsp">
>   
>   
>  
> 
> In the foo.WorkAsUser Class, I am doing a query and grabbing the data into a 
> Vector:
> Then I cast the form (in this action) class back to the usersbean (type).
> 
> eg:
> com.UsersBean usersbean = (UsersBean)form;
> Then I am setting the bean with the Vector.
> 
> usersbean.setSelectVector(vector);
> 
> So at this point, I believe to have a good vector of String names options, in 
> the usersBean.
> 
> Now in the JSP page how do I incorporate this bean into something like this:
> 
>/>
> 
> 
> I cannot find the answer. I do have a form tag in this jsp page that calls 
> once again for this usersbean: So I know I own the bean in the request scope, 
> but how do put all this data into a select list?
> 
> Any ideas
> 
> Thanks,
> Scott
> 
>

-
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 webapp caused out of memory after some reload

2005-03-23 Thread Joe Germuska
At 10:38 PM -0500 3/22/05, James Mitchell wrote:
Struts does not provide this sort of thing.
Actually, I just added a call to PropertyUtils.clearDescriptors() to 
ActionServlet.destroy() on the 1.2.x branch yesterday, which causes a 
call to Introspector.flushCaches().  From the javadoc for the 
IntrospectorCleanupListener, it sounds like that's all it does.

This is referenced in Bug 
http://issues.apache.org/bugzilla/show_bug.cgi?id=14042

Note that in this bug, Wendy S. reported that even implementing this 
in her own code did not resolve the memory leak issues, although 
Tobias L. said that it did.

Since at this time there are no known cleanup steps which Struts 
should be taking,  I closed that ticket, but if anyone can provide 
more information about potential leaks, that ticket could be reopened 
or a new one created.

In the meantime, using the IntrospectorCleanupListener is probably 
the easiest way to get that done without having to patch code -- I 
can't see any reason it would be a problem.  There are a couple of 
other things which happen in PropertyUtils.clearDescriptors() -- if 
you wanted to be more complete, you might write a simple 
ServletContextListener modeled on the Spring one which called 
PropertyUtils.clearDescriptors() in its contextDestroyed() method. 
That might gain you a little bit more.

Joe

In the environments that I typically work in, production releases 
are handled by a release manager(s).  When a new release goes out, 
the server is usually brought down and the new build is pushed out, 
then brought back up. This being done after normal working hours of 
course.

I'd be interested to hear if you are using it successfully in a 
production environment.  I'd also be interested in how many times 
and why you need to reload a production application.  Using 
something like this during development is a no-brainer, but I was 
just wondering.
--
Joe Germuska
[EMAIL PROTECTED]  
http://blog.germuska.com
"Narrow minds are weapons made for mass destruction"  -The Ex

Re: [HELP] How could I catch and process Errors in Struts + iBatis + DAO?

2005-03-23 Thread Yuniar Setiawan
There is a good example at
http://www.reumann.net/struts/ibatisLesson1.do about this. download
the sample war and look inside.

cheers


On Wed, 23 Mar 2005 17:31:53 +0700, Pham Anh Tuan <[EMAIL PROTECTED]> wrote:
> Hi,
> 
> I don't know how to catch and process errors in Struts + iBatis + DAO.
> 
> Anyone here can help me, plz :(
> 
> thank for ur reading.
> 
> Tuan
>

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



[HELP] How could I catch and process Errors in Struts + iBatis + DAO?

2005-03-23 Thread Pham Anh Tuan
Hi,

I don't know how to catch and process errors in Struts + iBatis + DAO.

Anyone here can help me, plz :(

thank for ur reading.

Tuan

Re: multi-page validation form

2005-03-23 Thread Jack Perrett
Yes, that's right. I mean that the form is passing the validation - which
can only mean that the validation is ignoring the validation rules
associated with the pages, otherwise it would fail.
The action does have validate set to true. And if I remove all references to
the page then all the validation rules are used albeit on the wrong pages -
and the validation fails - which is exactly as I would expect.
Maybe the StrutsTest is the problem - although I don't see why

- Original Message - 
From: <[EMAIL PROTECTED]>
To: 
Sent: Tuesday, March 22, 2005 8:52 PM
Subject: RE: multi-page validation form


> Apologies for not reading more closely.  And now that I have, I'm a little
> confused.  Your original post said "But it just seems to ignore this
validation
> whatever I set the form page property to".  But below, you say "the form
always
> gets validated. Even when the page is set to a number where the fields
have not
> been set".
>
> Are the validations firing, just not when you expect, or not firing at
all?  If
> not at all, have your set "validate" to "true" in your  def in
> struts-config? (BTW, if I'm off in the weeds, let me know that too.  I've
done
> this with a collection of JSP pages sharing a form def, but not via
StrutsTest.)
>
> Jay
> http://www.vtgroup.com/
>
>
>
> -Original Message-
> From: Jack Perrett [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, March 22, 2005 11:58 AM
> To: Struts Users Mailing List
> Subject: Re: multi-page validation form
>
> No. I don't actually have a jsp page.
> I'm generating a form in a StrutsTest and then testing what my action does
> with it. It looks like this:
>
> public void testAction() {
>   setRequestPathInfo("/myAction.do");
>   setActionForm(populateForm());
>   actionPerform();
>   verifyForward("correctActionForward");
>   verifyNoActionErrors();
> }
>
> public form populateForm()  {
>   MyForm form = new MyForm();
>   form.setMyField1();
>   form.setMyField2();
>   form.setPage(1); // This sets the page variable in the form
>   return form;
> }
>
> So anyway, the form always gets validated. Even when the page is set to a
> number where the fields have not been set
> any ideas?
>
>
> - Original Message - 
> From: <[EMAIL PROTECTED]>
> To: 
> Sent: Tuesday, March 22, 2005 5:28 PM
> Subject: RE: multi-page validation form
>
>
> > Having done exactly the same thing, I know it works (though it's been a
> while so
> > I'm trying to remember everthing I've done).  Do you also have a page
> number
> > defined for the Javascript include tag e.g.
> >
> >
> >
> > Jay
> > http://www.vtgroup.com/
> >
> >
> > -Original Message-
> > From: Brandon Mercer [mailto:[EMAIL PROTECTED]
> > Sent: Tuesday, March 22, 2005 11:15 AM
> > To: Struts Users Mailing List
> > Subject: Re: multi-page validation form
> >
> > Jack Perrett wrote:
> >
> > >All the previous form properties are set using the StrutsTest so all
the
> > >required fields are in the form. This is not the issue however, the
> > >validation is just plain ignoring the validation, whatever the form
> property
> > >is set to - it should at least be performing the valiadtion on the
fields
> > >with the correct page value but is just ignoring these.
> > >The documentation her does suggest that it will perfrom the validation
on
> > >any fields with a page property set less than or equal to the form page
> > >
> > >
> > Ahhh yes, but you said GREATER than or equal to with the logic you
> > wrote.  I was just making sure ;-).  Another thing I'd check is to see
> > if there are any typo's in the validation.xml file.  Make sure the form
> > defined in the struts-config is the same as the one in the
> > validation.xml... I've had that cause validation not work.  Other than
> > that, I don't think I can offer much more help.  Good luck!
> > Brandon
> >
> > >property
> > >http://struts.apache.org/userGuide/dev_validator.html
> > >
> > >
> > >
> > >- Original Message - 
> > >From: "Brandon Mercer" <[EMAIL PROTECTED]>
> > >To: "Struts Users Mailing List" 
> > >Sent: Tuesday, March 22, 2005 4:29 PM
> > >Subject: Re: multi-page validation form
> > >
> > >
> > >
> > >
> > >>Jack Perrett wrote:
> > >>
> > >>
> > >>
> > >>>Thanks for gettig back to me so quickly.
> > >>>I am actually setting the hidden page property. I'm using a
StrutsTest
> so
> > >>>the jsp doesn't actually exist at the moment but I'm creating a form,
> and
> > >>>setting the fields, and then using
> > >>>
> > >>>   form.setPage(2);
> > >>>
> > >>>to set the this property. So I'm effectively submitting a form with
the
> > >>>hidden page property set to 2.
> > >>>any ideas what else could be stopping it?
> > >>>
> > >>>- Original Message - 
> > >>>From: "Brandon Mercer" <[EMAIL PROTECTED]>
> > >>>To: "Struts Users Mailing List" 
> > >>>Sent: Tuesday, March 22, 2005 4:04 PM
> > >>>Subject: Re: multi-page validation form
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>
> > Jack Perrett wrote:
> > 
> > 
> > 

Struts tag to get Distinct values in vector

2005-03-23 Thread damerla.rojarani

Hi All,

I am printing all the values of the vector using logic:iterate. I want
to get only the distinct values from this vector.
Is there any way to do this using tag properties.

Any help is greatly appreciated.

Thanks in Advance,

Regards,
Roja.




Confidentiality Notice

The information contained in this electronic message and any attachments to 
this message are intended
for the exclusive use of the addressee(s) and may contain confidential or 
privileged information. If
you are not the intended recipient, please notify the sender at Wipro or [EMAIL 
PROTECTED] immediately
and destroy all copies of this message and any attachments.

Re: The F5 problem - Best Practice (ActionHierarchy)

2005-03-23 Thread Bernd Schiffer
Hi Leon.
I did what you mentioned as the second approach and used a token 
(precisely: locking mechanism, because in my case it's not "delete" but 
"edit") to avoid F5 problems. But I'm not happy with that, because, you 
already said that, the user sees "edit.do" in the URL and not "view.do", 
but "view.do" is the currrent action, and not "edit.do", so it does not 
come up to user's expectations and that's the major point, I think. 
Please let me know if you find a appropriate solution.

  Bernd
Leon Rosenberg schrieb:
Hi,
I have a problem which I think is common to many of the developers one the
list, and where I'd like to hark to your opinions / solutions.
I think it's a common use case in web applications, where you have to
present a list of something, lets say a list of bikes.
You have normally some common functionality, like ShowList, Edit/New
(presents a dialog), Create/Update and  a Delete operation.
Now my problem is, that after delete,create or update I normally show the
updated list, by actually executing the Show action.
I know about two ways to implement this derive the delete action from show
action, and call super.execute(), or send a redirect from 
delete action to the show action.

Example: 







After bikeDelete has been called, it calls the super.execute from
ShowBikesAction it's extending, and the updated list is presented. Works
fine ... until the user hits the refresh button. Since the url in the
browser is bikeDelete and not bikesShow the delete 
action will be called again. It's getting even worser with create action
which then would actually create a second record.

Now, I could avoid creating second object or trying to delete already
deleted object by inserting an execute-once-tokens, but it feels
like fixing a bad design, so I'd like to avoid it.
Another approach I know of, is to define the delete action without a forward
and actually send a redirect after the deletion is complete. This would
solve the F5 problem, but produces an additional request from browser to
server, and makes the whole app slower.
Do you know any other solutions? I have searched for an opportunity to solve
this problem with a tricky js, actually replacing 
the url of the current document in the browser without request, but i found
none :-(

Any other ideas, options? 

Thanx in advance
Regards
Leon


-
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: Problems using JSTL with struts

2005-03-23 Thread Kalra, Ashwani

IMO your EL is not getting evaluated. You can go through this link for more info

http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JSPIntro13.html




Table 12-5 EL Evaluation Settings for JSP Pages 

JSP Configuration
Page Directive
isELIgnored
EL Encountered

Unspecified
Unspecified
Evaluated if 2.4 web.xml
Ignored if <= 2.3 web.xml

false
Unspecified
Evaluated

true
Unspecified
Ignored

Overridden by page directive
false
Evaluated

Overridden by page directive
true
Ignored

/Ashwani







> -Original Message-
> From: Tom Ziemer [ mailto:[EMAIL PROTECTED]
> Sent: Wednesday, March 23, 2005 1:44 PM
> To: Struts Users Mailing List
> Subject: Re: Problems using JSTL with struts
>
>
> Hi again!
>
> Maybe you can try to deploy the (jstl) standard-examples.war from the
> jakarta project. If that doesn't work, your appserver is causing this
> problem.
>
> If these examples work, compare your web.xml to the one from the
> standard-examples.war. I am quite sure it's just a little mistake in
> your configuration that is responsible for this error.
>
> Hope this helps,
>
> Tom
>
> Rodolfo García Esteban/CYII wrote:
> > I have done that and I keep having the same problem. I'm
> completly loose.
> > 
> > Rodolfo García Esteban
> > Canal Isabel II
> > División de Aplicaciones Técnicas
> > C/ Santa Engracia, 125
> > Edificio 8
> > Tel. 91 545 10 00 - Ext. 2128
> > Fax. 91 545 14 41
> > ___
> >
> >
> >
> >
> > Tom Ziemer <[EMAIL PROTECTED]>
> > 18/03/2005 11:00
> > Por favor, responda a "Struts Users Mailing List"
> >
> >
> > Para:   Struts Users Mailing List 
> > cc: (cco: Rodolfo García Esteban/CYII)
> > Asunto: Re: Problems using JSTL with struts
> >
> >
> > Hi,
> >
> > I had a similar problem. What I did was:
> > a) put jstl.jar and standard.jar in WEB-INF/lib
> > b) modify your web.xml - it should start with this line:
> >
> > http://java.sun.com/xml/ns/j2ee";
> > xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance";
> > xsi:schemaLocation=" http://java.sun.com/xml/ns/j2ee
> web-app_2_4.xsd"
> > version="2.4">
> >
> > When I used my "old" web.xml with "web-app_2_2.dtd", it
> didn't work. Can
> > anybody explain this?
> >
> > Regards,
> >
> > Tom
> >
> > Rodolfo García Esteban/CYII wrote:
> >
> >>Hi,
> >>
> >>I have a little application done with struts 1.2 and
> hibernate 2.1, I
> >
> > want
> >
> >>to migrate it to JSTL 2.0, and struts-EL. I have done the next:
> >>
> >>1. Install jstl, adding to the WEB-INF/lib jstl.jar
> >>2. Writing in the pages then taglib clause to import the tags.
> >>
> >>But I have the next problems.
> >>
> >>1 when I do  for get the actionForm return null, I
> can manage
> >
> > the
> >
> >>form.
> >>2. when I do  don't see then
> >>content of , I see as a literal "${}".
> >>
> >>Has somebody use JSTL and Struts-EL with Struts 1.2? Do
> somebody knows
> >
> > the
> >
> >>solution for my problem?
> >>
> >>I would apreciatte any help
> >>
> >>Best regards
> >>
> >>Rodolfo
> >>
> >
> >
> >
> -
> > 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]
>
>


This message contains information that may be privileged or confidential and is 
the property of the Capgemini Group. It is intended only for the person to whom 
it is addressed. If you are not the intended recipient,  you are not authorized 
to read, print, retain, copy, disseminate,  distribute, or use this message or 
any part thereof. If you receive this  message in error, please notify the 
sender immediately and delete all  copies of this message.


Re: Problems using JSTL with struts

2005-03-23 Thread Tom Ziemer
Hi again!
Maybe you can try to deploy the (jstl) standard-examples.war from the 
jakarta project. If that doesn't work, your appserver is causing this 
problem.

If these examples work, compare your web.xml to the one from the 
standard-examples.war. I am quite sure it's just a little mistake in 
your configuration that is responsible for this error.

Hope this helps,
Tom
Rodolfo García Esteban/CYII wrote:
I have done that and I keep having the same problem. I'm completly loose.

Rodolfo García Esteban
Canal Isabel II
División de Aplicaciones Técnicas
C/ Santa Engracia, 125
Edificio 8
Tel. 91 545 10 00 - Ext. 2128
Fax. 91 545 14 41
___

Tom Ziemer <[EMAIL PROTECTED]>
18/03/2005 11:00
Por favor, responda a "Struts Users Mailing List"
 
Para:   Struts Users Mailing List 
cc: (cco: Rodolfo García Esteban/CYII)
Asunto: Re: Problems using JSTL with struts

Hi,
I had a similar problem. What I did was:
a) put jstl.jar and standard.jar in WEB-INF/lib
b) modify your web.xml - it should start with this line:
http://java.sun.com/xml/ns/j2ee"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee web-app_2_4.xsd" 
version="2.4">

When I used my "old" web.xml with "web-app_2_2.dtd", it didn't work. Can 
anybody explain this?

Regards,
Tom
Rodolfo García Esteban/CYII wrote:
Hi,
I have a little application done with struts 1.2 and hibernate 2.1, I 
want 

to migrate it to JSTL 2.0, and struts-EL. I have done the next:
1. Install jstl, adding to the WEB-INF/lib jstl.jar 
2. Writing in the pages then taglib clause to import the tags.

But I have the next problems.
1 when I do  for get the actionForm return null, I can manage 
the 

form.
2. when I do 

Has somebody use JSTL and Struts-EL with Struts 1.2? Do somebody knows 
the 

solution for my problem?
I would apreciatte any help
Best regards
Rodolfo

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