Re: Simple ActionError question

2004-02-25 Thread Carl Walker
You ActionError constructor takes additional parameters.  Here's a sample from some 
code that passes two parameters to a message I'm working
on.  In my example, if the user tries to insert a group with the same name as one in 
the DB, an error is thrown and html:errors is used to
display the errors to the user

In the resources.properties file there is the following entry

errors.unique={0} has already been used as a {1}

There are two parameters I'm passing to the resource.  Since there are many places in 
the code where I could get a unique constraint
violation, I pass the field name along with the field name value to prompt the user.

The code follows...
try {
dao.insertSomething(groupName)
}
catch(SQLException exc) {

servlet.log("[InsertSomething] - WARNING: error inserting " +
groupName + " msg: " + exc.getMessage());

if( exc.getErrorCode() == 1 ) {  // constraint violation

ActionErrors errors = new ActionErrors();
ActionError error = new ActionError( "errors.unique", groupName, 
"Group Name" );
errors.add( ActionErrors.GLOBAL_ERROR, error );
_request.setAttribute( Globals.ERROR_KEY, errors );

fwd = new ActionForward( _mapping.getInput() );
}
}


Theodosios Paschalidis wrote:

> Hi all,
>
> just a newbie question. I have a PlaceOrderAction and I want to display as an 
> ActionError the items that were out of stock.
>
> I would like to be able to pass a String to my ActionError. Is there a way to do 
> this may using Format? Could somebody provide an example?
>
> Suppose I have a string outOfStock = "title1"
>
> I want to have an effect equivelant to
> new ActionError("outofstock"));
>new ActionError(outOfStock));
>
> if I had new ActionError(error.outofstock));
> and in my resources error.outofstock = {0}
>
> How would I pass my string value?
>
> Thank you for your time,
> Theo


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



Re: RE: Extra Lines in Compiled JSP

2004-02-23 Thread Carl Walker
I wrote a filter to strip these lines out.  My application returned a CSV document 
that looked strange in Excel with all of the blank lines caused by the various JSP 
constructs that aren't visible to the user.  In my case, the rendering of the 
whitespace in the document is important.  You're right that this is not usually a 
problem with HTML and browsers.

Here's the filter and a supporting class

// BlankLineFilter.java
package mypackage.filter;

import java.io.BufferedReader;
import java.io.PrintWriter;
import java.io.StringReader;
import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletResponse;

public class BlankLineFilter implements Filter
{
public void init(FilterConfig _config) {}

public void doFilter(ServletRequest _request,
 ServletResponse _response,
 FilterChain _chain)
throws IOException, ServletException
{
PrintWriter out = _response.getWriter();

CharResponseWrapper wrapper = new 
CharResponseWrapper((HttpServletResponse)_response);

_chain.doFilter(_request, wrapper);

StringReader sr = new StringReader(wrapper.toString());
BufferedReader br = new BufferedReader(sr);
String line = null;
while( (line = br.readLine()) != null ) {
if( line.trim().equals("") ==  false )
out.println( line );
}
br.close();
}

public void destroy() {}
}
// end of BlankLineFilter.java

// CharResponseWrapper.java
package mypackage.filter;

import java.io.PrintWriter;
import java.io.CharArrayWriter;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServletResponseWrapper;

public class CharResponseWrapper extends HttpServletResponseWrapper
{
private CharArrayWriter output;

public CharResponseWrapper(HttpServletResponse _response) {
super(_response);
output = new CharArrayWriter();
}

public String toString() {
return output.toString();
}

// have filter caller fill up 'output'
public PrintWriter getWriter() {
return new PrintWriter(output);
}
}
// end of CharResponseWrapper.java

To hook this up to your app, use the following web.xml file.

BlankLineFilter
mypackage.BlankLineFilter
  

  
BlankLineFilter
/myjsp.jsp
  




- Original Message -
From: Jerry Jalenak <[EMAIL PROTECTED]>
Date: Friday, February 20, 2004 4:56 pm
Subject: RE: Extra Lines in Compiled JSP

> Thanks to everyone and for their comments.
> 
> What I was seeing were several blank lines at the top of my 
> rendered page -
> lines that I could not account for in the html code.  After 
> scratching my
> head for a few days, it occurred to me that the number of blank 
> lines being
> rendered were the same number of lines as my <% taglib %>'s - in 
> this case
> seven lines.  Opening up the compiled JSP I found where it was 
> putting seven
> out.write() statements.  I know the browser should ignore 
> successive white
> space like this, but in my case it wasn't (this is an IE 6 
> browser).  
> 
> We're running Tomcat 5.0.18 and J2SDK 1.4.2.
> 
> Jerry Jalenak
> Development Manager, Web Publishing
> LabOne, Inc.
> 10101 Renner Blvd.
> Lenexa, KS  66219
> (913) 577-1496
> 
> [EMAIL PROTECTED]
> 
> 
> > -Original Message-
> > From: Piper, James D CECOM SEC EPS
> > [EMAIL PROTECTED]
> > Sent: Friday, February 20, 2004 3:48 PM
> > To: 'Adam Hardy'; Struts Users Mailing List
> > Subject: RE: Extra Lines in Compiled JSP
> > 
> > 
> > Why do you have this problem with extra lines in your html 
> > generated by the
> > <%@ %> section of your jsp and I do not - I use JBOSS and 
> > WebLogic both --
> > never saw this problem?
> > 
> > - Jim
> > 
> > 
> > -Original Message-
> > From: Adam Hardy [EMAIL PROTECTED]
> > Sent: Friday, February 20, 2004 3:42 PM
> > To: Struts Users Mailing List
> > Subject: Re: Extra Lines in Compiled JSP
> > 
> > 
> > Perhaps it was in the taglibs-user mailing list where I dreamt it?
> > 
> > Maybe I'm searching for the wrong key-words - I've looked for 
> 'white 
> > space' and 'blank lines' but not found anything. Perhaps it 
> > was even on 
> > this list?
> > 
> > Check this link for a filter solution:
> > 
> > http://www.mail-archive.com/[EMAIL PROTECTED]/ms
> > g03824.html
> > 
> > On 02/20/2004 08:14 PM Gopalakrishnan, Jayesh wrote:
> > > I am talking abt generated output(HTML/csv/email/whatever). If 
> > > the question was abt generated java code, nobody should care.
> > > 
> > > The generated output contains newlines for every <% %> 
> enclosure 
> > > in the JSP. And if you are generating anything other 
> > > than HTML output, thats likely to cause a problem.
> > > 
> > > We did this for our export

Re: can tiles be put in a jar?

2004-02-18 Thread Carl Walker
The glitch is that you have to work with the mappings.  You can't freely type
JSP code into a directory without thinking about how its deployed.  You'll
have to write scripts that compile your JSPs, probably JAR the JSPs, and
generate sections of your web.xml file and merge those sections in with the
static parts (taglibs, ActionServlet).

Precompiling the JSPs means that Tomcat will not have to fork off a javac.
This is important to us because the Solaris fork duplicates the image of the
parent Tomcat process (at over 200Mb) so a javac process to compile 500bytes
of JSP fragment creates a second 200Mb process.  We ran out of swap space one
day and some of the application threw up a Jasper error.  So, we now deploy
only precompiled webapps.

One note about the mappings...You should try to mimic what you have now.  For
example, mywebapp/jspfrag.jspf should still access the same code whether you
are using a JSP or a precompiled JSP (a servlet).  So, the url-pattern would
continue to read /tiles/FooTitle.jspf.  This allows you to construct links
and test in a manner that isn't locked to a particular deployment.  In
development, we work within the JSP directories so we want to compile these
as they change.

If you're still skeptical, remember that Tomcat does the same thing
on-the-fly.

Mark Lowe wrote:

> Umm
>
> I like the sound of that. I haven't thought it through fully yet so
> there could be some glitch i've missed. just to complement the
> suggestion (other than having an ant task the fire everything up) you
> could have xdoclet comments to generate your web.xml
>
> <%
> /**
>   *
>   * @web.servlet
>   * name="FooTile"
>   * display-name="FooTile"
>   * description="My tile"
>   * load-on-startup="3"
>   *
>   * @web.servlet-mapping
>   * url-pattern="/tiles/FooTile"
>   */
> %>
>
> Something still doesn't smell right though, tiles-defs? and maybe
> struts config? Perhaps have the a tile attribute in your definition of
> type page that calls the servlet mapping.
>
> 
>
> Okay.. so that theory seems okay. what about tiles with forms?
>
> what about the form paths? and then mapping those in struts config to
> tiles defs (by way of forwards, assuming thats the way one would want
> to do things). and the additional problem of multiple forms on one
> page?
>
> I'll ponder some more..
>
> On 18 Feb 2004, at 15:47, Carl Walker wrote:
>
> > Compile the tiles into .java files, compile these files into .class
> > files
> > and jar them up.  You'll need to add servlet mappings to every webapp's
> > web.xml, though.
> >
> > Here's the test JSP I'm working with (called myjsp.jsp).
> >
> > <%@ page session="false" %>
> > <%@ page import="java.util.Date" %>
> >
> > 
> > 
> > Hi, the date is <%= new Date() %>
> > 
> > 
> >
> > The directory structure I have is
> > ./classes/
> > ./jsp/
> > ./jsp/myjsp.jsp
> > ./src
> >
> > The command to precompile the JSP
> > $  jspc.sh -d src/com/yourpackage -p com.yourpackage -uriroot jsp
> > -webxml
> > web.xml jsp/myjsp.jsp
> >
> > The directory structure is now
> > ./classes
> > ./jsp/myjsp.jsp
> > ./src/com/yourpackage/myjsp_jsp.java
> >
> > Then run this...
> > $ $ javac -classpath
> > $CATALINA_HOME/common/lib/servlet.jar:$CATALINA_HOME/common/lib/
> > jasper-runtime.jar
> > \^J-d classes src/com/yourpackage/myjsp_jsp.java
> >
> > "Raymaker, Dora" wrote:
> >
> >> Hello, I am wondering if tiles can be put in a jar so that they become
> >> accessible to multiple struts applications.  Any information would be
> >> much appreciated!
> >>
> >>
> >>
> >> Thanks,
> >>
> >>
> >>
> >> Dora Raymaker
> >>
> >> Sr. Technical Writer
> >>
> >> XO Communications, Interactive Division
> >>
> >> 503.972.6808
> >>
> >> [EMAIL PROTECTED]
> >>
> >>
> >
> >
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


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



Re: Validator and DispatchAction

2004-02-18 Thread Carl Walker
I ran into the same problem and converted all my DispatchActions to
Actions.  The downside is that there are more class files, but the mappings
seem cleaner, especially in handling the 'input' attribute for .

Also, using Actions lets me specify different values for the 'validate'
attribute.  For example, I use the same form to lookup a records as I do to
update it.  In the case of the lookup, the Action pulls an identifier from
the DynaActionForm that doesn't need to be validated (validate=false for
this mapping).  In the case of the update, full validation of all fields is
required, so validate=true for this one.

Renato Romano wrote:

> I'm quite new to the validator framework, and was trying to figure out
> how to use it. My situation is:
> 1) I want to perform server side validation, and so I made my form
> extend ValidatorForm;
> 2) the action that processes my form is a DispatchAction, so I have
> methods like "edit", "save" "list", all associated with the same form;
> 3) I call http://blabla/myapp/myAction.do?methodName=edit to have the
> app present me with an empty form;
> 4) When processing this action, struts allocates the form and calls the
> validate method, which of course causes validation errors to be
> produced, and the request to be forwarded to the "input" element of my
> action, which, as usual, is the same jsp which contains the form;
> 5) since the page finds some errors (the form is empty!!) they are shown
> by the  tag.
>
> The only think I can imagine is to have a separate action in
> struts-config, which takes no form and simply redirects control to the
> jsp page which shows the (html) form. This should avoid Struts from
> calling the validate method, and hence  should show
> nothing.
>
> Of course this would change a bit the logic we already placed in the
> application actions: for example action.do?methodName=edit in our
> architecture should present an empty form, while action.do?m=edit&id=88
> should fill the form with the properties of the object with id 88, and
> then forward to the same jsp page, which then shows that object ready to
> be modified. If my above consideration is correct I should define two
> separate actions in struts-config, and let the links be something like
> newObject.do (for the presentation of an empty form) and unchanged for
> the "loading" of an object.
>
> Is all this correct ?Are there alternative approaches? Should I quit
> server side validation and only use client-side (which does not suffer
> from this problem)?
> Any help is very appreciated.
>
> Renato
>
> 
> Renato Romano
> Sistemi e Telematica S.p.A.
> Calata Grazie - Vial Al Molo Giano
> 16127 - GENOVA
>
> e-mail: [EMAIL PROTECTED]
> Tel.:   010 2712603
> _
>
> -
> 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: can tiles be put in a jar?

2004-02-18 Thread Carl Walker
Compile the tiles into .java files, compile these files into .class files
and jar them up.  You'll need to add servlet mappings to every webapp's
web.xml, though.

Here's the test JSP I'm working with (called myjsp.jsp).

<%@ page session="false" %>
<%@ page import="java.util.Date" %>



Hi, the date is <%= new Date() %>



The directory structure I have is
./classes/
./jsp/
./jsp/myjsp.jsp
./src

The command to precompile the JSP
$  jspc.sh -d src/com/yourpackage -p com.yourpackage -uriroot jsp -webxml
web.xml jsp/myjsp.jsp

The directory structure is now
./classes
./jsp/myjsp.jsp
./src/com/yourpackage/myjsp_jsp.java

Then run this...
$ $ javac -classpath
$CATALINA_HOME/common/lib/servlet.jar:$CATALINA_HOME/common/lib/jasper-runtime.jar
\^J-d classes src/com/yourpackage/myjsp_jsp.java

"Raymaker, Dora" wrote:

> Hello, I am wondering if tiles can be put in a jar so that they become
> accessible to multiple struts applications.  Any information would be
> much appreciated!
>
>
>
> Thanks,
>
>
>
> Dora Raymaker
>
> Sr. Technical Writer
>
> XO Communications, Interactive Division
>
> 503.972.6808
>
> [EMAIL PROTECTED]
>
>


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



Re: RE: RE: Javscript

2004-02-12 Thread Carl Walker
Try these entries in validation.xml.

  


  datePatternStrict
  MM/dd/

  

And in the resources file

errors.date=Use 'MM/dd/' with leading zeroes for {0}


- Original Message -
From: Darren Massel <[EMAIL PROTECTED]>
Date: Thursday, February 12, 2004 9:47 am
Subject: RE: RE: Javscript

> 
> ok not quite a dream the date format is not validated although 
> thisworks with the struts validation.
> any ideas?
> 
> 
> -Original Message-
> From: Darren Massel [EMAIL PROTECTED]
> Sent: 12 February 2004 14:42
> To: 'Struts Users Mailing List'
> Subject: RE: RE: Javscript
> 
> 
> Cheers worked a dream.
> 
> 
> -Original Message-
> From: Carl Walker [EMAIL PROTECTED]
> Sent: 12 February 2004 14:31
> To: Struts Users Mailing List
> Subject: Re: RE: Javscript
> 
> 
> 
> Put these sample elements in the JSP.  Note the JavaScript 
> embedded in the
> html:form attribue.
> 
> 
> 
>onsubmit="return validateContractForm(this);">
> 
> - Original Message -
> From: Darren Massel <[EMAIL PROTECTED]>
> Date: Thursday, February 12, 2004 9:09 am
> Subject: RE: Javscript
> 
> > I've satisfied both your suggestions the javascript text no 
> longer 
> > appears.but How do i activate the JS validation? 
> > 
> > -Original Message-
> > From: Carl Walker [EMAIL PROTECTED]
> > Sent: 12 February 2004 12:34
> > To: Struts Users Mailing List
> > Subject: Re: Javscript
> > 
> > 
> > Make sure 
> > 
> > 1) that the entry in struts-config.xml matches the entry in 
> > validation.xmland that both refer to the attribute value in 
> > 
> > 
> > 2) that the validation.xml syntax is ok.  Try testing a  
> > entry with a
> > construct that you know works.  Add each new field element until 
> > you find
> > the error.  I found this problem when I cut and pasted a field 
> > definition.One field had a message with two open elements ({0} 
> and 
> > {1}), the other one
> > didn't.  When I tried to specify an arg0 AND arg1 for the 
> message 
> > with only
> > one open elemnt, html:javascript blew up
> > 
> > - Original Message -
> > From: Darren Massel <[EMAIL PROTECTED]>
> > Date: Thursday, February 12, 2004 7:29 am
> > Subject: Javscript
> > 
> > > Using struts 1.1 on Tomcat 4.1.29
> > > I want to use the Javascript validation i.e.  
>  
> > > but it goes
> > > straight to the struts validation
> > > Also all the javascript is written to the screen, unless in 
> > script 
> > > tags -
> > > which after reading the javadoc should not be needed.
> > > 
> > > Any ideas?  
> > > 
> > > 
> > > 
> > 
> *** 
> > > This email and any files transmitted with it are confidential 
> > and 
> > > intended solely for the use of the individual or entity to 
> whom 
> > > they 
> > > are addressed. Any unauthorised distribution or copying is 
> > > strictly 
> > > prohibited. 
> > > 
> > > Whilst Cedar Software Ltd takes steps to prevent the 
> > transmission 
> > > of 
> > > viruses via e-mail, we can not guarantee that any email or 
> > > attachment is free from computer viruses and you are strongly 
> > > advised to undertake your own anti-virus precautions. 
> > > 
> > > Cedar Software Ltd grants no warranties regarding performance, 
> > > use or quality of any e-mail or attachment and undertakes no 
> > > liability for loss or damage, howsoever caused. 
> > > 
> > > CedAr is a leading UK supplier of Financial, eProcurement, 
> > > Performance Management and, following the recent acquisition 
> of 
> > > Goldenhill Computer Systems Ltd, HR and Payroll software. 
> Cedars 
> > > solutions deliver increased capabilities and offer a direct 
> and 
> > > measurable financial return on investment.  The company has a 
> > > customer base of more than 500 organisations in both the 
> public 
> > > and private sector. 
> > > Particular sector strengths include Airlines, Business Services,
> > > Education, Emergency Services, Financial Services, Government, 
> > > Health, Local Authorities, Not for Profit, Retail and 
> Utilities. 
> > 
> > > For more
> > > information, please visit www.cedar.com

Re: RE: Javscript

2004-02-12 Thread Carl Walker

Put these sample elements in the JSP.  Note the JavaScript embedded in the html:form 
attribue.





- Original Message -
From: Darren Massel <[EMAIL PROTECTED]>
Date: Thursday, February 12, 2004 9:09 am
Subject: RE: Javscript

> I've satisfied both your suggestions the javascript text no longer 
> appears.but How do i activate the JS validation? 
> 
> -Original Message-----
> From: Carl Walker [EMAIL PROTECTED]
> Sent: 12 February 2004 12:34
> To: Struts Users Mailing List
> Subject: Re: Javscript
> 
> 
> Make sure 
> 
> 1) that the entry in struts-config.xml matches the entry in 
> validation.xmland that both refer to the attribute value in 
> 
> 
> 2) that the validation.xml syntax is ok.  Try testing a  
> entry with a
> construct that you know works.  Add each new field element until 
> you find
> the error.  I found this problem when I cut and pasted a field 
> definition.One field had a message with two open elements ({0} and 
> {1}), the other one
> didn't.  When I tried to specify an arg0 AND arg1 for the message 
> with only
> one open elemnt, html:javascript blew up
> 
> - Original Message -
> From: Darren Massel <[EMAIL PROTECTED]>
> Date: Thursday, February 12, 2004 7:29 am
> Subject: Javscript
> 
> > Using struts 1.1 on Tomcat 4.1.29
> > I want to use the Javascript validation i.e.   
> > but it goes
> > straight to the struts validation
> > Also all the javascript is written to the screen, unless in 
> script 
> > tags -
> > which after reading the javadoc should not be needed.
> > 
> > Any ideas?  
> > 
> > 
> > 
> *** 
> > This email and any files transmitted with it are confidential 
> and 
> > intended solely for the use of the individual or entity to whom 
> > they 
> > are addressed. Any unauthorised distribution or copying is 
> > strictly 
> > prohibited. 
> > 
> > Whilst Cedar Software Ltd takes steps to prevent the 
> transmission 
> > of 
> > viruses via e-mail, we can not guarantee that any email or 
> > attachment is free from computer viruses and you are strongly 
> > advised to undertake your own anti-virus precautions. 
> > 
> > Cedar Software Ltd grants no warranties regarding performance, 
> > use or quality of any e-mail or attachment and undertakes no 
> > liability for loss or damage, howsoever caused. 
> > 
> > CedAr is a leading UK supplier of Financial, eProcurement, 
> > Performance Management and, following the recent acquisition of 
> > Goldenhill Computer Systems Ltd, HR and Payroll software. Cedars 
> > solutions deliver increased capabilities and offer a direct and 
> > measurable financial return on investment.  The company has a 
> > customer base of more than 500 organisations in both the public 
> > and private sector. 
> > Particular sector strengths include Airlines, Business Services,
> > Education, Emergency Services, Financial Services, Government, 
> > Health, Local Authorities, Not for Profit, Retail and Utilities. 
> 
> > For more
> > information, please visit www.cedar.com 
> > 2003 CedAr Software Ltd. All Rights Reserved. 
> > Cedar Software Ltd. Incorporation number 3214465
> > 
> > 
> ***> 
> > -
> --
> > --
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> > 
> 
> 
> ---
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> ---
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


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



Re: validation.xml and java.sql.Date

2004-02-12 Thread Carl Walker
Thanks for your reply.  The problem I'm having is that the field is not required, so 
specifying a string like '1970-01-01' for an initial value isn't desirable.

- Original Message -
From: Mark Lowe <[EMAIL PROTECTED]>
Date: Thursday, February 12, 2004 8:44 am
Subject: Re: validation.xml and java.sql.Date

> You can have a string that looks like a date and validator will 
> still 
> validate it. To my knowledge there is no need to have the property 
> of 
> type Date. same is true of other types also.
> 
> 
> On 12 Feb 2004, at 14:36, Carl Walker wrote:
> 
> > Hi,
> >
> > I'm having a problem setting an initial value for a 
> DynaValidatorForm. 
> >  I have a date field that is not required to be filled in.  
> However, 
> > when I submit the form without a value, I get a Date.valueOf 
> exception 
> > thrown from SQLConverter.
> >
> > If I submit a valid value or attempt to submit a bogus (non-
> NULL) 
> > value, everything works.
> >
> > This is from my struts-config.xml file.
> >
> >  
> >
> > Here is the validation.xml entry.
> >
> >   
> > 
> > 
> >   datePatternStrict
> >   -MM-dd
> > 
> >   
> >
> >
> >
> > -
> 
> > 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]



validation.xml and java.sql.Date

2004-02-12 Thread Carl Walker
Hi,

I'm having a problem setting an initial value for a DynaValidatorForm.  I have a date 
field that is not required to be filled in.  However, when I submit the form without a 
value, I get a Date.valueOf exception thrown from SQLConverter.

If I submit a valid value or attempt to submit a bogus (non-NULL) value, everything 
works.

This is from my struts-config.xml file.

 

Here is the validation.xml entry.

  


  datePatternStrict
  -MM-dd

  



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



Re: Javscript

2004-02-12 Thread Carl Walker
Make sure 

1) that the entry in struts-config.xml matches the entry in validation.xml and that 
both refer to the attribute value in 

2) that the validation.xml syntax is ok.  Try testing a  entry with a construct 
that you know works.  Add each new field element until you find the error.  I found 
this problem when I cut and pasted a field definition.  One field had a message with 
two open elements ({0} and {1}), the other one didn't.  When I tried to specify an 
arg0 AND arg1 for the message with only one open elemnt, html:javascript blew up

- Original Message -
From: Darren Massel <[EMAIL PROTECTED]>
Date: Thursday, February 12, 2004 7:29 am
Subject: Javscript

> Using struts 1.1 on Tomcat 4.1.29
> I want to use the Javascript validation i.e.   
> but it goes
> straight to the struts validation
> Also all the javascript is written to the screen, unless in script 
> tags -
> which after reading the javadoc should not be needed.
> 
> Any ideas?  
> 
> 
> *** 
> This email and any files transmitted with it are confidential and 
> intended solely for the use of the individual or entity to whom 
> they 
> are addressed. Any unauthorised distribution or copying is 
> strictly 
> prohibited. 
> 
> Whilst Cedar Software Ltd takes steps to prevent the transmission 
> of 
> viruses via e-mail, we can not guarantee that any email or 
> attachment is free from computer viruses and you are strongly 
> advised to undertake your own anti-virus precautions. 
> 
> Cedar Software Ltd grants no warranties regarding performance, 
> use or quality of any e-mail or attachment and undertakes no 
> liability for loss or damage, howsoever caused. 
> 
> CedAr is a leading UK supplier of Financial, eProcurement, 
> Performance Management and, following the recent acquisition of 
> Goldenhill Computer Systems Ltd, HR and Payroll software. Cedars 
> solutions deliver increased capabilities and offer a direct and 
> measurable financial return on investment.  The company has a 
> customer base of more than 500 organisations in both the public 
> and private sector. 
> Particular sector strengths include Airlines, Business Services,
> Education, Emergency Services, Financial Services, Government, 
> Health, Local Authorities, Not for Profit, Retail and Utilities.  
> For more
> information, please visit www.cedar.com 
> 2003 CedAr Software Ltd. All Rights Reserved. 
> Cedar Software Ltd. Incorporation number 3214465
> 
> ***
> 
> ---
> --
> 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]



Validator and Float Validation

2003-11-25 Thread Carl Walker
Hello,

I'm having a problem using the Validator and the 'float' validation.  My
problem is that the Validator doesn't seem to work if I enter text
(letters) into the html:text box.  I am using the  tag for
error messages.

In my struts-config.xml file, I have the following definition of a
DynaValidatorForm.



In my validation.xml file, I have the corresponding element.

  

 
 
 
   min
   0.0f
 
 
   max
   5000.0f

 

Please note that the floatRange function works.  If I enter a number
like '10', I will get the appropriate error displayed by the
html:errors tag.

However, if I enter 'blah' or some other text string in the html:text
box, the form submission will associate '0.0f' (the initial value) with
the submission.

What I'd like to happen is to have an error generated if I attempt to
stuff a non-float into the html:text box.

Is this the way it's supposed to work, or am I missing something.

Thanks,
Carl Walker


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



Re: [OT] OutOfMemoryError when I have plenty of heap

2003-09-17 Thread Carl Walker
Set JAVA_OPTS=-server -verbose:gc -Xms64m -Xmx64m and test your application manually 
or using some kind
automated loop.  At some point, excessive garbage collection will take place.  Look 
for "Full GC".

If you don't see it, you may not be exercising the problem part on the application.

"Full GC" will start appearing more and more on the screen.  Eventually, you'll get 
your OutOfMemoryError.

Next, run Tomcat with JAVA_OPTS=-server -Xms64m -Xmx64m -Xrunhprof:heap=sites.  Look 
at the java.hprof.txt file
for the SITES section.  This will show you the TRACE# (location of the code) of some 
of the big object creating
methods.

Find the trace number (second to last column in the SITES section).  Go back to the 
top of the file and search
for TRACE #, where '#' is the trace number you just pulled.  Hopefully, the stack 
trace at tha point is
meaningful.  If it's not, you can increase the trace depth with 
-Xrunhprof:heap=sites,depth=5.

This should help you hone in on problem areas.

-Carl
Casey Forbes wrote:

> Hello,
>
> I haven't been able to recreate this OutOfMemoryError. It doesn't
> seem to occur in any particular place.  It happens a few times
> a month and I've written some little things to summarize and help
> me analyze the HTTP access logs and the Struts RequestProcessor logs
> but I can't find any patterns...
>
> I'm not using any JNI.
>
> I don't have a stack trace. One was not generated.
>
> Thanks,
> Casey
>
> On Wed, 17 Sep 2003, [EMAIL PROTECTED] said:
>
> >
> > I have a few questions reg the below
> >
> > Is this recreatable
> > is there a certain place where you get this OutOfMemory exception
> > Are you using JNI
> >
> > Also Can you please send the stack trace.
> >
> > Regards
> > Sreekant G
> > @ 98404-65630
> >
> >
> >
> >   Casey Forbes
> >   <[EMAIL PROTECTED]To:   [EMAIL PROTECTED]
> >   s.com>   cc:
> >Subject:  [OT] OutOfMemoryError 
> > when I have plenty of heap
> >   09/17/2003 05:51
> >   PM
> >   Please respond to
> >   "Struts Users
> >   Mailing List"
> >
> >
> >
> >
> >
> >
> > Hi everyone,
> >
> > There are many smart people on this list and I haven't been
> > able to get anywhere with this problem, so...
> >
> > I'm running 12 Struts-based apps under Resin 2 on a Linux box.
> > (I don't believe that this is a Struts problem - this is
> > just some background for you)
> >
> > Every few days (sometimes this will happen after 2 days, sometimes
> > 5 or 6) I get an OutOfMemory error which stops the JVM...
> > I have plenty of room in the heap (the machine has 1 GB or
> > RAM and I have the max heap size -Xmx set to 896 MB) Just before
> > it dies there are a few attempts to free more memory.
> > From the GC log:
> >
> > Full GC 227765K->132728K(274140K), 3.2615930 secs
> > Full GC 132729K->132728K(274140K), 2.5218730 secs
> > Full GC 132803K->120231K(274140K), 3.1998370 secs
> > OutOfMemoryError
> >
> > As you can see - I'm only using 132 MB after the first
> > GC which leaves plenty Runtime.freeMemory()
> > etc. returns similar results..
> >
> > Does anybody have any ideas? I don't even know where to look
> > next... It doesn't look like a profiler would help me here
> > since I don't have tons of objects filling up my memory.
> >
> > Thanks,
> > Casey
> >
> >
> >
> > -
> > 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: Replace scriptlet in a JSP page

2003-07-24 Thread Carl Walker
Can you rewrite SetUpLanguages to take an empty constructor?  If you can,
then you can use jsp:setProperty to take what you need from the request
object and put it in a Java Bean.

SetUpLanguages.java
---
package myclasses;
public class SetUpLanguages implements java.io.Serializable
{
public SetUpLanguages() {}

private String contentLanguage;
public String getContentLanguage() {
 return contentLanguage;
}
public void setContentLanguage(String _contentLanguage) {
 contentLanguage = _contentLanguage;
}
}

the JSP
---



Dirk Behrendt wrote:

> Hello!
>
> I have read the discussion about tag libs.
>
> No logic should be in a JSP page to fullfill the MVC concept. But I dont
> know how to replace the following scriptlet in my JSP.
>
> <%SetUpLanguages l = new SetUpLanguages(request);%>
>
> It is absolutely necessary form e application.
>
> Thank you!
>
> Dirk
>


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



Re: URLs not escaped

2003-06-27 Thread Carl Walker
Use ">... instead.

Eric Jain wrote:

> The following JSP fragment
>
>   
> 
> 
>   
>   ...
>
> generates a link with an invalid href attribute of
>
>   http://x.org/app/view?id=1&value=rdf
>
> instead of
>
>   http://x.org/app/view?id=1&value=rdf
>
> Whose fault is it?
>
> A) JSTL tag library
> B) Struts HTML-EL tag library
> C) My fault
>
> --
> Eric Jain
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


Re: How to instantiate a DynaActionForm?

2003-06-18 Thread Carl Walker
I have an org.apache.struts.validator.DynaValidatorForm called "AccountForm" in
my struts-config.xml.  The code below is similar to that found in the link
referenced below, except I call the initialize() method to get the initial=
attributes from the form bean definition.


// load up AccountForm
ModuleConfig mc = _mapping.getModuleConfig();
FormBeanConfig fbc = mc.findFormBeanConfig("AccountForm");
DynaActionFormClass dafc =
DynaActionFormClass.createDynaActionFormClass(fbc);
DynaActionForm theForm = (DynaActionForm)dafc.newInstance();

theForm.initialize( _mapping );
theForm.set("accountId", new Integer(account.getAccountId()));
theForm.set("username", account.getUsername());
theForm.set("groupslist", account.getGroupslist());
Date expTime = account.getExpTime();
if( expTime != null ) {
SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/");
theForm.set("expTime", sdf.format(expTime));
}
theForm.set("lockable", new Boolean(account.isLockable()));
theForm.set("state", new Integer(account.getState()));

_request.setAttribute("AccountForm", theForm);


"Raible, Matt" wrote:

> http://www.mail-archive.com/[EMAIL PROTECTED]/msg12356.html
>
> -Original Message-
> From: Joseph Yang [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, June 18, 2003 11:07 AM
> To: 'Struts Users Mailing List'
> Subject: How to instantiate a DynaActionForm?
>
> Hello,
>
> I have two pages: login.jsp and userProfile.jsp
>
> I defined two DynaActionForm(s) in struts-config.xml: loginForm and
> userProfileForm
>
> Now inside loginAction class, after handle the authentication, I want to get
> the user profile information from database, then instantiate userProfileForm
> and put it into the request. what I did was:
>
> DynaActionForm form = new DynaActionForm();
> form.set("firstName", "John");
> form.set("lastName", "Doe");
> ...
> request.setAttribute("userProfileForm", form);
>
> The setters throw Null pointer exception
>
> Please help me out here
>
> Thanks
>
> -
> 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: Action without a form

2003-06-18 Thread Carl Walker
This should work.  I've used the same construct before.  Make sure that myObj !=
null in the Action and that you are referencing request.getAttribute("label") in
the JSP.

-Carl

"Rachell, Morgan" wrote:

> In a JSP page, I have a link that calls an Action. Usually, this is done
> with a submit button within a form, but I need it to be a link. Apparently,
> this introduces a problem, since I'm not using a form. Basically, I want to
> click a link, execute an Action which puts some object in request scope,
> then forward to some results page.
>
> Here's the link:
>
> [ jsp snippet ]
> ...
> List Users
>
> In my struts-cfg.xml, I have
>
> 
> 
> 
>
> In the GetUsersAction class, I put an object in request scope with
> request.setAttribute( "label", myObj ), and then call
>
> return (mapping.findForward("ViewUsers"));
>
> I believe that this Action class is not being called since no log messages
> are displayed in the console and myObj is not availabe in the ViewUsers JSP.
> However the request is forwarded to the ViewUsers.jsp file. (This part
> doesn't make sense.)
>
> Is it possible for me to call an action from a link without a form, or do I
> need to use a dummy form? Or do I need to change my stuts-cfg.xml somehow?
>
> Thanks in advance.
>
> Morgan
>
> -
> 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: Token in struts and session bean.... problem with the framework ?

2003-06-18 Thread Carl Walker
I think you will end up needing both the JavaScript and some server-side
check because there are actually two problems you are facing.  The first
is if a panicky user repeatedly hits the 'Submit' button, sending multiple
requests to the server.  This is the "race" condition you describe.  It's
a problem in our apps because if the user submits the form multiple times,
he or she will get an error message 'Already Processed' because the user
will not have waited around for the 'Thanks for coming'-type page.  So, to
ease up on the customer service phone calls, use the JavaScript.

You definitely need a server-side check to prevent multiple submissions.
I haven't used the Struts token features but do a similar thing by
embedding a unique id in the form.  If the user attempts to submit the
form again (say by backing up), there will be a constraint violation.  If
I had to redo this, I'd investigate the Struts token feature and I'd
expect that (session or not) it would work.

-Carl

David Gagnon wrote:

> Hi all thanks for your answers.
>
>   I was indeed talking about ActionForm (sorry we use
> to call that a bean here :-)).
>
>   What I understand from our discussion is:
> -Thant I Can use javascript to avoid duplicate submit:
> Works well when deployed in a trusted environment like
> intranet.  (But no server side protection...)
> -There is no way to avoid ActionForm with session
> scope to be populated with data comming from an
> invalid request (with a bad token).
>
> -To solve that I can subclass the request processor.
>
> -Maybe I can use web filter ... but i don't think I
> will have access to all struts ressources.
>
> I think the best way to handle the problem on the
> server is to have a Handler (Something that can work
> as Exception Handler works in Struts 1.1.
> ) called by the struts framework prior to populate the
> bean. This handler can do any checks like checking if
> the user is logged or checking if a valid token in the
> request is present :-).
>
> Anyway, thanks for you help!
>
> /David
>
>
>
> > > >It's up to your Action to call the token methods
> to validate the
> > > >token and forward the user to an appropriate
> page.
> > > >
> > >
> >  I know, maybe I wasn't clear enough .. sorry :-)
> >What I'm saying is that if you use a
> >  session bean, the content is modified even though
> the
> >token is invalid.. I thinks this should not happen.
>
> By session bean, do you mean EJB or an ActionForm
> stored in the session?  I
> haven't tried this but maybe you could put the token
> check in the form's
> validate method but that also happens after the form
> bean is populated.  The
> token is currently viewed as a piece of form data for
> the Action to handle
> and not the framework.  Allowing actions to check the
> token gives people the
> flexibility of deciding what to do with the user in
> various situations.
>
> David
>
> >
> >  I'm working on an intranet application and I'm
> using
> >  session beans (Maybe I shouldn't). Right now if the
> >  user does a double click. The first request passes
> >and the second request populates the bean while the
> >first request is been processed ... This is a little
> >race :-).
> >
> >  I don't think Struts offers an easy way to avoid
> >  this... maybe I'm wrong ...
> >
> >  Thanks
> >  /David
> >
> >
> >
> >
> > > David
> > > --- David Gagnon <[EMAIL PROTECTED]> wrote:
> > > >  Hi all,
> > > >
> > > >
> > > >If you have a session bean and you are using
> > > the
> > > >  token framework to protect yourself again
> > > multiple
> > > >  submit...
> > > >
> > > >
> > > >  Let say a request with a bad token is post to
> the
> > > >  server.  The bean will be populated right ...
> > > even
> > > >  if
> > > >  the token is not valid.  Is struts offers
> support
> > > > to
> > > >  check if a request contains a valid token prior
> > > to
> > > >  populate the bean.  For what I know you the
> > > sooner
> > > >  you
> > > >  can play with token in struts is in the reset
> > > > method
> > > >  of the bean (It may not be the best place to
> play
> > > >  with
> > > >  token anyway...).
> > > >
> > > >
> > > >  Is a request with a bad or no token should be
> > > >  redirect
> > > >  by the framework to a handler.  Like it's done
> > > with
> > > >  the Exception in Struts?  I think there should
> > > have
> > > >  a
> > > >  way to avoid changing the server state on bad
> > > >  request
> > > >  ...
> > > >
> > > >
> > > >  My guest is that you already know about all
> that
> > > > :-)
> > > >  ... or that there is something to prevent this
> > > that
> > > >  I'm not aware of.
> > > >
> > > >
> > > >  Thanks for your help
> > > >
> > > >
> > > >  /Dave
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > __
> > > > Do you Yahoo!?
> > > > SBC Yahoo! DSL - Now only $29.95 per month!
> > > > http://sbc.yahoo.com
> > > >
> > >
> > >
> > > __
> > > Do y

Re: My View Is Messy

2003-06-18 Thread Carl Walker
Maybe you should create some app-specfic custom tags.  Here's one example.


  
  


With RT values in a loop.

  

  

  

If you want to bury the iteration, just pass in a list of event objects.



Aaron Longwell wrote:

> Morning everyone,
>
> I have been working on an event manager application in Struts for about
> 3 days. I'm just getting to the point of displaying a monthly calendar
> full of events. I finished up the JSP last night, and it's a mess.
> First, there's a lot of code in it. For example, to print out the event
> time, name, and description looks like this:
>
>  -
>  :
> 
> 
>
> All that code just to print this:
>
> 4:00pm - 5:00pm : Watch TV
> Watch TV event description
>
> Cold Fusion salespeople always tout the fact that Cold Fusion is
> "tag-based." I've always thought markup tags for dynamic content took up
> way too much space in the HTML I don't like Cold Fusion. My view is
> starting to look like Cold Fusion.
>
> I've looking for some recommendations for better view frameworks. Do you
> use Velocity? Do you use an implementation of XSLT? How do these affect
> application performance (serializing to XML just to reserialize to HTML
> seems like an unnecessary performance hit)? How do they affect
> development time (all of them seem to require extra effort to develop
> (i.e. compiling a new servlet for each view, etc)?
>
> Thanks for the recommendations,
> Aaron
>
> -
> 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: Token in struts and session bean.... problem with the framework ?

2003-06-17 Thread Carl Walker
You should use JavaScript to solve this.

Here's a sample function.



   var bAlreadySubmitted = false;
   function isAlreadySubmitted()
   {
if (document.forms[0].elements[14].style) {
   document.forms[0].elements[14].style.visibility='hidden';
}

if (!bAlreadySubmitted)
{
   bAlreadySubmitted = true;
   return true;
}

alert("Please don't submit more than once.");
return false;
   }



And include this with your html:form




David Gagnon wrote:

>
> > >It's up to your Action to call the token methods to
> > >validate the token and
> > >forward the user to an appropriate page.
> > >
> >
>  I know, maybe I wasn't clear enough .. sorry :-)
> What I'm saying is that if you use a
>  session bean, the content is modified even though the
> token is invalid.. I thinks this should not happen.
>
>  I'm working on an intranet application and I'm using
>  session beans (Maybe I shouldn't). Right now if the
>  user does a double click. The first request passes
> and the second request populates the bean while the
> first request is been processed ... This is a little
> race :-).
>
>  I don't think Struts offers an easy way to avoid
>  this... maybe I'm wrong ...
>
>  Thanks
>  /David
>
>
>
>
> > David
> > --- David Gagnon <[EMAIL PROTECTED]> wrote:
> > >  Hi all,
> > >
> > >
> > >If you have a session bean and you are using
> > the
> > >  token framework to protect yourself again
> > multiple
> > >  submit...
> > >
> > >
> > >  Let say a request with a bad token is post to the
> > >  server.  The bean will be populated right ...
> > even
> > >  if
> > >  the token is not valid.  Is struts offers support
> > > to
> > >  check if a request contains a valid token prior
> > to
> > >  populate the bean.  For what I know you the
> > sooner
> > >  you
> > >  can play with token in struts is in the reset
> > > method
> > >  of the bean (It may not be the best place to play
> > >  with
> > >  token anyway...).
> > >
> > >
> > >  Is a request with a bad or no token should be
> > >  redirect
> > >  by the framework to a handler.  Like it's done
> > with
> > >  the Exception in Struts?  I think there should
> > have
> > >  a
> > >  way to avoid changing the server state on bad
> > >  request
> > >  ...
> > >
> > >
> > >  My guest is that you already know about all that
> > > :-)
> > >  ... or that there is something to prevent this
> > that
> > >  I'm not aware of.
> > >
> > >
> > >  Thanks for your help
> > >
> > >
> > >  /Dave
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > __
> > > Do you Yahoo!?
> > > SBC Yahoo! DSL - Now only $29.95 per month!
> > > http://sbc.yahoo.com
> > >
> >
> >
> > __
> > Do you Yahoo!?
> > SBC Yahoo! DSL - Now only $29.95 per month!
> > http://sbc.yahoo.com
>
> __
> Do you Yahoo!?
> SBC Yahoo! DSL - Now only $29.95 per month!
> http://sbc.yahoo.com
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


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



Re: embedding multiple parameters and associated values in a

2003-06-17 Thread Carl Walker
Here's an example where I make a URL with two parameters, 'action' and
'accountId'.

'account' is a pageContext-scoped variable put on the page by the
logic:iterate tag.

   <%
  HashMap editParams = new HashMap();
  editParams.put("action", "prepareEditForm");
  editParams.put("accountId",
String.valueOf(((Account)account).getAccountId()));
  pageContext.setAttribute("editParams", editParams);
%>


  



Giampiero De Ciantis wrote:

> I am trying to use an  item to submit some data, but I need to
> send the value of 2 parameters. How do I assign multiple parameters within
> an  tag?
>
>
>
> Thanks
>
>
>
> -Gp


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



Re: IE 6 timeout session

2003-06-04 Thread Carl Walker
I had a problem with this version and Tomcat request parameters.  The
Content-type of the form submitted by IE was
'application/x-www-form-url-encoded,application/x-www-form-url-encoded' instead
of 'application/x-www-form-url-encoded'.  As a result, Tomcat wouldn't parse
out the request parameters (including session info?) in the body of the posted
message.  I fixed this by writing a Valve that set the Content-type to the
correct value.

-Carl



"Gandle, Panchasheel" wrote:

> we have a similar situation, IE version 6.00.28 in particular which is
> preinstalled in new Windows XP
> All the information in the Session is lost when downloading a document(.doc
> or any other) in new window.
>
> Panchasheel
>
> -Original Message-
> From: Billy Ng [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, June 03, 2003 1:06 PM
> To: Struts Users Mailing List
> Subject: IE 6 timeout session
>
> Hi folks;
>
>  I have a customer complains the IE 6 sp1 times out the session after he is
> logged in the app.  I tried to reproduce it but I can't.  Have anybody
> experienced this?
>
>  Billy Ng
>
>
> -
> 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: Checkbox

2003-05-30 Thread Carl Walker
You should use a java.lang.String or java.lang.String[] property if you want
to have 'abc' submitted when checkbox 'chk' is checked.

If you want 'true' to be sent when 'chk' is checked, then change 'abc' to
'true'.

Take a look at this example for additional guidance

<%-- FILE checkForm.jsp --%>
<%@ taglib prefix="html" uri="/WEB-INF/struts-html.tld" %>



checkForm


Do you like soda?
Yes

If you like soda (or were forced to drink one) what would you drink?

Coke
Pepsi
7-up





<%-- END FILE checkForm.jsp --%>

<%-- FILE check.jsp --%>
<%@ page import="java.util.*" %>
<%@ taglib prefix="logic" uri="/WEB-INF/struts-logic.tld" %>
<%@ taglib prefix="bean" uri="/WEB-INF/struts-bean.tld" %>



check


Likes soda?: 

Preferred sodas:


  




<%-- END FILE check.jsp --%>

Put these in your struts-config.xml  (in the appropriate sections).

  
  








FILE
"Abhinav (Cognizant)" wrote:

> This one is not getting into my head ..
> 
> and in the form bean
> boolean getChk(), void setChk(boolean)
> checkbox is checked and form is submitted.
> how do I retreieve the value "abc"
>
> Thanx.
>
>   
>   Name: InterScan_SafeStamp.txt
>InterScan_SafeStamp.txtType: Plain Text (text/plain)
>   Encoding: 7bit
>
>Name: InterScan_Disclaimer.txt
>InterScan_Disclaimer.txtType: Plain Text (text/plain)
>Encoding: 7bit
>
>   
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


Re: Parameters v form beans (again!)

2003-05-27 Thread Carl Walker
I use the request object to deal with parameters whose names aren't known in
advance.  For instance, I had an app that allowed the user to associate
attributes "on-the-fly" with a given record.  So I used the identifier for
these schema-changing attributes to come up with  names like
"attr_54" and "attr_2".  These parameters pointed to a db table of attribute
definitions.  The values of the  were used to populate a
different db table that held the attribute data.

I used the request parameters alongside a DynaValidatorForm for the fields that
I did know ahead of time.

But I think you really take a step back if you are going to tie all of your
code to the request map.  You'll lose the validation capabilities of struts and
the pre-population of forms.  If you were going to use DynaActionForms, you'll
lose some typecasting like with .

Mike Whittaker wrote:

> I know I've been here before, but it is my main sticking point.
>
> Does anyone JUST use the Form Beans as a html form backend,
> whether that is for pre population or validation or both.
>
> BUT
>
> Then decide that is easier to use the request parameters as a java.util.Map
> in the business layer.
>
> I know I can do this, I'm just looking for some moral support :-)
>
> Is in fact the ONLY reasoning behind ActionForms that you can easily
> prepopulate.
>
> --
> Mike W
>
> -
> 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: Direct me to the archive about individual error reporting next tofields

2003-05-27 Thread Carl Walker
You'll need to use your own , scheme or remove the
errors.header/prefix, etc. from the resource file.

"Bailey, Shane C." wrote:

>
>
> I was looking at this:
>
> http://husted.com/struts/tips/017.html
> 
>
>
>
> but what ends up happening is I get the
>
> header to show up next to the error as well.
>
>
>
>
>
> Is it possible to have
>
>
>
> errors.header=The following validation errors occured:
>
> errors.footer=
>
> errors.prefix=
>
> errors.suffix=
>
> errors.required={0} is required.
>
>
>
>//Just show errors.header
>
>
>
> then have something like this:
>
>
>
>   //Not sure what to put
>
> 
>
> 
>
> //Again not sure
>
> 
>
> 
>
>
>
> Where either the label shows up or a red label shows
>
> up if there is an error for that element.
>
>
>
> 
>
>
>
> I keep getting the header showing up next to the name and I
>
> want it to show up only at the top.
>
>
>
> I saw something similar in the struts-user emails.  Anyone
>
> know the answer?
>
>


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