Re: internationalization in struts + dynamic checkboxes

2006-12-12 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Kranti,

Kranti Parisa wrote:
 cant we use html:checkbox tag instead of input type=checkbox
 
 is there any way to assign values  ids to html:checkbox dynamically?

Unfortunately, I'm not the person to ask about that. I don't use JSP and
I'm not very familiar with the JSP tab libraries available through Struts.

Sorry.

- -chris

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFfxKc9CaO5/Lv0PARAot4AJ9C1Ah/nn8S9TbFnkqQNnyME6hr9QCgq5Mo
c3ZOI1mXhFqxz0NNmOXIX6o=
=bb8H
-END PGP SIGNATURE-

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



Re: Validator FrameWork

2006-12-11 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Thomas,

Thomas Thomas wrote:
 Thank u,
 it works great :-)

No problem.

 I have :
 
 arg key=invalid.passwordCheck/
 
 May I ask u, dear Christopher, what's the difference of it with what u have
 done :
 
 msg name=validwhen
 key=error.unmatched.password.confirm /
 arg position=0 bundle=xxx key=yyy /

I'm not sure what the difference is. Would you like me to compare this
to something specific?

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFfWgJ9CaO5/Lv0PARAkTSAJ9qubORMvcm/wd4xQ/4gHn3uQSlCACfYx8g
NWEDhXN+jV+SSCjKqjiraXE=
=LcPQ
-END PGP SIGNATURE-

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



Re: Action maps back to same page...best way to reset ActionForm?

2006-12-11 Thread Christopher Goldman
On Sat, 2006-12-09 at 13:29 -0500, Rick Schumeyer wrote:
 I have jsp containing a form to add employees.  This submits to an 
 action that adds the new employee to the database, and then forwards 
 back to the add employee page so that more employees can be added.  
 Currently, when I get back to the jsp the ActionForm still contains the 
 original data, but at this point I want a blank action form.
 
 If I am using an ActionForm (as opposed to a DynaActionForm), what is 
 the best way to clear the form?
 *  I can manually clear all the fields in the action before calling 
 findForward
 * Should I override the ActionForm reset method (and call reset before 
 findForward) ?
 * Should I use a DynaActionForm instead?  (Would that provide any advantage)
 * Is there some other obvious solution that I'm missing?
 
 BTW, this is struts 1.3.5.  The action configuration declares request scope.

Rick,

If you perform a redirect instead of a forward from the action, the new
page will have a new form, because the data will not carry over (because
you are using request scope).

As a bonus, if the user reloads the page, they will not be resubmitting
the form post that adds an employee.

Chris

-- 
Christopher D. Goldman
[EMAIL PROTECTED]



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



Re: how to initialize an edit page?

2006-12-11 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Rick,

Rick Schumeyer wrote:
 I am looking for an example of an edit cycle.  Let's say I have a list
 of employee names; If I click on one I want to have a page to edit the
 employee values.
 
 The initial click would call an action that queries the database, gets
 the employee data, and stores it...where exactly?
 
 The initial click did not come from a form, and so does not have an
 associated ActionForm (or should it?)

Your spidey-sense is tingling correctly, Rick.

The way that Struts is intended to be used is that you associate a form
bean with your edit action, but set it to validate=false. Then, in
your action, grab the (empty) form bean and fill it with information
from your database (or wherever). Then, forward (not redirect) to your
display page (JSP, velocity, whatever).

In your view page, use the data in the form bean as the values for all
of your form fields.

When you save, and validation fails, the form bean will contain
non-validated data. I assume that you have set your edit forward and
your save action's input to the same thing: this makes it easy to use
the same page to display fresh-from-the-database data as well as
re-displaying invalid submission data for correction.

 The edit page will have an associated ActionForm, but we are not there yet.

You can have your action element contain a name (form bean) as well
as a forward (shortcut to your page... i.e. no custom action) and it
will work properly (your form bean will be empty).

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFffZr9CaO5/Lv0PARAswJAJwNxaBt4zmfirX6L7psBFrY30JWYgCgjOnT
y+uxpIqj2OGTSmCuyVxBH0s=
=2egv
-END PGP SIGNATURE-

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



Re: struts2.0 question

2006-12-11 Thread Christopher Goldman
On Tue, 2006-12-12 at 09:08 +0800, red phoenix wrote:
 I have a question about Struts 2.0 Action,I find Action will extends
 ActionSupport,like follows:
 public class GetUpdatedHangmanAction extends ActionSupport implements
 SessionAware {
  private static final long serialVersionUID = 5506025785406043027L;
  .
 
 
 I am puzzled with variable serialVersionUID,I want to know if this variable
 is necessary for Action,if it is necessary,how to calculate the value of
 serialVersionUID,why it is equals 5506025785406043027?
 
 Anyone can give me some advice?

Red Phoenix,

No, I don't think the serialVersionUID is necessary for Struts, but it
is good practice to give your Serializable classes some value for it.
Check out the Javadocs for the Serializable interface -- it's a standard
Java interface.

Probably that number was generated by calculating a hash value from the
object's fields.  I seem to remember reading something about some IDEs
producing that value for you.  You can maintain it yourself as well.

Chris

-- 
Christopher D. Goldman
[EMAIL PROTECTED]
415.962.4884


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



Re: Struts1: CHALLENGE Indexed Properties can not be used with FORMS on REQUEST scope! TRUE or NOT TRUE?

2006-12-08 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Paul,

Strachan, Paul wrote:
 A request scoped out of the box DynaValidatorForm is also unable to
 handle indexed properties e.g. throws IndexOutOfBoundsException in
 DynaActionForm.get(string, int)

I've never used get(String, int), but I use request-scoped indexed
properties all the time and use getStrings(String) just fine in that case.

My setup in struct-config.xml:

form-bean name=questionSetForm
type=org.apache.struts.validator.DynaValidatorForm
form-property name=id type=java.lang.String /
form-property name=name type=java.lang.String /
form-property name=description type=java.lang.String /
form-property name=addQuestionId
   type=java.lang.String[] /
form-property name=deleteQuestionId
   type=java.lang.String[] /
/form-bean

Part of my form-handler action:

// Add and remove the appropriate questions.
List questions = getQuestionList(existingQuestions,
  questionSetForm.getStrings(addQuestionId),
  questionSetForm.getStrings(deleteQuestionId));

If you are getting IndexOutOfBoundsException, then your loop might be
running too long. How are you determining what the maximum index is that
you can use?

- -chris

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFeXZH9CaO5/Lv0PARAk8cAKDAtrEWWH1nl34JU75mKkGfh+IPswCffh6X
56p3VYmREkJLNH5by0RVysM=
=yUyl
-END PGP SIGNATURE-

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



Re: Struts1: CHALLENGE Indexed Properties can not be used with FORMS on REQUEST scope! TRUE or NOT TRUE?

2006-12-08 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Paul,

Strachan, Paul wrote:
 Chris, In my DynForm I'm actually using a java.util.ArrayList
 (contains my bean objects).

So, you have type=java.util.ArrayList in your form bean definition?
Are you sure that Struts knows how to handle that? It might just be
creating a new ArrayList for your bean property and then not going
anything after that.

Have you tried calling yourFormBean.get(yourArrayList) and checking to
see what it inside of it?

 the http request contains properties:
 checkList[0].resultId=34checkList[1].resultId=45 etc

Okay, I have my form submitting multiple addQuestionId parameters with
no specific subscripts. Perhaps you are trying to do something slightly
differently than I am.

Apologies if I missed the point.

 Dumb question: - assuming your String[] is empty when the
 processPopulate starts, what is the code to grow it to accomodate a
 variable number of http request parameters?

I don't have to worry about it... Struts handles parsing the request
parameters and setting up the array entirely. I merely call getStrings()
on my dyna form bean and I get the data.

- -chris

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFeZG59CaO5/Lv0PARAv2OAKCCllzEmXCL5mdJAMwnXCJquMwvSQCdEXvX
c5UsdhF01rQCoBc88rt2RsU=
=K+l5
-END PGP SIGNATURE-

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



Re: Struts1: CHALLENGE Indexed Properties can not be used with FORMS on REQUEST scope! TRUE or NOT TRUE?

2006-12-08 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Paul,

Strachan, Paul wrote:
 Have you tried calling yourFormBean.get(yourArrayList) and
 checking to see what it inside of it?
 
 not sure what you mean - the action method is never called as the
 RequestProcessor cant populate the DynaForm from http request
 parameters...

Oh... so it bombs in populatePopulate before your Action.execute is
called? Hmm...

 I think the solution (for DynaForm on request scope) is:
 a) override the get(String,int) method (is dynamic=true required?)

How will this help? I thought you said that your action code wasn't
being executed. If that's the case, then it will still bomb before you
get a chance to call get(String,int).

 b) use LazyValidatorForm (or/with LazyDynaBean)

Is this because poking something into foo[3] will auto-expand in a
LazyDynaBean?

 c) put the form on session

I'm not sure how this helps at all. Can you describe why you think this
will work?

If you have a multi-page flow that expects your form bean to continue to
hold information from past pages, then you will certainly need to store
the bean in the session. If this is a one-page form submission, then I'm
not sure why the choice of bean scope is relevant.

 d) include a new mapping attribute ;) e.g. form-property
 name=items type=java.util.ArrayList
 indexedBean=com.example.MyBean /

How is this different from your existing setup?

- -chris

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFeZhG9CaO5/Lv0PARAv1KAJsH9k0vAqGWb9zH/K9vKQXbmymO3wCeNtg6
MK7aLdO7GI5+2v4/mq22kZ0=
=QSGv
-END PGP SIGNATURE-

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



Re: Validator FrameWork

2006-12-07 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Thomas,

Thomas Thomas wrote:
 var-value(*this* == password)/var-value
 
 But it still doesn't work

This is exactly what I have in my setup, and it works like a charm:

  field property=passwordAgain
depends=validwhen
msg name=validwhen key=error.unmatched.password.confirm /
arg position=0 bundle=xxx key=yyy /
!-- This lets us require password again only when the pwd != null --
var
var-nametest/var-name
var-value
(
(password == null)
or
(*this* == password)
)
/var-value
/var
  /field

Make sure that your config file is being re-loaded. You will have to
reload the webapp in order to make that happen... changing the file will
not trigger a reload.

Hope that helps,
- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFeJ929CaO5/Lv0PARAp7nAKCsGhwmlzurFklQmTLBH9cvgS85VgCgpqP5
hQ76T7r5u++UL5P4X8M1Q/Q=
=4/iJ
-END PGP SIGNATURE-

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



Re: [offtopic] periodic cleanup task scheduling for webapp?

2006-12-04 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Patrick,

J. Patrick Bedell wrote:
 Hello,
   Sorry for the offtopic question!
   How might I configure my servlet container or webapp web.xml so
 that a periodic application performs a cleanup task for my webapp's
 database?  I want to have a cleanup application (say, a particular
 java class) run periodically without triggering it on user input.

Does your cleanup have to run from your webapp? If not, I would
recommend just using a plain-old command-line java program and schedule
it regularly using cron (UNIX) or whatever task scheduler is available
on win32.

- -chris

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFdHan9CaO5/Lv0PARAvo3AJwNKCvyzyauEmj+ktFajAVlimANZQCfSLPT
mYXmQG7UAMEvR+Qfv7o5J4o=
=37TU
-END PGP SIGNATURE-

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



Re: [offtopic] periodic cleanup task scheduling for webapp?

2006-12-04 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Leon,

Leon Rosenberg wrote:
 On 12/4/06, Christopher Schultz [EMAIL PROTECTED] wrote:
 J. Patrick Bedell wrote:
 Hello,
   Sorry for the offtopic question!
   How might I configure my servlet container or webapp web.xml so
 that a periodic application performs a cleanup task for my webapp's
 database?  I want to have a cleanup application (say, a particular
 java class) run periodically without triggering it on user input.
 
 Does your cleanup have to run from your webapp? If not, I would
 recommend just using a plain-old command-line java program and schedule
 it regularly using cron (UNIX) or whatever task scheduler is available
 on win32.
 

 Why if i may ask?

I recommend off line batch processing for a number of reasons:

1. There is usually no reason to make it part of the webapp.
   If it's not necessary, my policy is not to do it.

2. If you have several app servers and only one database, why
   have all the app servers run database cleanup routines?

3. Why take up resources in your app server (connections, CPU time,
   etc.) that you can offload to another machine for these operations.

4. An out-of-process utility can be run from anywhere, and does not
   require the weight of a servlet container -- in case you want
   to run it standalone independently of your webapp (related to
   #2 and #3).

#1 is really my -- heh -- #1 reason not to do it. Cron is also simpler
and more reliable than an in-webapp scheduled job. It can run scheduled
processes that should have been run during downtime and it can run while
the webapp itself is down.

- -chris

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFdK269CaO5/Lv0PARAn0RAKCBDDZr4iit0dZo21Laf/b5nb10mwCggNKe
DYkSj/ctrdLPu1xSc9yN32I=
=T3go
-END PGP SIGNATURE-

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



Re: Struts 2 and passing data using interceptors

2006-12-01 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Mark,

Mark Menard wrote:
 On 11/30/06 7:45 PM, Christopher Schultz [EMAIL PROTECTED]
 wrote:
 Sorry for poking my nose in, but wouldn't this be horrendously
 non-threadsafe?
 
 No problem. If your thinking of Actions from the perspective of S1, yes,
 this would be horribly non-thread safe. In S2 an action instance is created
 for each request. They are not singletons. So, this is fine.

Yup, I was thinking of S1 actions, so thanks for setting me straight.
Once of these days I've got to read everything you ever wanted to know
about moving from S1 to S2. Anyhow know if such a thing exists? ;)

Thanks,
- -chris

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFcDoz9CaO5/Lv0PARAqZ2AJ0fdk6nH//QlwIiOvk4ghEozrKj4QCgrWWd
eMf3FFWwefGTHrp+4F7GKH0=
=KTr3
-END PGP SIGNATURE-

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



Re: [FRIDAY/OT] Access Log file reporting tools

2006-12-01 Thread Christopher Goldman
On Fri, 2006-12-01 at 12:16 -0500, Monkeyden wrote:
 Does anyone know of an OSS log file reporting tool?  We're using a very old
 version of WebTrends, which usually works fine (but sometimes not).  MGMT
 doesn't want to pony up so, well, you know.  Was hoping that Apache had
 something.

Monkeyden,

Have you seen this?  http://www.mrunix.net/webalizer/

Easy to set up.  I've had it running with Apache (which is talking to
Tomcat 5 over mod_jk 2) for the past few years.

Chris



-- 
Christopher D. Goldman
[EMAIL PROTECTED]



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



Re: HTML Input field event with ' (quote) in name of var being set breaking javascript var assignment

2006-12-01 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

John,

Mississippi John Hurt wrote:
 I have onclick handler which sets a form property via javascript. 
 Problem is when the myWeirdName has a quote in the name, this breaks
 my javascript handling below.

I had this same problem using Velocity Tools (instead of JSP) and it was
discussed in this bug here: http://issues.apache.org/jira/browse/VELTOOLS-52

I believe that Niall Pemberton ported the fix over to the Struts tag
library last November. Is your current version of Struts more recent
than that? If not, you may have to upgrade to get the fix.

If it's still broken, then apparently we missed something.

- -chris

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFcH059CaO5/Lv0PARAs5QAKCu56H7HBUIUydiW0NemBXyOxpzOwCfayDM
do2e6mRNAMWS8Q1NCJLngbo=
=11xR
-END PGP SIGNATURE-

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



Re: HTML Input field event with ' (quote) in name of var being set breaking javascript var assignment

2006-12-01 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

John,

Mississippi John Hurt wrote:
 input type=image onclick=strutsForm.myActionProp.value='takeaction';
 strutsForm.myNameProp.value='c:out value=${result.myWeirdName}/';
 return
 true property=takeaction src=button.gif 

Sorry, I didn't see that you were using c:out. Is there a Struts tag
that can help you with this?

If not, you might have to do it yourself by writing a short escaping
routine. You can even use the routine used in the patches to the bug I
mentioned in my last post.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFcH2k9CaO5/Lv0PARAtaFAJ9mZh3zmhkjIpCNg2HNrhHmFgCHwACaA8vA
TBRXD56KDBA4sHvCUZ44BQ8=
=KHXN
-END PGP SIGNATURE-

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



Re: How to get a dynaform in the Action class ?

2006-12-01 Thread Christopher Goldman
On Fri, 2006-12-01 at 20:10 +0100, Thomas Thomas wrote:
 There is not much code for a FormBean in Java ...
 I don't see the point to have it in XML

Thomas,

The benefit is that you can edit the XML and redeploy without
recompiling your app.

Chris



-- 
Christopher D. Goldman
[EMAIL PROTECTED]



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



Re: HTML Input field event with ' (quote) in name of var being set breaking javascript var assignment

2006-12-01 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

John,

Mississippi John Hurt wrote:
 I notice if the quote is escaped as...  \'
 then it works fine, the problem is it will display wrong looking exactly
 like above, so I have to escape it 2 different ways...

Yeah, that's pretty much the deal. You want to do javascript escaping,
not HTML escaping. That's often inconvenient.

However, you know that the content will be going into the onclick
attribute, which will always be javascript. You ought to be able to
javascript-escape it first, then HTML escape it (to catch any of those
pesky non-HTML characters you might want to display).

 Using #039; the default in most cases, but using the \' just for this
 javascript workaround.
 Is this correct, there's got to be a better way. I dont want to have 2
 versions of the same name (coming from the db).

No, you're right: separate storage is a kludge and a mistake. On-the-fly
escaping is the way to do it. You might have to write your own method in
your JSP, or your own tool that lives in the application scope, or your
own tag that does this kind of thing.

Have you searched to see if there are appropriate tags that already
exist? For instance, the Struts tags for dealing with validation might
be a good place to start (which is what I was recommending at first).

- -chris

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFcJXh9CaO5/Lv0PARAtVBAKCMHaZFvhcrEUpzruSkwiDleloXWgCgl62S
7AD5fvFrHESWPIv3N2eW2bo=
=w3v2
-END PGP SIGNATURE-

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



Re: problem in formbean

2006-11-30 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

prkumar,

prkumar_1234 wrote:
 1) in jsp iam displaying values from javabean in textboxes.(i can 
 change
 these values)
 2) when i submit with modified values , iam doing validation in 
 formbean.
 3) When validatio fails i formbean returning to same jsp but it is
 displaying old values not modified values

I'm guessing that your action mapping looks something like this:

action path=/edit
type=...
   forward name=success path=/edit.jsp /
/action

action path=/save
type=...
name=...
validate=true
input=/edit.do
   forward name=success path=...
/action

Note that the 'input' attribute is set to edit.do, which will re-run
your action and probably re-fetch the original values. You need to make
sure that your input points to the edit.jsp page.

If that's not the problem, then do you have code in your JSP that
fetches the original values from somewhere (like a database)? Or, do you
use actions for that kind of thing?

Hope that helps,
- -chris

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFbuOg9CaO5/Lv0PARAuBrAKCGsLR/OEPjH098CttCtlUqur/o5gCcDGkI
Fc29gGupfpPFKvYAahhUIzc=
=Gkpe
-END PGP SIGNATURE-

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



Re: Does Struts 2 solve the action chaining problem?

2006-11-30 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Tarek,

Tarek Nabil wrote:
 Christopher,
 
 I really wonder if the Struts you're talking about is the one I've using
 for years now!! The Struts I know sucks big time when it comes to action
 chaining. I'm afraid I don't understand how defining two mappings, one
 with validation turned on and the other turned off, solves the first
 problem! As for the second problem, your solution still involves action
 chaining which should be avoided unless you've done something equivalent
 to what Yujun did.

I suppose I've never tried to modify the state of the request (or form
bean) such that re-interpreting it across action invocations is
relevant. I typically get information out of a form bean ASAP and then
use that for some other operation (most often database interaction).
Then I discard the form bean.

If I have to re-read the form bean, it's in the same state in which I
left it.

I guess if you store a lot of state information in your form beans, and
you mutate that information in your actions, you might end up fighting
against Struts. As it is for me, forwarding from one action to another
(that both use the same form bean) results in no problems except a
slight performance hit for re-populating the bean and validating it when
entering the second action.

I never use beans that contain anything but Strings, so no conversion
ever needs to take place. It looks like my mode of use has resulted in
me never realizing what a PITA it might be when attempting to chain
actions in this way.

- -chris

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFb2by9CaO5/Lv0PARAtveAJ9AyWu4w0x7CUOuRvxXDjoKcVKbxwCfXCvc
licIhQWz58NCiqrqaR8XwO8=
=cSgU
-END PGP SIGNATURE-

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



Re: Struts 2 and passing data using interceptors

2006-11-30 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Mark,

Mark Menard wrote:
   public String getDataRetrievedFromSessionBean () {
 return this.dataRetrievedFromSessionBean;
   }

Sorry for poking my nose in, but wouldn't this be horrendously
non-threadsafe?

Since I know virtually nothing about S2, I may be completely missing
something like action instances now live in the session or something
crazy like that.

Instead of using a method on the action, why not stuff the object into
the request?

request.setAttribute(dataRetrievedFromSessionBean,
  this.getSessionBean());

Sorry if I don't know what I'm talking about.

- -chris

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFb3sN9CaO5/Lv0PARAqmjAJ43fvmsWmR0VNEauKXZOjH8f+GORgCcCl/B
2HGBwx4xh0OCNwY8QRFmjaU=
=u3oN
-END PGP SIGNATURE-

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



Re: Does Struts 2 solve the action chaining problem?

2006-11-29 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Tarek,

Tarek Nabil wrote:
 One of the problems with Struts was that if you had a page that requires
 some setup and this page submits to an Action, then you would not be
 able to set validate to true on that action because if validation
 problems occur then Struts will take you directly to the input JSP
 without performing the setup and your JSP wouldn't work.
 
 A solution to that would be to specify the input of the action as the
 setup action, which means you're doing action chaining and Struts is not
 good at that (it will reset your form among other things).
 
 The solution of choice for us so far was to call validate() ourselves in
 the action and if a validation problem occurs then we call the setup
 method (eventually you start using your action methods as an API which
 still was not good).

I totally disagree. If you have an action that you want to use like
this, you can always set up two different mappings -- one that /does/
validate and another that does /not/ validate.

My experience has been that Struts is very good at action chaining...
in fact, that's the major advantage of Struts in the first place: the
ability to map URIs to actions and specify their relationships through
forward mappings.

 Another problematic scenario is the case when you're editing some
 database record for example. When you go to your setup action for the
 first time, you will populate drop down lists for example, and then load
 the existing values from the database to your JSP fields. If the user
 attempts to save and some problem occurs then in the setup action, you
 will need to again populate the drop down lists, but you will NOT want
 to overwrite the user's inputs with the existing data. This is very
 similar to the first problem, but you would also need to pass some flag
 to the setup method to tell it whether to copy the data from the
 database to your ActionForm.

In this case, what you want is something like:

LoadAction - EditAction - Display form

Form submits to SaveAction, which has EditAction as input (not LoadAction).

This is pretty standard stuff, and works beautifully.

 Does Struts 2 or even WW 2.2.4 solve that problem in an elegant way?

I really hope so, since Struts 1.x also does.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFbYyx9CaO5/Lv0PARArpHAJ0U3fHybMWepSZxPjciDU3+6M2PwQCgoy8B
FRlfdQsyONpgqGvrHBuZuFw=
=EbD/
-END PGP SIGNATURE-

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



Re: File upload using DynaActionForm/SynaValidatorForm

2006-11-28 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Mano,

Mano Chinthaka Dasanayaka wrote:
 Try Using
 form-bean name=uploadFile
 type=org.apache.struts.validator.DynaValidatorActionForm
   form-property name=title type=java.lang.String/
   form-property name=revdate type=java.lang.String/
   form-property name=revinfo type=java.lang.String/
   form-property name=documentfile
 type=org.apache.struts.upload.FormFile/
 /form-bean
 
 org.apache.struts.validator.DynaValidatorActionForm

Are you sure this is the problem? DynaValidatorForm is a valid form-bean
type, and it's the one I use, in fact. The error message indicates that
the type name for documentFile is unusable:

 Error creating form bean of class
 org.apache.struts.validator.DynaValidatorForm
 java.lang.NullPointerException: The type for property documentfile is
 invalid

Is this because DynaValidatorForm does not support
org.apache.struts.upload.FormFile properties? The documentation for this
form suggests that the only difference is that DynaValidatorActionForm
uses a separate XML file to define field validation rules. I'm not sure
how that's different than using commons-validator, though...

I think the problem is more likely that
org.apache.struts.upload.FormFile is not a class -- it's an interface.
Struts can't create a new object because Java can't create a new
instance of an interface.

The HOWTO Chris mentions instructs you to add this to your controller
configuration:

 multipartClass - The fully qualified Java class name of the multipart
 request handler class to be used with this module. Defaults is
 org.apache.struts.upload.CommonsMultipartRequestHandler.

Have you configured your controller element in this way? It appears
that there is a default, but that could be part of the problem.

I'm interested in the fact that a switch to DynaValidatorActionForm
fixed your problem; are you sure that you didn't change anything else?

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFbFSD9CaO5/Lv0PARAmAIAJ4knbM0fRFLB5EgndwBO6+xMBAL6wCgwrlC
CEKS/pLVh2jjW5I6AerLCNA=
=uJGh
-END PGP SIGNATURE-

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



Re: [OT] Scriptlet and Javascript

2006-11-28 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Adam,

LIM Adam wrote:
 I have a javascript:history.back() link button. When I click on it, I
 want to remove an entry in my object with scriptlet.
 The problem is that the scriptlet is executed when my page is loaded and
 not when I click on my button.
 How could I manage it?

You'll need to post your HTML code so we can better understand your
situation.

I'm not sure what you mean when you say that your scriptlet is executed
when your page is loaded. Do you mean that you have something like this:

script type=text/javascript!--
  history.back();
// --/script

... in your code? That doesn't seem right. Since you said that your
javascript code is javascript:history.back();, I'm assuming that your
HTML is like this:

input type=button onclick=javascript:history.back(); /

(Note that javascript: is unnecessary in the onclick handler... it's
always javascript.)

Anyhow, I'm also unclear about what you want to do when this button is
clicked you want to remove an object entry? Do you mean a javascript
object, or something on the server? If you mean the server, are you
using AJAX or something like that, or do you want to call an action on
the server in order to do that (which, I guess, doesn't exactly preclude
the use of AJAX)?

- -chris

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFbFhv9CaO5/Lv0PARAnSOAJ9D6GyUC/yFc4XMcyK0QtyoHdjvtwCgwKhI
YTk/UxpaOrJjMP0Ew2e0Kik=
=M9mj
-END PGP SIGNATURE-

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



Re: [OT] Need help in calling a perl script

2006-11-28 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Vineet,

Vineet Chopra wrote:
 Hi All,
 I am using struts 1.2.9 and wanted to call a perl script.
 If any one has done it, will appreciate the help.
 An Example or a sample code will be great.

Do you just want to call Perl on the command line, or do you have some
kind of perl-cgi thing that you need to interact with?

 Also is it possible to send input parameters to the script?

That depends on how you want to invoke Perl. If you are using a URL to
call-back to your web server in order to invoke Perl on your behalf
(using CGI), then no, you can't send command-line parameters to Perl...
you'll have to use CGI for that.

On the other hand, if you're going to be calling Perl directly, then you
can certainly use command-line parameters.

I'm sure there are HOWTOs out there for how to do this kind of thing,
but you want to start by looking at the java.lang.Runtime class's exec()
methods. There are a bunch, depending on what information you want to
pass. Choose carefully.

The following considerations are extremely important:

1. Using Runtime.exec() allows users of your webapp to start new
   processes on your server. Are you really sure you want this to
   happen? Imagine if all of your users hit your Perl-invoking
   action at once. Would it kill your server?

2. You can't trust any information passed-in through request
   parameters. If you want to use command-line parameters,
   make sure that you taint check them so that someone
   doesn't add ; rm -rf / to the end of your command and
   end up destroying your filesystem.

3. Always remember to handle the resulting Process object (returned
   from Runtime.exec) properly. For instance, if you don't get the
   input and error streams from your spawned-process and read from them,
   they may never complete and never fail. Always read error and input
   until they are closed. If you are not providing input (via stdin,
   using an OutputStream from Java) to your process, then consider
   closing the OutputStream so that your process won't (accidentally)
   wait around for data on stdin.

4. Unless you really know what you are doing, always call
   Process.waitFor() to make sure that the process has terminated.
   You don't want a ton of processes starting and never finishing,
   without you knowing about it. At least if your Perl processes are
   never finishing, you'll know it because you'll get problems
   in your webapp, too.

Lastly, what are you doing with Perl? Can the same thing be done within
Java? That would be ideal, since spawning processes from a webapp is a
dangerous business. Alternatively, could you put information in a
database describing what needs to be done, and run Perl in a
batch-oriented way -- like using a cron job to periodically do these
operations? I think you'll end up with a more stable webapp that way.

Hope that helps,
- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFbGKf9CaO5/Lv0PARAtSnAJ9j4+uReDOhs2PvPvs1pU2ADIRsYwCdGllD
fUZOCFRzb1Siin728+Snh/Q=
=ziUJ
-END PGP SIGNATURE-

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



Re: [Fwd: Having problems with Struts validation framework]

2006-11-24 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Robin,

All you have to do is set the name of your button to Globals.CANCEL_NAME
(not that exact text, but use that constant to set the name attribute
of that submit button element).

- -chris

robin bajaj wrote:
 Hello folks,
 I found a little issue with the action that's being called.
 Please dis-regard my previous mail reporting this issue.
 Its resolved now.
 
 However, I have another related issue.
 My loyaltyPAge.jsp has two buttons - Exit and continue.
 
 I want the validation to occur only when Continue is clicked upon.
 But because there's one form in the LoyaltyPage.jsp having these two
 buttons, they both get evaluated using one actionMapping (which has the
 validate=true).
 
 Is there some facility provided by the Struts framework to
 SKIP the validation when a specific button (Exit) is clicked
 and ONLY OCCUR when another button(*Continue) is clicked . ???
 
 A corollary question to this would be,
 Is it possible for one JSP to have two buttons in one form,
 and each button calling a different Action.
 
 Currently as I know, the action gets called based on the
 html:form action=  setting.
 
 
 Any help would be much appreciated,
 regards,
 robin.
 
 
 
 
 
 
 
 
 
 
 
 
 
 Subject:
 Having problems with Struts validation framework
 From:
 robin bajaj [EMAIL PROTECTED]
 Date:
 Thu, 23 Nov 2006 11:51:17 -0500
 To:
 Struts Users Mailing List user@struts.apache.org
 
 To:
 Struts Users Mailing List user@struts.apache.org
 
 
 Hi Folks,
 
 --- problem ---
 My validation is working but the control doesnt go back to the input
 page. I want the input page to render again showing the errors.
 
 --- Details --
 I am using Struts 1.1.x for my webApp.
 My validation is working fine. (validator-rules.xml and
 validation-renewal.xml setup correctly and declared in
 struts-config-renewal.xml file).
 
 I want to validate an Email text field on LoyaltyPage.jsp, it has to
 be non-empty, valid email address.
 
 Here's the snippet from validation-renewal.xml
 -
  form name=loyaltyForm
 field property=email
 depends=required,email
 msg name=required 
 key=error.loyaltyPage2 /
 msg name=email  key=error.loyaltyPage3 /
 /field
   /form
 --
 
 Here's the snippet from struts-config-renewal.xml
 --
 action path=/processLoyalty
type=com.xyz.flow.action.renewal.ProcessLoyaltyPageAction
name=loyaltyForm
scope=request
validate=true
input=/LoyaltyPage.jsp 
forward name=exit path=/EquipmentList.jsp/forward
forward name=continue
 path=/processRegistration.do/forward
forward name=failure
 path=/ErrorPageRenewal.jsp/forward
 /action
 
 --
 
 I do notice that validation is occuring but the control doesnt go back
 to the loyaltypage.jsp even though I have mentioned it as the input
 attribute in the action mapping. I just get a blank page in the browser.
 
 input=/LoyaltyPage.jsp
 
 I have tried changing the input attribute to the action that actually
 forwards to loyaltyPage.jsp
 input=/getLoyalty.do
 
 but in both the cases, I get the blank page in the browser. I want the
 loyaltypage.jsp to render again with the error messages showing up.
 
 The following logs show clearly that the validation is occuring, form is
 failing the validation, but the input page is still not rendering in the
 browser.
 
 What's the missing piece in the whole picture, please help ???
 
 
 2006-11-23 11:35:39,546 219875 DEBUG [ExecuteThread: '7' for queue:
 'default'] action.RequestProcessor - Processing a 'POST' for path
 '/processLoyalty'
 2006-11-23 11:35:39,546 219875 DEBUG [ExecuteThread: '7' for queue:
 'default'] util.RequestUtils -  Looking for ActionForm bean instance in
 scope 'request' under attribute key 'loyaltyForm'
 2006-11-23 11:35:39,546 219875 DEBUG [ExecuteThread: '7' for queue:
 'default'] util.RequestUtils -  Creating new ActionForm instance of type
 'com.xyz.salescentral.flow.formbean.renewal.LoyaltyForm'
 2006-11-23 11:35:39,546 219875 DEBUG [ExecuteThread: '7' for queue:
 'default'] util.RequestUtils -  --
 [EMAIL PROTECTED]
 2006-11-23 11:35:39,546 219875 DEBUG [ExecuteThread: '7' for queue:
 'default'] action.RequestProcessor -  Storing ActionForm bean instance
 in scope 'request' under attribute key 'loyaltyForm'
 2006-11-23 11:35:39,546 219875 DEBUG [ExecuteThread: '7' for queue:
 'default'] action.RequestProcessor -  Populating bean properties from
 this request
 2006-11-23 11:35:39,546 219875 DEBUG [ExecuteThread: '7' for queue:
 'default'] beanutils.BeanUtils -
 BeanUtils.populate([EMAIL PROTECTED],
 {actionValue=[Ljava.lang.String;@1633bbd,
 

Re: Validation XMl entity

2006-11-24 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Vishal,

Vishal Seth wrote:
 Hi,
   Does struts validation support XML entity.

What do you mean? Can explain this question in more detail?

- -chris

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFZwej9CaO5/Lv0PARAs+RAKC7PFSI6AC23BMdFQKSNWoe6OhYnACfchpJ
NSN78a9Lbt7EXBSRwNff34I=
=LxyL
-END PGP SIGNATURE-

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



Re: Very basic question on formbeans

2006-11-22 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Jim,

Gallagher, Jim (RBoS ITDS Dublin) wrote:
 I'm wondering whether it's a better idea to create the
 formbean, populate it and use that to pass the information to the jsp?

This really is the struts way. But, in order to do this, you don't
have to do a ton of work. For instance, simply modify your
struts-config.xml action mappings to include the name attribute for
the mapping which initially displays your (empty) form. That will set up
the (empty) form bean for further use.

You can do nothing at this point, and you'll get an empty form, just
like you do, now. Or, you can add code to your action (if you are using
one) or to your JSP (though I highly recommend using an action instead
of putting code in your JSP) that grabs the form bean just like in your
form handling actions.

Once you have a reference to this form bean, you can fill it with data.
A simple example is loading a record from a DB for editing:

1. Hit the /edit.do URI which has myForm as the form bean.

2. Fetch the appropriate record from the database.

3. EditAction takes its form parameter and casts it to the appropriate
   type (MyBeanType).

4. Fill the bean with data from the DB record (don't forget to include
   the records PK).

5. Display your form, remembering to include all the data you just
   stuck into the bean, instead of just leaving the fields blank.

~

6. Post your form to your form handler (/save.do).
   If you use struts validation, it can check to make sure that your
   form fields are (at least mostly) valid and redisplay the form
   if there's a problem. This is a huge advantage that I recommend
   you .. umm, take advantage of.

7. Process your form normally.

Hope that helps,
- -chris

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFZF2S9CaO5/Lv0PARAgjjAJ9dJ4r+PUlvkJ2w7360w1weOASzEgCdEVFj
/hpfA2psUPbscPSoY5ZfwtQ=
=csK4
-END PGP SIGNATURE-

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



Re: session maintenance in struts webapp

2006-11-21 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Richard,

Gundersen, Richard wrote:
 In the JavaScript, you could just do a simple loop that counts down from
 session-timeoutzero. When the loop gets to within e.g. 60 seconds
 from zero, pop up your message.

You don't want to do this. You want to use setTimeout, which allows
you to schedule a bit of code to be run after a certain interval.

My bank does this, and I hate it. After a few minutes, it says you are
about to be logged out, click OK to stay logged-in. It does this with a
javascript alert and more than half the time, my session times out
before I bother to click either Ok or Cancel.

I find this to be a completely worthless feature, especially because the
J2EE authorization mechanism is designed to allow you to pick up where
you left off if your session times out (because it remembers the page
you were trying to access after you login).

- -chris

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFY2Pa9CaO5/Lv0PARAobAAKCzo9aYwW+hZFKU8T9TW7kUgtxrvwCfbFk5
zr4fqqpJ4eqP/YMpV8GGxSI=
=MJwc
-END PGP SIGNATURE-

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



Re: Token double form submission

2006-11-16 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Jean-Marie,

Jean-Marie Pitre wrote:
 I am able to detect a double submission but for the moment I display an
 error page instead of the result page.
 Is there any way to ensure the display of a response that represents the
 original request's outcome ?

You would have to save the information from the original response
(say, in the session), and then re-display it after you have detected
that it was a double-submit.

By the way, have you checked to make sure that two simultaneous
submissions isn't a problem? I recently considered using Struts'
tokens and it looked like there was no way to catch two requests at
the same time (since you expire the token at the end of processing,
not the beginning). It felt like running a SQL transaction without being
able to use BEGIN and COMMIT.

- -chris

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFXJw19CaO5/Lv0PARAszNAKCPqqlN64pqaMgC9p5nppNJDZpyRQCgu/oM
Ugu3XUyZqpdYpJhMLMVyKg4=
=5N0W
-END PGP SIGNATURE-

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



Re: reusing jsp with different action

2006-11-15 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Paul,

 The only solution I can think of is some hack whereby I try to pass
 the action to the JSP and in javascript do something like:
 Form.action = 'some action.do' followed by Form.submit();

If you can pass the action into your JSP, why not do this:

form action=%= whatever %

instead of this:

form action=dont_want.do
.
.
script type=text/javascript!--
form.action=do_want.do;
// --/script

It seems a lot cleaner to do it the first way.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFWxpS9CaO5/Lv0PARArfdAJ919UxdOPSdckeKDC6lMCJMMxBYEgCfcsCA
295PFSwXDCYMUUtQDsgREGs=
=xDx3
-END PGP SIGNATURE-

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



Re: Migrating Struts App From TC 4 - 5

2006-11-15 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Jon,

Jon Wynacht wrote:
 For starters, it coughed up a ton of warning messages about not being
 able to find the SAX parser. So I put xalan.jar, xercesImpl.jar, xml-
 apis.jar and xmlParserAPIs.jar it $TOMCAT_HOME/common/lib. This
 stopped the error messages and the server started up fine.

What version of JRE are you using? If you use pre-1.5, then you'll have
to install the compatibility package in order to get it working. This
has something to do with XML libraries and others, so it's possible this
is your problem.

- -chris

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFWzx29CaO5/Lv0PARAhjBAJoDBEUK6yR5WxlbpMEad/owSW5toQCghoC0
4duY8+RO6jgIG/r4q7p4w5Q=
=aDCS
-END PGP SIGNATURE-

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



Re: Migrating Struts App From TC 4 - 5

2006-11-15 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Jon,

Jon Wynacht wrote:
 Hi Chris,
 
 Here's the info, I should be good to go:
 [snip: you have JDK 1.5]

Okay. Ensure that you have /not/ installed the compatibility package.
This can also foul things up. I noticed that you posted the same
question to the Tomcat mailing list. Search the archives the xml and
compatibility to see how to check for and remove this package if
necessary.

I apologize in advance if this doesn't turn out to be the problem.

- -chris

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFW0Uw9CaO5/Lv0PARAtHDAKCptWxSBb+F3AImXGz1IntglDXEvACeNzoD
FnwoSlCrYl0BTEef7F0PiqQ=
=YrVH
-END PGP SIGNATURE-

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



Re: html:html XSS vulnerability?

2006-11-14 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Otsuka,

otsuka wrote:
 The value of lang attribute which html:html tag generates is
 not escaped. I think it could cause XSS problem If Accept-Language
 HTTP header's value is replaced with script tag.

Have you tried doing this? If so, what happens?

- -chris

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFWcWf9CaO5/Lv0PARAo/OAJ9PDSWAwxDcmaq8E9WZmbTIRmFxwACgquv0
FtPtemZYHqdo86MpWwTCQTo=
=sU+9
-END PGP SIGNATURE-

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



Re: Validation + multiple Submit buttons

2006-11-14 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Andrew,

Andrew Martin wrote:
 I have just begun to add validation to my forms using struts
 validator, which is quite nice. I have however a problem when I have
 more than one submit button on a form.
 
 For example I have a Save button and a Back button. The Back button
 is also a submit (instead of a standard button - basically because we
 are creating a JS free applciation!)
 
 Within the struts configuration the validate is set to true for this
 action with an input page defined. The validation is set to check
 certain fields are not empty.

What you want to do is to set your back button to be a cancel button.
This is done differently depending on which content-builder you are
using (JSP, Velocity, or whatever), but basically you have to end up
naming the button org.apache.struts.taglib.html.CANCEL, which
indicates to struts that validation should be skipped. (Note that struts
1.2.7 (?) and higher require you to set a property for each action
mapping that indicates that the action is cancellable).

Note that, even though the validation is skipped, the form bean being
used for validation is *still* filled with this non-validated data.

If you are using a multi-page form bean, this is ideal: the user goes
BACK, changes something on the previous page, and then when they come
forward, again, you can redisplay the information they already entered
into the form. Once they submit *that*, you perform the validation and
move on.

Of course, if you want BACK, NEXT, and CANCEL buttons on the page, then
you can't really use this solution.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFWckq9CaO5/Lv0PARAjU2AJsHj3tDfnajq4v6FlOm+IW3hXabkwCfUXXm
HOv3KWS1mMon6Bbn32qnbCo=
=iLZY
-END PGP SIGNATURE-

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



Re: Validation + multiple Submit buttons

2006-11-14 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Lance,

Lance Semmens wrote:
 A JS free application? You can assume today's browsers have
 javascript, the web would break otherwise. Sure there are some cross
 platform issues but to go JS free is a tall order and will limit you
 to a clunky UI.

I disagree. I think that JS is nice to use in order to improve the user
experience, but relying on it to work is a recipe for disaster. Even if
JS is available and enabled in the browser, sometimes things just don't
work properly (new patch to the JS library or whatever) and your site
stops cold.

I recommend using JS as an improvement, not as a requirement. Just my
perspective.

 If JS free is your direction, you could wrap your back button in a
 html:form that posts to a different action to your save.

That's not going to work, as the form can't have two targets. If you
wrap the button in another form, you'll have to use JS to copy the
values from one form to another.

- -chris

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFWdNU9CaO5/Lv0PARAjY1AKCCGsILCwM8mPxNOuJ21x8NjtWecgCfecxC
93wu48nVTO6ZaXUfx0tPzZM=
=9WpP
-END PGP SIGNATURE-

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



Re: Validation + multiple Submit buttons

2006-11-14 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Andrew,

Andrew Martin wrote:
 That would be one solution, but in my case I have 4 submit buttons,
 two of which redirect the user to another action (keeping scope set to 
 session)
 and then back to the original form.

Hmm... that makes things more interesting.

How about this:

You create a new action called figureItOutAction or something like
that, and POST your form to that action. This action has no form bean,
no validation, no nuthin'.

In that action, you look for the names of the buttons that you want to
use, say: SAVE, BACK, CANCEL, and FOURTH_BUTTON (or whatever). Then, you
dispatch based upon the button that was pressed:

in struts-config.xml:
forward name=save path=/save.do /
forward name=back path=/back.do /
.
.
.

Remember to definitely NOT set redirect=true, since we need the reques
to stay in tact.

Your code for FigureItOutAction will look like this:

if(null != request.getParameter(save))
   return mapping.findForward(save);
else if(null != request.getParameter(back))
   return mapping.findForward(back);
.
.
.

Then, just point each of these dispatching actions to the ones that
really do the work. Each of these may have validation, form beans, etc.
For instance, your save action (or next... whatever) will have a
form bean and validate=true in struts-config.xml.

This trick allows you to submit your form to an action which decides
what to do independently of validation. Forwarding on to another action
that /does/ validate will then give you the magic of validation.

I haven't tried this before, but it should work.

- -chris

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFWdRw9CaO5/Lv0PARAra+AJ9zZ4ejuncDFJXlQHicNXykEh9EWACgqTBJ
GTAT1awgUG4RugUt/9jQNmw=
=jcpP
-END PGP SIGNATURE-

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



Re: Simple java question

2006-11-14 Thread Christopher Goldman
On Wed, 2006-11-15 at 06:33 +0800, Tamas Szabo wrote:
 Well, it isn't a global field is an instance variable of your class.
 And there is another way to access it. Just rename either the instance
 variable or the local variable.
 
 Tamas

Right.  While it is possible to do this, it does make it difficult to
read the code.  Better to use two different variable names.  Then you
never have to worry about which variable you're actually using, or
mistakenly use the instance variable because you *thought* the local one
was still in scope, when it was not.

Actually the one exception I employ is with setter methods:

public void setFoo( Object foo ) {
  this.foo = foo;
}

Chris

-- 
Christopher D. Goldman
[EMAIL PROTECTED]



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



Re: request.getParameterMap

2006-11-12 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Nitin,

Nitin M. Mandolkar wrote:
 As Map stores values as Kay and Value pair. Where type of value is
 Object. Here I am asking to Cast Object to String or call object
 toString method. 

Sorry... is there a question in there?

I definitely posted code that would convert your request parameters into
String values. You're right, I didn't use getParameterMap, but it's
because I thought it wasn't necessary.

- -chris

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFVy+59CaO5/Lv0PARAi+KAKCdWsbEmlCrAy3mgFC1w/pQ/optLACgxFWm
mu90qsNIAM6uv0QKXZqlwGY=
=Le1u
-END PGP SIGNATURE-

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



[OT] Humility (was Re: Select Multiples Check Box)

2006-11-10 Thread Christopher Goldman
On Fri, 2006-11-10 at 07:21 -0600, Daniel Chacón Sánchez wrote:
 Jajajajaajaja a coffee?, What you need is little of humility, I also had
 helped people answering their questions, the difference is that I´m not a
 prepotent person like you, this post was made by one partner because I was
 in a hurry and can´t answer her in the moment, but thank you for your 2
 minutes jajajajaja people like you don´t have to be in this mailing list

Daniel,

Quite humble, thank you.  I recognize that I'm a Struts newbie.  I
answer those questions I can, few as they are, if I can get to them
before someone else does.  I try to learn from the questions and answers
of others, and hopefully avoid mistakes I would not have seen otherwise.

I'm sorry if you were offended by my reply.  I tried to inject a little
self-deprecating humor in my response in order to soften it somewhat.

But I stand by what I wrote.

Chris


-- 
Christopher D. Goldman
[EMAIL PROTECTED]



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



[OT-Friday] Re: object[] to string[]

2006-11-10 Thread Christopher Goldman
On Fri, 2006-11-10 at 16:32 -0500, Monkeyden wrote:
 That wasn't very pedantic of you to mispell it.  :)

Misspell?  Or was that irony? ;)

Ever-pedantic Chris

-- 
Christopher D. Goldman
[EMAIL PROTECTED]



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



Re: [OT] object[] to string[]

2006-11-10 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Miro,

1. Please use your real name in your email address when posting to the
   list. temp temp is a poor moniker.

2. While some of us will be happy to answer purely Java questions,
   please mark such posts as [OT] (for off-topic) and apologize
   in advance. Otherwise, post to a generic Java mailing list.

In an effort to kill this question before it gets too far, I offer this
response:

temp temp wrote:
 I want contents  of java.util.list   as string array 

   Object aObject[]=   list.toArray();
   How can I  cast this to string []?

Casting is easy. That's just not what you're asking... what you really
want to know is how to convert a List of objects into a String array.

The answer depends on what you already have in your List. For example,
this might work if all your list items are already strings.

String[] strings = (String[])list.toArray(new String[list.size()]);

But if not all your objects are Strings already, you'll get an
ArrayStorageException or something like that.

If you have non-string data in there, you'll have to do something more
intricate:

int j=0;
String[] strings = new String[list.size()];
for(Iterator i=list.iterator(); i.hasNext(); ++j)
{
Object item = i.next();
if(null == item)
   strings[j] = null;
else if(item instanceof String)
   strings[j] = (String)item;
else
   strings[j] = item.toString();  // simple conversion; you might
  // require something more exotic
}

Hope that helps,
- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFVP5s9CaO5/Lv0PARAjXjAJ9rB/HEYfQCbCXegh7jFRxDg4KA3QCeN9Fv
dWayxrTmCHEys5Y269bRXco=
=lX7i
-END PGP SIGNATURE-

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



Re: [s2] Dynamically Parameterize Redirect Result

2006-11-10 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Mark,

Mark Menard wrote:
 Is there a way to dynamically parameterize a redirect result based on an
 http request parameter that you have used in the action your are redirecting
 from?

This isn't exactly struts-2 specific, if I'm reading this correctly.

 Is there a way to get a parameter that was passed to createPartyRoleType
 into the redirect on success?

One way to do it is like this, at the end of your action:

 ActionForward next = mapping.findForward(redirect-action);
 return new ActionForward(next.getPath() + ?id= + id,
  next.getRedirect());

There is also ActionRedirect, which essentially wraps an existing
ActionForward:

  ActionRedirect next = new ActionRedirect(mapping.findForward(...));
  next.addParameter(id, id);

  return next;

I personally think that ActionRedirect isn't good enough, and needs a
lot of improvement. I write my own class and submitted it as an
attachment to https://issues.apache.org/struts/browse/STR-2538, but
nobody seemed interested. Everyone is free to use this class if they'd like.

- -chris

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFVRAj9CaO5/Lv0PARArG7AKCMT5MGdFgUqR6WUWD2ptIxTI5odgCeJl5d
VfPtoSuUAzK49IUsAbF4F5k=
=Xoua
-END PGP SIGNATURE-

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



Re: Cannot Retrieve Request Parameter

2006-11-09 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Robert,

Robert Harrison wrote:
 Here is a truncated version of makeparms.
 
String separator = new String();
StringBuffer parms = new StringBuffer();
String desc = props.getString(credit.card.description);
String cost = props.getString(credit.card.amount);
 
parms.append(vendor_id= + vendor_id + separator);
parms.append(ret_addr= + ret_addr + separator);
parms.append(first_name= + firstName + separator);
parms.append(ret_mode=post + separator);
parms.append(post_back_on_error=1 + separator);
parms.append(lookup=xid); // Last item

Just a quick note on style, etc.: if you are going to use the + operator
to concatenate Strings, why are you using a StringBuffer? Since you've
already got the SB, go ahead and use it. Also, there's no need for
'separator' to create a 'new String' out of an existing string.

It does not appear that you use the locals 'desc' and 'cost', although
you might use them later, as you mentioned that this is a truncated
version of the method.

Several things stick out as potential sticking points in this code, as
well as the cost you posted before (that uses this code):

1. You are not encoding any of your data. You should be using
   URLEncoder.encode(string, charset) on all unknown data to
   protect against things like spaces and other illegal
   url-encoded characters (particularly the ret_addr).

2. You are not using a well-known Content-Type when sending your
   request. You should either explicitly use something like UTF-8
   or ISO-8859-1 (the default).

3. You are not passing the Content-Length header to the server.
   HTTP/1.1 does not mandate this field, but it's good form to include
   it.

May I suggest the following changes:

// In your makeparms method:

String charset = UTF-8;
char separator = '';
StringBuffer parms = new StringBuffer();
parms.append(vendor_id=)
 .append(URLEncode.encode(vendor_id, charset))
 .append(separator);

parms.append(ret_addr=)
 .append(URLEncode.encode(ret_addr, charset))
 .append(separator);
  .
  .
  .

// In your code that calls makeparm:

  StringBuffer parms = makeParms(userVO, creditCardForm, props);
  byte[] contentBytes = parms.toString().getBytes(UTF-8);

  URL url = new URL(props.getString(credit.card.vendor.url));
  URLConnection c = url.openConnection();
  if(!(c instanceof HttpURLConnection))
   throw new RuntimeException(Expected HttpURLConnection, got 
  + c.getClass());

  HttpURLConnection conn = (HttpURLConnection)c;

  conn.setDoOutput(true);  // Read-write
  conn.setDoInput(true);   // Read-write
  conn.setUseCaches(false);
  conn.setRequestMethod(POST);
  conn.setRequestProperty(Content-Type,
 application/x-www-form-urlencoded; charset=UTF-8);
  conn.setRequestProperty(Content-length,
 String.valueOf(contentBytes.length));
  conn.setInstanceFollowRedirects(true); // Optional
  conn.connect(); // Make the connection

  OutputStream out = conn.getOutputStream();
  out.write(contentBytes);
  out.flush();
  out.close();

  // Do whatever you want with the response. Don't forget
  // to appropriately detect the response's character encoding,
  // HTTP status, etc. If there's a problem, read from the
  // error stream, not from the input stream. Otherwise, you'll
  // get an exception.
  InputStream in = conn.getInputStream();
  // Whatever
  in.close();


I use this code in a component that I wrote to either GET or POST (this
is the POST code) to a fulfillment server which creates records in a
database for me.

It works perfectly for me, although I haven't given you 100% of the code
I've written (especially the part about reading the response).

Hope this helps,

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFU0/09CaO5/Lv0PARAs5ZAJ0TCG+C8BftGIqRtS6FI5ArHPPoNgCfejsN
z7rmVDvdwQrz/xTh18+F+to=
=QQVm
-END PGP SIGNATURE-

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



Re: Fw: problem with moving jsp pages under web-inf/ folder

2006-11-09 Thread Christopher Goldman
On Thu, 2006-11-09 at 17:29 -0500, robin bajaj wrote:
 Hi there,
 Okay, just to fix the blank pag issues in IE, I just went back to square one 
 and just applied your suggestion of using the following snippet in my jsp , 
 Now both IE and Firefox show simple contents without applying the 
 stylesheets or javascript effects.
 
 script src=${context_root}/scripts/oBCTS_scripts.js language=javascript 
 type=text/javascript/script
 script type=text/css src=${context_root}/css/styles.css/
 
 any idea, why is it still not working for me,
 I appreciate your help so far on this issue,
 robin

Robin,

See Ed Griebel's most recent reply regarding the use of the ${var} EL
in your JSP.

And go back to using the link tag for your CSS.  The script tag is not
going to work.

Chris

-- 
Christopher D. Goldman
[EMAIL PROTECTED]



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



Re: Select Multiples Check Box

2006-11-09 Thread Christopher Goldman
On Thu, 2006-11-09 at 15:33 -0600, Daniel Chacón Sánchez wrote:
 anyone??
 
 2006/11/9, Daniel Chacón Sánchez [EMAIL PROTECTED]:
 
  If someone explain how to do this with a multiple select and with
  checkboxs better for me :-)
 
  2006/11/9, Daniel Chacón Sánchez [EMAIL PROTECTED]:
  
   hi all!
  
   I have a question, I'm using struts.
  
html:select  ...
html:option  
  
   I have an object of pacients, I show them on a JSP, then I need to
   select some of them (by checkbox) and then submit the form. In the action 
   i
   need to know which patients where selected. The object of patients is an
   arrayList of patients which contains the id, name, etc.
  
   In resume in the action I need to know which are the IDs selected from
   the html:select.
  
   P.D: something like the image

Daniel,

Have you tried searching for the answer online?

Here's one possibility: http://www.husted.com/struts/tips/007.html

That link was from: http://struts.apache.org/1.3.5/faqs/index.html

Or Google: http://www.google.com/search?hl=enq=struts%20checkboxes

I think you weren't answered because the question is about basic Struts
functionality.  The answers are all over the place -- it took me less
than 2 minutes to find dozens of likely sources.

I'm sorry to get snarky, but these good people spend much time answering
questions at no cost to the questioner.  The least they (and I) expect
in return is not to get asked FAQs, and then get desperate-sounding
reposts when the replies are not quick enough for you.

(Okay, maybe I need more coffee.)

Chris

-- 
Christopher D. Goldman
[EMAIL PROTECTED]



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



Re: Losing Locale after Sesion.invalidate()

2006-11-09 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Chris,

Chris Pratt wrote:
 The problem is JSTL is being helpful. Perhaps too helpful in this case.
 Basically it is looking for an exact match between ResourceBundle and your
 Locale settings.
 It will look for English first, but only find the default resource bundle.
 It will then look for French and find a specific resource bundle for French
 language.
 Thus JSTL maps itself to the french bundle because it is a more specific
 match (despite the fact the preferred language is English)

Aah!

That's interesting behavior that is somewhat unexpected in this area
which is dominated by English-speaking folks. We tend to think that the
default (non-localized) version of our properties files is (of course!)
going to be in English. We're pigs.

What is interesting is that most of the time, we expect that the Locale
will be chosen based upon the user's preferences, and then we try to
serve them as best we can. The JSTL is, as you say, being extra-helpful
by finding the best match for locale. I wonder if there's a way to
tell the JSTL what the locale is for the default properties bundles...?

 So I've added an empty application_en.properties file to my project
 and the problem seems to be closed.

You might also consider using a symlink to point either
application_en.properties - application.properties or the other way around.

 Thanks for everyone's help.

Always good to get to the botom of a totally weird issue.

- -chris

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD4DBQFFU8TH9CaO5/Lv0PARAl0SAKCCqvWQJsMQScvcqP0nbbU0zwuo3ACXSeUp
6Vc00v9ByhqOTZXTTGs/dQ==
=NrHm
-END PGP SIGNATURE-

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



Re: Losing Locale after Sesion.invalidate()

2006-11-09 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Chris,

Chris Pratt wrote:
 Woa, that didn't work.

I didn't really expect it to... I would have expected you to get a bunch
of blank messages (since application_en.properties had nothing in it). I
don't think that resource bundles chain or anything like that.

 According to a comment in the JSTL code, the Java developers don't
 know what their doing and the JSTL guys decided that the whole idea
 of a default resource bundle is non-portable.

It's completely portable. What they really mean is that it's not really
that great of an idea, since there's no indication of what locale the
default bundle actually is. I think it's a necessity, since there's
always someone who uses a language you've never heard of and so you have
to display /something/. It may as well be the native language of the
development team ;)

 Not sure why, but that means that in order for this to work properly
 in both Struts and JSTL I have to maintain identical
 application.properties and application_en.properties files.

I recommend the symlink approach. If you use ant for deployment, I think
you can do this on the disk. Or, you could also just copy
application.properties to application_en.properties before WARing your
webapp. That's what I'd do.

No need to maintain more than one copy of the same file in your source
repo... have your build process take care of that.

- -chris

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFU8Wy9CaO5/Lv0PARAi/ZAJ9YIOGmZNXNrfOc6EVFsa/6V15ScgCgmGS3
4KqTSObdfg2+C+JOyr+qBbM=
=c49X
-END PGP SIGNATURE-

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



Re: [OT] Deploy Images externally from application

2006-11-09 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Affan,

[EMAIL PROTECTED] wrote:
 I have an application which contains a bunch of images for products whose 
 filenames come from the database. Right now the images are stored inside 
 the WAR file when deploying the application

Ugh.

 We don't care about versioning image files since they are maintained
 by a third party.

Yeah, get those things out of CVS.

 I wish to know what approach would be the best to keep the images outside 
 of the built WAR and still being able to access them easily from the 
 application. Some approached I thought of were: 
 
 - Maintain images in a separate CVS module. When deploying the application 
 explode the WAR file and include the images and re-war the war file. 

Why bother with CVS? Why bother with a WAR? Why bother with deployment?
Just keep them in the same place all the time.

 - Store images in a separate folder outside of the context root and refer 
 to them via a symlink (platform dependent) or a configuration property in 
 the application (platform independent). 

The symlink is not necessary.

I think you should just allocate a portion of your URL-space to these
images. Something like /images, maybe.

You ought to be able to divert a particular URL space to another
directory which is external to your webapp (i.e. not stored in the
myapp directory under your servlet container's deployment directory).
For instance, in Apache httpd, you could do this:

Alias /images /full/path/to/your/image/repository

I would imagine that Jakarta Tomcat has the same capability, though I
have no idea how to configure it.

If you do something like this, you can keep your images in a directory
structure that is completely independent of your webapp, and doesn't
have to be handled specially during deployment of new webapp versions
(or even additional webapps).

If you make the URL prefix for those images dynamic within your
application, you can do something like this:

  a href=${image-prefix}/{$image-path}View Image/a

Your image-prefix could even be fully-qualified (i.e. starting with
http://) and you could use a different server altogether to serve those
images. In fact, if you have a third-party who maintains your images,
you might even be able to serve these images from /their/ servers.

Hope that helps,
- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFU8d39CaO5/Lv0PARAobKAJ9Je01VRGJf4e4ctgVwraZdXF7ouACghuWA
DFJwCQB57GQWG8N9MjX0ILk=
=eceU
-END PGP SIGNATURE-

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



Re: Two values on input attribute

2006-11-08 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Thom,

Thom Burnett wrote:
 First, I found my error and it's (of course) not in any of the code listed.
 I had neglected the import statements in the jsp pages. :-(

That always helps. So, your JSPs weren't compiling or something? It's
odd that it would work, and yet, not work.

 Is there a way to get warnings or error messages when I've made a mistake
 like this in the jsp?

JSP compilation errors should show up right in the page. When something
like this happens, it's best to shutdown Tomcat, kill your work
directory and any expanded WAR files (usually killing the work dir does
that), and re-starting. It doesn't happen often, but sometimes TC goes
brain-dead and you just have to lobotomize it.

 In my build there was no compiler error or warning. Finding this type of
 error by inspection is very time consuming.

Certainly, and this is not the way it should work. I suspect that there
was a datestamp issue so it looked like the already-compiled version of
your JSP was more up-to-date than your new version.

Do a clean build and re-start and I think you'll find that TC will
report those compilation errors.

- -chris

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFUk1/9CaO5/Lv0PARAjLXAJ9/xvNULda5/ULRXnMbHlImlkzghACcD1PL
Ky8IDaNaMIAELu37uNl38Sc=
=INdL
-END PGP SIGNATURE-

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



Re: Cannot Retrieve Request Parameter

2006-11-08 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Robert,

Robert Harrison wrote:
 CreditCardPaymentAction
StringBuffer parms = makeParms(userVO, creditCardForm, props);
sendRequest(conn, parms);

 private void sendRequest(HttpURLConnection conn, StringBuffer parms)
{
DataOutputStream writer;
conn.setRequestMethod(POST);
conn.setRequestProperty
 (Content-Type,application/x-www-form-urlencoded);
writer = new DataOutputStream(conn.getOutputStream());
writer.writeBytes(parms.toString());
writer.flush();
writer.close();
}

It would seem that you haven't provided the code to the makeParms
method, which could be the source of your problem. Note that you ought
to include ;charset=[your character set] after your content type's
mime type, just to be explicit about what you are sending to the remote
host.

 CreateUserAction
String xid = request.getParameter(xid);
String s = request.getQueryString();
System.out.println(The Query String is  + s);
 
BufferedReader in = new BufferedReader(request.getReader());

Using request.getParameter and request.getReader (or
request.getInputStream) rarely work well together, since
request.getParameter requires parsing the input stream to get POST
parameters. My guess is that you are not sending a correct POST body,
and you parameters aren't being read by request.getParameter. But, that
request body is still available for reading by this code:

String decodedString;
while ((decodedString = in.readLine()) != null) {
System.out.println(decodedString);
}

So, what does your POST request look like, then?

- -chris

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFUk9E9CaO5/Lv0PARAi/uAJ4jlNPZTqMtStVKoijquNg2qXGikQCgsuwy
lQfLBTPq8v0B9pFRp8FLHfk=
=tcQB
-END PGP SIGNATURE-

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



Re: Losing Locale after Sesion.invalidate()

2006-11-08 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Chris,

Chris Pratt wrote:
 It seems that the next time SecurityFilter gets run after a
 Session.invalidate(), it calls Session.invalidate() itself which was
 throwing out the values set by I18NFilter.

Really? So, it's killing your new session? It really ought not to so
that. Do you think this is a bug in securityfilter?

 Whew, problem solved, right... NOT!!  Now the values are getting set into
 the session and are appearing properly when I dump their values using my
 Custom tag (See below), but JSTL is still printing out the text in French!

Heh. No love.

 Oh, one other piece of information, I've determined that this only happens
 if the Accept-Language headers contains fr as an option, even if it isn't
 the preferred language.  If the browser sends Accept-Language: en-us,en;q=
 0.8,fr-ca;q=0.5,fr;q=0.3 I get French text.  If it sends Accept-Language:
 en-us,en;q=0.5 I get English.
 
 I'm totally flabergasted, how can this happen???  Anyone have any ideas??

Okay, now this is making more sense (at least the French part).

Can you clarify which of struts and JSTL goes French on you? Or, do they
both go French on you?

- -chris

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFUnHV9CaO5/Lv0PARAgFlAJ9QhIeWQhlF1EwKyXyppgoXIWs0ywCgsWaX
JL5TOD1MS0k4RZaiyHUdlk0=
=P0na
-END PGP SIGNATURE-

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



Re: Losing Locale after Sesion.invalidate()

2006-11-08 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Chris,

Chris Pratt wrote:
 Yes, I'm using mainly JSTL to display data on the page (fmt:message) and
 they're all showing up in French.  I put one bean:message on the page just
 as a test and it is correctly displaying English.

Hmm. It looks like the JSTL improperly detects the locale from the
accept-language header. I assume you aren't mutating that header or
anything like that, eh?

Where does one get a copy of the JSTL tag libraries? Maybe it's time to
look at some of the code used, there.

IIRC, you are determining the locale yourself in your I18NFilter and
attempting to set the locale in the session (for struts) and using the
Config.set thing for the JSTL. I assume you have confirmed that the
locale you are attempting to use is the 'en' locale.

Is there a Config.get()?

Perhaps, after calling Config.set() you could call Config.get() with the
same target object and key, to make sure that it stuck.

Also, check both the session and whatever Config.get returns /after/ you
call chain.doFilter(). You can see if the JSTL is overriding your
locale-setting sometime during the request.

What happens when you call request.getLocale()? That should give you the
preferred locale, no? What does it give you in these weird cases?

- -chris

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFUnbW9CaO5/Lv0PARAuaVAJ4rfgOYjpJeGbHe1RVTb46puqBo6wCbBfEj
zxU/kl6iBXxctKciirwoUjQ=
=A93U
-END PGP SIGNATURE-

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



Re: Losing Locale after Sesion.invalidate()

2006-11-08 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Paul,

Paul Benedict wrote:
 In Struts 1.3.6, I hope to be providing a locale solution for Struts
 which is not tied to the session.

Does struts rely on the session for locale information? I would have
expected a null session to result in a call to request.getLocale for
each request (or, at least, for each time the locale is required).

I don't see why the session should be an absolute requirement. Is that
currently the case?

- -chris

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFUnt89CaO5/Lv0PARAqqqAJ4ymycIXp1TH8p0r2zz4C+pTHQVkQCcCA3Q
7FLW3Y71MyxjvYqRD6xThLg=
=vwCs
-END PGP SIGNATURE-

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



Re: Starting validation

2006-11-07 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Thom,

 struts-config.xml:

This looks good.

  request.setAttribute(sessionForm, this) ; // If I don't do this the
 form will be blank after an error.

You really shouldn't have to do this. The form bean in the session will
be called donorBean because of the value of the name attribute in
your action mapping in struts-config.xml.

  request.setAttribute(errors, actionErrors) ;

You shouldn't have to do this, either. Struts should be putting this
ActionErrors object into the request for you. This is all you should need:

  return actionErrors ;


 My validations.xml file - working partially

When you say partially, you mean that your form is re-displayed when
validation doesn't pass, right? It's just that your errors do not show
up and the form fields are blank. I think your validation is probably
okay, but let's see.

 arg0 key=validation.error.firstname/

Do all of these properties actually exist in this file:

/WEB-INF/ErrorMessages.properties (this is where you indicated your
message resources were).

I'm not sure what is the standard way to do this, but I have my
message resources in my WEB-INF/classes directory, and I specify it like
this:

message-resources parameter=ApplicationMessages null=false /

You might try adding 'null=false' to see if you start getting messages
like '???en_US.validation.error.firstname???' in your pages. If you get
these messages, it means that struts can't find your error messages, but
they are being properly generated and saved into the request.

  html:errors/

This ought to print /something/. My guess is a properties file loading
problem (see above).

Hope that helps,
- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFUMCr9CaO5/Lv0PARAg8pAJ0ToTTuxR2wC09xbRLXrGTNKfwa7ACfUhBI
41L+o5dayknOJDxN2PrQOl8=
=T+ly
-END PGP SIGNATURE-

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



Re: Starting validation

2006-11-07 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Thom,

Thom Burnett wrote:
 With that fixed I can take out the sub class' validate() method and still
 get a set of errors.

That's good, I guess. What do you mean, the subclass's validate method?
I didn't realize that you had multiple levels of validation being performed.

 However, getting errors still depopulate's the form's fields.

That shouldn't happen. Lemmie look at your JSP source again...

Ah. You didn't provide any of the HTML code that contains the input
elements. Could you post a representative sample?

 Again, I can
 fix that by overriding the validate method (calling super) and that's not a
 horrible solution

Yeah... don't do that. You should be able to work directly with the bean
that you already have. No need to go through any acrobatics like this.

Just so I know, what is the superclass for this bean and what does its
super.validate method do that you aren't doing in the subclass?

Come to think of it, why are you overriding the superclass's validate
method in the first place? And... if you are overriding it, why aren't
you calling that superclass method first thing in your overidden method
implementation?

If you have a base form bean that contains some utility methods, you
should not have to call super.validate(). On the other hand, if you have
a super class bean that needs its validation done /too/, then you should
do this:

public ActionErrors validate(...)
{
   ActionErrors errors = super.validate(...);

   // Now perform your own validation.

   return errors;
}

 As near as I can see the form is being named and associated correctly but I
 must be missing something.

It looks like validate() is being called, otherwise you wouldn't be
getting error messages. Since your action mapping names the bean /and/
the input attribute is associated with the mapping (i.e. there's no
redirect), that bean (including its invalid input) ought to be available
in the session (as per your 'scope' preference).

Post your JSP code around your input elements and let me have a look.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFUM8a9CaO5/Lv0PARAsyxAJ9YtgRv+A4MQgUi5n4zppJVkTcFIQCfeM3n
yrmuTXI0ttkeoceXAFyr/aQ=
=wyhj
-END PGP SIGNATURE-

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



Re: request.getParameterMap

2006-11-07 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Nitin,

 From: temp temp [mailto:[EMAIL PROTECTED]
   How can I translatevalue [Ljava.lang.String;@1849daf to
 readable String?

Nitin M. Mandolkar wrote:
 Cast it to String object. 

This won't work. Casting String[] to a String will result in a
ClassCastException, which does not yield the desired result.

The shortest code you can use to produce nice output for a string array
is this:

System.out.println(java.util.Arrays.asList(stringArrayObject));

In order to get all of your request params to print like this, you might
try something like this:

for(Enumeration e=request.getParameterNames(); e.hasMoreElements(); )
{
   String paramName = (String)e.nextElement();

   String[] values = request.getParameterValues(paramName);

   System.out.print( request params key= + paramName
+ , value=);

   if(null == values || 0 == values.length)
   System.out.println(NULL);
   else
   System.out.println(java.util.Arrays.asList(values));
}

- -chris

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFUNWX9CaO5/Lv0PARAhZdAJ9y49zX4qFU04yXJ6inwFjNEcavTgCfToMN
F/7EPPW4eMIPqn/cGyHZo98=
=Sh4W
-END PGP SIGNATURE-

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



Re: Starting validation

2006-11-07 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Thom,

Thom Burnett wrote:
 I'm working on an application that uses several jsp pages to gather
 one set of information before it really does anything with it.
 Ideally, the first form gets validated before the user can get to the
 second form and that must be validated before the third  And of
 course all of this must work if the user hits the browser's
 navigation buttons.

This is a pretty standard multi-page form flow. I assume that you are
using a single form with each page separated-out in the validation one
way or another. If not, consider doing that. I switched from
hand-written form beans to dynamic form beans over the past year or so
and haven't looked back. They support this paging concept, and work very
well with the commons-validator plug-in, so you can write your
validations in a declarative way instead of hand-coding everything.

At any rate, let's move on.

 Before I added any validation at all, I found that when I filled out one
 page and went on to the next page, I'd lose whatever was added in the first
 page unless I put the sessionForm as an attribute.

I think what you want to do is one of the following:

1. Name each form something different, and set them all to
   scope=session. Collect all of the forms from the session in your
   final do it action.
2. Write an action to save the validated data from each page of your
   multi-page form somewhere (like the session) in either a custom data
   bean or something like that. Then, pull that data out in your
   final do it action.
3. Merge all your separate forms into a single form and validate based
   upon the current page. You can stop validation at any point when
   you hit the end of the page in your validation by simply returning
   from the validation method somewhere in the middle. Just add a
   page property to your bean and submit the current page as a hidden
   form element. Then, use that value to determine where to stop
   validation. This is how the dynamic, multi-page form beans do things.

 Simply specifying that
 the form was in session scope didn't keep the information around.

That shouldn't be the case. Are you sure you were using the correct
session attribute key? That key should match the name attribute of the
action mapping.

 So maybe the use of the Javascript to fill input values is killing 
 something that struts is trying to do. I just know that without this,
 I didn't keep information between requests.

Aah, the plot thickens: you are using Javascript to re-populate your
form fields? Yuck. Don't do that. Struts is perfectly capable of doing
that for you. Turn off all that javascript weirdness until you get this
issue solved, then re-add any javascript you think you still need.

 The reason for overriding the validate method was to set the sessionForm
 attribute. I was also just starting to try to use the
 ValidateForm.setPage().
 As I understand it, that field (page) should enable me to have validation
 done only on parts of the form. I haven't seen any examples and am just
 trying it out as we speak.

Yup. This is really the way to go.

  % AllDonationInformationFormBean3 sessionForm =
 (AllDonationInformationFormBean3)request.getAttribute(sessionForm) ;
 if(sessionForm == null) sessionForm = new
 AllDonationInformationFormBean3() ; %

Okay, the sessionForm should actually be called donorBean. You
should also be getting it from the session (duh -- was that a typo?). Do
it like this:

%
AllDonationInformationFormBean3 donorBean =
  (AllDonationInformationFormBean3)
  session.getAttribute(donorBean);
if(null == donorBean)
  donorBean = new ...();
%

select name=salutation/
   option value=Mr.Mr/option
   option value=Ms.Ms/option
/select

You aren't pre-selecting this field based upon what is in the bean. Did
you mean to do that?

input type=text name=firstname value=%=
 sessionForm.getFirstname() % /br/

Okay, this /is/ what you should be doing, except using my example, I
used donorBean instead of sessionForm. If you add javascript on top
of this, you are just going to confuse the hell out of yourself.

font color=red*Last Name:/font
input type=text name=last  value=%= sessionForm.getLast()

Just a matter of style... why do you have firstname versus last? I
would recommend lastname in this case since it's pretty much the same
thing as the firstname. Again, that's just a matter of style, really.
Although, if your form is expecting firstname and lastname, then
this is a bug.

Although it /is/ just a matter of style, I think it's good to be
consistent because it reduces the chances of an accidental bug popping up.

Hope this helps,
- -chris

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFUNoh9CaO5/Lv0PARArkFAJ4sGAG7GttGAE+l/3/NrGIO/1vD6gCaAjaU
ZfVQBTr/eJefPw6d707U22w=
=poVi
-END PGP 

Re: Losing Locale after Sesion.invalidate()

2006-11-07 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Chris,

Chris Pratt wrote:
 I am having a strange problem with JSTL locale's after Session.invalidate.
 I am using JSTL as the main TagLib with Struts 1.2.9.  So to keep both
 systems in sync, I have a servlet filter that executes this code:

[snip]

if(locstr == null) {
  if((locale = (Locale)ses.getAttribute(Globals.LOCALE_KEY)) == null) {
locale = req.getLocale();
  }
} else {
  locale = new Locale(locstr);
}

An I reading this right? You have an optional request parameter called
locale that you can use to set the locale to something specific. If
that parameter is not found, then you check the session for Struts's
locale. (Note that the session has just been invalidated, so this is
likely to return null in this). If struts doesn't have one, then you use
the locale of the request (presumably from the client's provided headers).

if(locale != null) {
  ses.setAttribute(Globals.LOCALE_KEY,locale);
  Config.set(ses,Config.FMT_LOCALE,locale);
}
chain.doFilter(req,res);

It looks like that ought to do it. Are you sure you aren't ending up
with a NULL locale object in this code?

 This works great except when, after the LogoutAction calls
 Session.invalidate(), I redirect to a Logout Success page.  For some
 reason that page picks up the French text from the
 application_fr.properties
 resource file for the JSTL tags, but not for the Struts tags.

That suggests that Globals.LOCALE_KEY isn't set properly. Can you dump
out the contents of the session in various places? For instance, what
does the session contain both before and after this call:

chain.doFilter(req, res);

I haven't used the JSTL before... I assume Config.set(ses, foo, bar)
basically does ses.setAttribute(foo, bar), eh?

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFUN129CaO5/Lv0PARAnwfAKCVnQ0fabblJ5jrSjYAeiqS9v8x5gCfd2M9
p9uCdcUZiP1W47nIhMVuvJ4=
=LPOU
-END PGP SIGNATURE-

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



Re: Losing Locale after Sesion.invalidate()

2006-11-07 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Chris,

Chris Pratt wrote:
 Thanks for the reply, and you read it correctly [snip]. Here is the 
 information I'm getting in my logs from all the debugging statements:
 
 [10:08:43.179] I18NFilter.doFilter: Processing Request for
 /canada/logout.jsp
 [10:08:43.179] I18NFilter.doFilter: Using Locale from Request - en_US
 [10:08:43.179] I18NFilter.doFilter: Session (abcWr_wP-sVd1_Us3Md7q) is new
 and is valid
 [10:08:43.179] I18NFilter.doFilter: javax.servlet.jsp.jstl.fmt.locale=en_US

Okay, I don't see anything about the struts globals key. Is this because
you aren't printing it, or because it isn't in the session?


 [10:08:43.616] ShowConfigSettingsTag.doStartTag: JSTL Configuration
 Settings
 (abcWr_wP-sVd1_Us3Md7q)
 [10:08:43.616] ShowConfigSettingsTag.doStartTag:   *
 javax.servlet.jsp.jstl.fmt.locale null

That doesn't look right... didn't you set the locale in your filter? If
so, then why is this null?

 [10:08:43.632] ShowConfigSettingsTag.doStartTag: Struts Configuration
 Settings
 [10:08:43.632] ShowConfigSettingsTag.doStartTag:   *
 org.apache.struts.action.LOCALE en_US

That's very odd that the session apparently now contains the locale
under the struts key, and the JSTL ones is null. What's going on? I
thought you said that the JSTL stuff was working, but the struts was
not. This session information seems to disagree.

Your first set of output (from the I18NFilter) agrees with your report
that struts doesn't work and JSTL does, but the output from the
ShowConfigSettingsTag is the exact opposite.

Are you sure they are the same session (not sure why they wouldn't be,
but that could explain something).

 Weird.

Agreed.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFUO0X9CaO5/Lv0PARAuj2AKColl8RxT73qqw6cc3EhHMqj3oM6gCgpcaI
M9glFqOB6UES817fccQERdw=
=cSrP
-END PGP SIGNATURE-

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



Re: Losing Locale after Sesion.invalidate()

2006-11-07 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Chris,

Chris Pratt wrote:
 No the original problem statement was that the JSTL fmt tags were
 picking up
 the French text even though the locale was set to English

Strange. Where is that French locale coming from? Default JDK locale?
Locale of the web browser's headers? Stray alpha particle?

 the Struts tags are working correctly.

Okay, that makes sooo much more sense.

 The only thing that I can think of is that the
 Config class isn't working properly in this situation.  With Struts I set
 the Session Attribute directly, with JSTL, I used the Config.set() method.

Is this happening in a request that is distinct from the one in which
you did the invalidate? Or, might you be invalidating the request, and
then doing a server-side forward to the code that re-sets this locale?

I'm just wondering if it's possible that Config.set grabs the /old/
session identifier instead of the new one. Is Config.set the recommended
way to set up data for the JSTL? As I said, I've never used it. Is there
an alternate way? Say... poking a value directly into the session?

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFURP89CaO5/Lv0PARAvGSAKCVIzPWw9HxIMEntWrl8y383UvOqQCgvfKz
jki/ZLBndeuNBs+2d5hdnRg=
=LaG0
-END PGP SIGNATURE-

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



Re: HTML:FILE

2006-11-07 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Van,

 I’m trying to create a jsp page that can upload a file.  Everything
 works, but I cannot apply my style to the “Browse” button:

Most browsers don't let you style the browse button for file input types
specifically.

 That displays the regular button… I apply the same styleClass to the
 submit button and that works out fine:

Yup: that's because it's a button instead of a file input type. I
think you might just be out of luck.

Also remember that Safari won't let you style buttons at all.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFURSP9CaO5/Lv0PARAq86AKCbxpnO0NWrpJiufghYc1DgaurMRwCfVuWd
Xdh0v8SjllxjHA4VgaZKOzM=
=bXWD
-END PGP SIGNATURE-

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



Re: Losing Locale after Sesion.invalidate()

2006-11-07 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Chris,

Chris Pratt wrote:
 I believe stray alpha particle is the most likely answer.  I'm on a
 US PC, with an English version of Windows XP.  Everything on this 
 machine screams English, but for some reason it's picking the 
 application_fr.properties.

Totally weird.

 As far as I can tell Config is the correct way to set JSTL values and
 since I passed the same HttpSession instance into the Config.set that
 I used to set the Struts Global value, I can't see how it would have
 gotten the old session.

Oh, duh. Yeah, you *do* pass-in that parameter. Are you sure that's what
you're supposed to do when setting the JSTL locale? It looks about
right... just making sure.

 I really don't want to have to try and debug into the black box that
 is Struts, but that's looking more and more likely

I thought struts was working properly, though. Oughtn't you be digging
through JSTL instead?

 (so much for saving time on this project by using a tried-and-true
 technology instead of rolling my own like I've always done in the
 past).

Don't write-off struts just yet. It's the best app framework I've ever
used, though I've only ever used two: one was home-grown and was
completely worthless. The other was Turbine which didn't match up with
the way I see application frameworks as being useful. I actually
converted a Turbine project to struts (ugh) and I've never looked back.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFURnL9CaO5/Lv0PARAomFAJ4+1eK+AUMrI8LKrpGYl1UGiyCvAACgwNif
/F/JuuC8/M4mgVqluYOTMIM=
=zqql
-END PGP SIGNATURE-

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



Re: Action gets repeated every time i repeat the page.

2006-11-06 Thread Christopher Goldman
On Mon, 2006-11-06 at 13:52 -0800, Uday Karrothi wrote:
 Hi guys,
 
 When i press a button for Exmaple. 'ADD',
 When i press the Button 'ADD' the values of the element 'X' are passed and
 the form is submitted.
 
 One emlement 'X' of ArrayList A is added to ArrayList B.
 
 When i Refresh teh page now, the operation is done  again.In ArrayList B i
 have two elements of 'X'.
 
 I store the action to be performed and the elements value in the form bean.
 So in the action clas i access them and perform the operation. So when the
 user press Refresh from the browser, the same values exist in the form
 bean and the action class performs the same action again.
 
 
 Has anybody had this problem? I am not sure what i can do not to repeat the
 action.

Uday,

Take a look at this article.

http://www.theserverside.com/tt/articles/article.tss?l=RedirectAfterPost

Chris

-- 
Christopher D. Goldman
[EMAIL PROTECTED]



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



Re: Two values on input attribute

2006-11-04 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Yariel,

 I have a page validated with Validation Framework, but I can get that
 page from two diferent jsp inputs. When an error ocurs, the validator
 always turn me back to the same jsp input (the one especified) not
 matter which was the selected input. It is possible to set two values
 to input attribute in an ActionMapping?? Is there any other way to
 do something like that??


Generally, this is done with two separate ActionMappings, like this:

!-- submit to here from first.jsp --
action path=/path1
type=MyAction
name=MyFormBean
validate=true
scope=request
input=/first.jsp
  ...
/action

!-- submit to here from second.jsp --
action path=/path2
type=MyAction
name=MyFormBean
validate=true
scope=request
input=/second.jsp
  ...
/action

You are doing the exact same thing in both cases, except that the
input attributes are different. The validation should be the same,
using the same form bean, etc.

Hope that helps,
- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFTJOE9CaO5/Lv0PARArvPAJ9/6S//E9jkQFVy/QC2mIGUTMBgAACgr4d2
NY36tWCeaj9w/2bBwcBpKKY=
=CJAz
-END PGP SIGNATURE-

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



Re: Optimal Heap Size for my Struts-Application

2006-11-03 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Jorge Martín,

Jorge Martín Cuervo wrote:
 It's a realy cool question, i've a complex webapp with a lot of
 differents diciplines:
 
 - xstl
 - xsl-fo
 - very large objects in session

These three are going to kill you. XSLT uses a ton of memory during
processing, depending on how your templates are written. I would imagine
that the processor could really work like a SAX pipeline should and be
fairly lean and mean, but as soon as you start running xpath expressions
like '/root//something' you can require that entire XML documents be
cached in memory; not just the text itself, but tons and tons of
associated objects.

 The tests with jmeter using 10 concurrents users don't cause an memory
 exception (i use 256M for heap)

That's good.

 there is some guide to view what we have to check to see what's
 happening behind the scenes?

I would turn on verbose GC in your VM and watch the memory usage during
your load tests. Run it for a few hours with a load of 10 users, and
then take the GC output and graph it. If you get a nice curve that looks
like this: /\/\/\/\/\/\/\/\/\/\/\ then you are probably okay in terms of
application memory leaks (meaning that you have few or none). If it goes
steadily upward, you might want to look into what those objects are.

If your load test doesn't run out of memory, you'll have a memory
baseline for 10 users. Ramp that up to 15 or 20 users and repeat the
entire process. Make sure that the memory curve still looks like
/\/\/\/\/\ and then you'll have a measurement for 15 (or 20) users. Try
this again with another step (maybe 25 or 30) and check the numbers.

- From those 3, you ought to be able to predict how much memory you need
for a certain number of users. Determine the peak load that you want to
support, and set the heap to that size. Then, sit back and watch. It
might be good to know the number of users logged-into your system at all
times. If you get an OOM, you might be able to see that you got more
users than you predicted (maybe you planned for 50, and had 58 instead).
In that case, you are free to increase the heap size accordingly.

If there were only 10 users on during the OOM, then you either have a
special case where a ton of memory is required (very possible) or a
problem like a memory leak.

Hope that helps,
- -chris

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFS0c/9CaO5/Lv0PARAjcsAJ9L/9faaE8W/b2jIFjPO+6oQpgbPgCfc9zK
g/Hz30E19Et9lKUhLHmxXQA=
=xzbR
-END PGP SIGNATURE-

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



Re: using SMTP server

2006-11-01 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

To whom it may concern,

   I wanna put a text box on my form that user can enter her email and by 
 submitting, an email send to her. I can do it with a free SMTP server. I set 
 smtp host on localhost in server.xml ( {tomcat folder}/conf/server.xml). But 
 It just works for gmail. It can't send mails to yahoo and hotmail. 

   Plz help me or introduce me some documents about SMTP protocol.actually 
 It's not very clear for me.

Are you testing this from your home computer? Many email services are
refusing to accept email originating from IP ranges that are allocated
to home users, since so many of them have been compromised and turned
into spam senders.

Look into either using an email relay (you'll have to set one up
yourself) or run your application outside the home IP space.

Just a guess.

- -chris

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFSJ4y9CaO5/Lv0PARAlALAJ4oLYHRcyho4Qs5WG1FHBEHbBzVqwCgrayg
my68bU1UntwY1Sk8IG71z4M=
=8Arp
-END PGP SIGNATURE-

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



Re: using SMTP server

2006-11-01 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

David,

 Don't forget about the handful of ISP's that block outgoing port 25
 (SMTP) unless it is directly to their own mail servers.  I had one of
 two of those in recent years.

That is unlikely, as he can successfully send messages to gmail. I think
that hotmail and yahoo! blocking residential IP blocks is more likely.

- -chris

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFSLxz9CaO5/Lv0PARAgGIAJ4nlgr3OAx6aw81CfNYDnLey+HJNACfarYB
i3xnzQmPvVshm1Qr671YOhg=
=ii+0
-END PGP SIGNATURE-

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



Re: ModuleException

2006-11-01 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Rick,

 Let me give this one more try:  I'm considering using the
 ModuleException class for exception handling.  It looks like a
 reasonably painless way to go.  Is there any reason *not* to use this
 method?

You mean exception, right?

I recall your initial message and your concerns about requiring Struts.
But, as you mentioned, you will be using this only in Action classes,
which already (duh!) require Struts.

Are you nervous about using these exceptions?

 Or if anyone can point me to an example showing a better
 method, that would be great also.

Typically, if I catch an exception from some service that I called (say,
an application-specific exception), I'll go ahead and just insert the
error messages directly like this:

ActionMessages errors = new ActionMessages();

errors.add(ActionMessages.GLOBAL_MESSAGE,
   super.getActionMessage(error.whatever,
  MyBundle, request));

super.saveErrors(request, errors);

return mapping.findForward(error);


Note that super.getActionMessage is a method that I wrote to get an
error message from a specific bundle.

My global error page prints out any error messages available in the
request. No need to throw another exception.

It really just comes down to what you want to do.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFSL8y9CaO5/Lv0PARAjQjAKCYuBFRIoPyQwrdmm5Ox1tntZsl9gCgwGf2
g6QF++OWAq6UiyNGzxXquvU=
=IYly
-END PGP SIGNATURE-

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



Re: how to generate GLOBAL errors using Struts validation framework

2006-11-01 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Robin,

 When the user submits the form with more than one fields left blank (or
 with incorrect values), I want to show a
 general (GLOBAL) message on top of the form saying
 
 Following shown mandatory fields were provided with incorrect values

How about putting something like this in your JSP (haven't worked with
JSP in forever, but this ought to get the point across):

jstl:if test=$errors
   p class=error
  struts:msg key=error.title.some-fields-are-bad /
   /p
/jstl:if

 b) And then I want to show a field-specific error message beside each
 input field that failed the validation rules.

Umm...

jstl:if test=$errors.form-field-1
jstl:echo value=$errors.form-field-1 /
/jstl:if
label for=form-field-1Field/label
input id=form-field-1 name=form-field-1 ... /

etc.

Does that help?

- -chris

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFSNge9CaO5/Lv0PARAnMUAKCEW3KwUC3YaNg1SyIc1ymI3kme7gCeLiEL
ObQSWl9yGmcsoQSrfm78/h4=
=1rei
-END PGP SIGNATURE-

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



Re: ModuleException

2006-11-01 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Rick,

Rick Schumeyer wrote:
 I was hoping to learn about the pros/cons of various methods before
 picking one.

I prefer my technique because it does not require throwing another
exception. It's a tiny amount of time, but throwing an exception takes
more time than doing the work manually in the action. Also, I get to
direct Struts to my preferred error handler (ActionForward) instead of
using whatever has been configured globally as the exception handling page.

Perhaps it makes the Action code more verbose, but I am okay with that.

Just my .02

By the way, what is the traditional Java way in this case?

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFSNyM9CaO5/Lv0PARAl5CAJ9zncxCrPn9iART66kFr8k3PSp1bQCbBu6f
Ns5fo+0kCXZSq3V4ujSdBBQ=
=/MyO
-END PGP SIGNATURE-

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



Re: ActionServlet and RequestProcessor

2006-11-01 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Nitin,

Nitin M. Mandolkar wrote:
 The Actionservlet delegates the handling of a request to a
 RequestProcessor object  Previously this is job is done by
 ActionServlet itself. Now it is pass on to RequestProcessor.
 
 I am not getting how it is going to help for web application development.

If you wanted to override any of the functionality of the
RequestProcessor, you can now just subclass the RequestProcessor and do
whatever you want, instead of doing the same with the ActionServlet.

Perhaps it is no more or less convenient than it was in the past, but
the logical separation of duties (RequestProcessor is a better
abstraction than the ActionServlet) makes better sense, at least to me.

Also, if you change servlets (say, from ActionServlet to
MyOverriddenActionServlet), then you have to configure your servlet in
web.xml. I think you use struts-config.xml to configure the
RequestProcessor to use. Not that it makes much of a difference.

If you never messed with ActionServlet in the past, then you probably
aren't going to mess with RequestProcessor right now.

Just trust that the Struts team thought it was the right move to make,
and the change can be safely ignored if the change doesn't affect you.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFSOMJ9CaO5/Lv0PARAsu5AKCd+aP7J1kHfTY+P5ePJK6Z8fI25ACeItJ0
2rOeadqOW7NPLgTLdZki0pY=
=4FCH
-END PGP SIGNATURE-

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



Re: Rolling back form changes

2006-10-31 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Dave,

Dave Newton wrote:
 For a DynaValidatorBean, no such methods exist.
 
 http://jakarta.apache.org/commons/beanutils/commons-beanutils-1.6.1/docs/api/
 
 'If the origin bean is actually a Map, it is assumed to contain
 String-valued simple property names as the keys, pointing at the
 corresponding property values that will be converted (if necessary) and
 set in the destination bean.'

Wow. The documentation was apparently gutted after the 1.6.1 version:
1.7.0:http://jakarta.apache.org/commons/beanutils/commons-beanutils-1.7.0/docs/api
1.7.1:http://jakarta.apache.org/commons/beanutils/apidocs/

Neither of these sets of javadoc mention this capability.

Again, the problem was creating the target bean, not copying the
properties. Thanks, though.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFR1AA9CaO5/Lv0PARAsncAJ0cZlz8HGwA5GmYa3E3giuErcWT9ACfUpkR
a3CzmfsEbtKBxhyh/afQ4eI=
=7gxh
-END PGP SIGNATURE-

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



Rolling back form changes

2006-10-30 Thread Christopher Schultz
All,

I have a multi-page flow and I am using a DynaValidatorForm to store all
my form info.

At the end of the flow, there's a confirmation page where the user can
check out all of the information entered during the previous several
pages. They have the opportunity to go back to each page (via a link)
and change the data on those pages individually.

If a user goes back, changes some text in a text box (for example), and
then chooses the CANCEL button, the form is submitted, and the
DynaValidatorForm is filled with the changed data.

This is non-ideal, as I want the updated data to be discarded (since the
user hit CANCEL).

The obvious solution is to save a copy of the form bean before such a
page is displayed (say, in the session), and then, if the user hits
CANCEL, to resurrect that form bean.

The question is: how should one bring back that bean?

Struts provides the form bean object to each Action, so it's easy to get
a reference to it, clone it, and shove it in the session as a backup
copy. But, there's no API-happy way to put it back if I want to, is there?

It looks like the only option I have is to push that form bean into the
session with a known name. Since I know the name of the form, I can
just use that, but it means having to hard-code the name of the form
into my action.

Is there a better way? Is there a way to get the name of the currently
active form?

Thanks,
-chris



signature.asc
Description: OpenPGP digital signature


Re: Rolling back form changes

2006-10-30 Thread Christopher Schultz
Dave,

 From: Christopher Schultz [mailto:[EMAIL PROTECTED]
 Is there a way to get the name of the currently active form?
 
 Is that what ActionMapping's getName() does?

Duh! Thanks. I'm a moron.

Now I just need to figure out how to copy one of these things. It looks
like getMap might be my best option. Any reason why this might be a
bad idea? 'cause this class is not clonable, and it doesn't have a copy
constructor, so this looks like the only possibility.

-chris



signature.asc
Description: OpenPGP digital signature


Re: Rolling back form changes

2006-10-30 Thread Christopher Schultz
All,

 Now I just need to figure out how to copy one of these things. It
 looks like getMap might be my best option. Any reason why this
 might be a bad idea? 'cause this class is not clonable, and it
 doesn't have a copy constructor, so this looks like the only
 possibility.

To answer my own question, cloning a DynaActionForm (of which
DynaValidatorForm is a subclass), the following unholy incantation is
necessary:

ModuleConfig mc = mapping.getModuleConfig();
FormBeanConfig fbc = mc.findFormBeanConfig(mapping.getName());

DynaActionForm clonedForm
= (DynaActionForm)fbc.createActionForm(super.getServlet());

for(Iterator i=form.getMap().entrySet().iterator(); i.hasNext(); )
{
Map.Entry entry = (Map.Entry)i.next();

clonedForm.set((String)entry.getKey(), entry.getValue());
}

I tried simply instantiating a new DynaValidatorForm object and then
running the loop shown above. Apparently, that doesn't initialize the
form bean properly, and you get a NPE when calling set(). Calling
initialize or reset on the bean also doesn't work: initialize()
actually bombs with the same NPE as set() does, and reset() just doesn't
do the trick.

I'd love to hear any other ideas, but for now, this technique works and
I couldn't make it work another way.

-chris



signature.asc
Description: OpenPGP digital signature


Re: Rolling back form changes

2006-10-30 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Paul,

 To clone a DynaValidatorForm perhaps something like this will work:
 
 LazyDynaBean obj = new LazyDynaBean();// create a lazy dyna bean
 BeanUtils.copyProperties(obj, dyForm);// save your form properties
 session.setAttribute(saved.obj, obj);

Really? BeanUtils.copyProperties seems to indicate that it copies bean
properties which are usually defined as strings for which the methods
getFoo and setFoo exist. For a DynaValidatorBean, no such methods exist.

It also turns out that creating the target object is the problem, not
copying the properties. My simple loop over the bean's property map is
sufficient.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFRqPK9CaO5/Lv0PARAst0AJ0VCwfqSjqHOiVmzQbmWVfDRCfPFwCfQ8ON
BKt7dzQABmipctTcHfQ5Aoo=
=dg/b
-END PGP SIGNATURE-

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



Re: why hardcode the path of web.xml?

2006-10-20 Thread Christopher Cheng
The reason is that I can use different configuraiton files for different 
instances.
Anyway, I have modified ActionServlet myself and it is working fine.


-- 
Christopher Cheng
Jerome Gagner [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 If you are using the resin-specific configuration options, you should
 just separate that out into a resin-conf.xml.


 What larry said, why do you want to do that?

 On 10/18/06, Christopher Cheng [EMAIL PROTECTED] wrote:
 I am using version 1.3.5 and found out that that path of web.xml is hard
 coded at line 1723

 InputStream input =
 getServletContext().getResourceAsStream(/WEB-INF/web.xml);

 In resin, I use config-file to change the path of web.xml for example
 config-filemyapp-web.xml/config-file. As I start the application, the
 servlet crashes of course.
 In the mean time, I have added the following to ActionServlet to get 
 around:

 String configWebXml = 
 getServletConfig().getInitParameter(configWebXml);

 if (input == null) {
 input = 
 getServletContext().getResourceAsStream(configWebXml);
 }

 Could anybody fix this or everybody is already using Struts2?





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



why hardcode the path of web.xml?

2006-10-18 Thread Christopher Cheng
I am using version 1.3.5 and found out that that path of web.xml is hard 
coded at line 1723

InputStream input = 
getServletContext().getResourceAsStream(/WEB-INF/web.xml);

In resin, I use config-file to change the path of web.xml for example 
config-filemyapp-web.xml/config-file. As I start the application, the 
servlet crashes of course.
In the mean time, I have added the following to ActionServlet to get around:

String configWebXml = getServletConfig().getInitParameter(configWebXml);

if (input == null) {
input = getServletContext().getResourceAsStream(configWebXml);
}

Could anybody fix this or everybody is already using Struts2?





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



Re: compile getDataSource error in Action

2006-09-28 Thread Christopher Goldman
On Fri, 2006-09-29 at 00:03 +0800, red phoenix wrote:
 I use JDK1.6 and Struts1.3.5,I use Javac to compile a  Action file,like
 follows:
 javac xxxAction.java
 but when I compile it,it raise follows error:
 
 xxxAction.java:31: Can't find symbol
 symbol: method getDataSource(javax.servlet.http.HttpServletRequest,
 java.lang.String)
 location: class xxxAction
 DataSource dataSource=getDataSource(request,yy);
   ^
 1 error
 
 Why raise above error? How to correct it?
 Thanks

It sounds like your Action subclass does not have a
getDataSource(HttpServletRequest,String) method.

Perhaps the method belongs to some other object?

Chris

-- 
Christopher D. Goldman
[EMAIL PROTECTED]
415.962.4884


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



Re: bean:write formatKey tag

2006-09-22 Thread Christopher Goldman
On Fri, 2006-09-22 at 17:30 +0300, Ilja S. wrote:
 Hello
 Could you please explain why i get JspException: Wrong format string: 
 '###,###.00'  when I use bean:write formatKey=global.format when 
 other then EN locale is in user's session?
 
 At the same time if use format tag bean:write format=###,###.00 
 then no matter what locale is in session it is working fine AND do 
 format according to locale
 
 Thanks in advance

Ilja,

Tere!

This is the expected behavior.  I'm not sure what version of Struts
you're using, but you can check out the source for the (1.x)
bean:write tag here:

http://svn.apache.org/viewvc/struts/struts1/trunk/taglib/src/main/java/org/apache/struts/taglib/bean/WriteTag.java?view=markup

The relevant part is from lines 330 to 348 (indenting modified):

if (formatString != null) {
  try {
format = NumberFormat.getNumberInstance(locale);

if (formatStrFromResources) {
  ((DecimalFormat) format).applyLocalizedPattern(
formatString);
} else {
  ((DecimalFormat) format).applyPattern(formatString);
}
  } catch (IllegalArgumentException e) {
JspException ex =
  new JspException(messages.getMessage(
  write.format, formatString));

TagUtils.getInstance().saveException(pageContext, ex);
throw ex;
  }
}

There seems to be some discussion of this in the Struts JIRA system:

http://issues.apache.org/struts/browse/STR-1865?page=all

See Ted Husted's comments.  Of course, he's talking about the date (not
number) formatting, but it only serves to highlight the distinction
between the handling of the two types.  Note that if you look at the
code immediately following what is quoted here, you'll see that the
SimpleDateFormat constructor is *always* passed the locale.

I found all this stuff by Googling various combinations of WriteTag,
.applyLocalizedPattern, and IllegalArgumentException

Hea õnn!

Chris

-- 
Christopher D. Goldman
[EMAIL PROTECTED]
415.962.4884


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



Re: Validation framework +dropdowns

2006-09-14 Thread Christopher Goldman
On Thu, 2006-09-14 at 16:13 +0530, Vaneet Sharma wrote:
 Hii Frns
 
 I  have  two drop downs in my jsp page,
 
 I want to validate second drop down only when  the value of selected item 
 of first drop down is 2.
 Can anybody tell me how to do this using validation framework.

Check this out:

http://struts.apache.org/1.2.9/userGuide/dev_validator.html#validwhen

It will let you do exactly what you're asking about.

Chris

-- 
Christopher D. Goldman
[EMAIL PROTECTED]



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



Re: Question about Lookup dispatch action

2006-08-17 Thread Christopher Goldman
On Thu, 2006-08-17 at 14:26 -0700, mosho wrote:
 Hi All,
 
 I have multiple buttons on my form and I am using LookUpDistpatchAction to
 submit the form depending on which button is clicked.
 
 I have another requirement now, I have multiple images that are going to be
 links. I need to submit the form using onclick.
 
 So in my javascript, I will have to submit the form. How can I change/ set
 the  value for my parameter?
 
 It is giving me error:
 Request[/selectLocation] does not contain handler parameter named navigation
 
 Thanks for your help,

In your onclick handler for the images, change the (presumably) hidden
form input field value:

  document.forms[form-name].elements[navigation].value = new-value

Then, submit the form.

This is in Firefox.  Looks like it works for IE as well.

Not really a Struts question -- just straight Javascript...

Chris

-- 
Christopher D. Goldman
[EMAIL PROTECTED]



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



[OT] Re: Unlock Your Mind's Hidden Power, Today...

2006-08-08 Thread Christopher Goldman
On Mon, 2006-08-07 at 01:12 -0400, Monkeyden wrote:
 or is like transferring Ted himself, as data?

Only if he implements the Serializable or Externalizable interfaces.

Chris

-- 
Christopher D. Goldman
[EMAIL PROTECTED]



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



Re: Struts based opensource e-Learning/Distance Learning framework

2006-08-03 Thread Christopher Goldman
On Thu, 2006-08-03 at 10:25 +0530, Raghu Kanchustambham wrote:
 Hi,
 I am interested in building a e-Learning/Distance learning framework. Was
 wondering if there is any framework that exists that I can use as a starting
 point.
 
 First preference would be for a struts based application since I need to
 integrate it with my existing struts code. But anything in Java/J2EE would
 also suit my bill. And yes, if not that, I am willing to experiment with
 some thing like a java-php bridge if someone vouches for an excellent
 e-learning framework written in (say) php.
 
 
 Any of the struts users here have any pointers to any open source projects
 for education?
 
 Thanks.
 Regards,
 Raghu

Raghu,

There was an article on Slashdot yesterday [1] about an online learning
provider, Blackboard, patenting their Learning Management System, and
there were some links there to other examples of that sort of software:

Moodle [PHP]
http://moodle.org/

Dokeos [PHP]
http://www.dokeos.com/

The LearningOnline Network with CAPA [Tcl]
http://www.lon-capa.org/

.LRN (Learn, Research, Network) [OpenACS/AOLserver/Tcl]
http://www.dotlrn.org/

Sakai [Java, though seemingly not Struts]
http://sakaiproject.org/

I don't know how many (if any) are focussed on distance learning, as
opposed to general course and student management, but maybe it can be a
starting point.

Chris


[1] http://yro.slashdot.org/article.pl?sid=06/08/02/1217219

-- 
Christopher D. Goldman
[EMAIL PROTECTED]



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



Re: form in application context`

2006-07-28 Thread Christopher Goldman
On Fri, 2006-07-28 at 16:36 +0530, Kavita Mehta wrote:
 hmm ..thanks n how gud is an idea to access this value from outside 
 action class ..i.e. i call a method in action class from outside struts 
 framework which changes its value on recieving an alarm/trap.
 
 Patil, Sheetal wrote:
  DTO means normal object which contains the data
  In your case you want to store In Progress..
  So just put In Progress into an object and save it to application
  scope
  Even if you want to change just change t oDone and agin store to
  application 

It's not only a good idea.  That is exactly what the DTO (Data Transfer
Object [1]) is for.  It's not a Struts-specific object at all.

[1] http://en.wikipedia.org/wiki/Data_Transfer_Object

Chris

-- 
Christopher D. Goldman
[EMAIL PROTECTED]



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



Re: mailreader question

2006-07-28 Thread Christopher Goldman
On Fri, 2006-07-28 at 19:58 +0200, Henning Schild wrote:
 Hello,
 
 i am currently working on my first struts application. That is why i am
 looking at the example and there are a few things i do not understand.
 
 The tour says something about an action-mapping 
 
  action path=/EditRegistration
  ...
 
 indeed there is nothing like this in the struts-config.xml
 
 How does struts know which Action to execute? It could know that from
 the name because there is an EditRegsitrationAction.class but how does
 it know which jsp to use? There is a Regsitration.jsp which handles
 EditRegsitration.do but i don't see a action-mapping for that. I also
 don't see any form-bean definitions for the whole Registration stuff.
 Are there naming conventions which handle all that? And if they exist
 where do i find documentation about that.
 I read the UserGuide but that does not tell about naming cenvetions for
 form-beans or action-mappings.
 
 I hope you can answer my questions.
 
 Henning

Henning,

From the Tour:

If you check the struts-config.xml, you'll see that the
editRegistration action is mapped to the (surprise again!), the
EditRegistrationAction; it uses a registrationForm bean, and
registration.jsp for input.

!-- Registration form bean --
form-bean name=registrationForm
type=org.apache.struts.example.RegistrationForm/

!-- Edit user registration --
action path=/editRegistration
type=org.apache.struts.example.EditRegistrationAction
name=registrationForm
scope=request
validate=false
input=/registration.jsp
forward name=success path=/registration.jsp/
/action

The fact that the path, type, and forward values are similar is simply a
convention that makes it easier to understand without memorizing the
struts-config file.

The /editRegistration.do URL is mapped to the EditRegistrationAction
class in the action tag shown.  It's tied to the form-bean above
through the name attribute of the action tag.

The Action forwards to the JSP view via a call at the end of its execute
method:

  return mapping.findForward( success );

And as you see there is a local forward for this action keyed on
success to /registration.jsp.  If it was absent, there would need to
be a global forward for it.

I hope this helps.

I'm a Struts newbie myself, hoping to improve my understanding through
helping others (and being corrected unmercifully).

Chris

-- 
Christopher D. Goldman
[EMAIL PROTECTED]



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



Re: mailreader question

2006-07-28 Thread Christopher Goldman
On Fri, 2006-07-28 at 20:57 +0200, Henning Schild wrote:
 This is not included in my binary version struts-1.2.9. And the md5sum
 for the zip file ist correct.

[snipped]

 If all the things you described where in the .war files
 struts-config.xml i would not have asked, because i read how it works
 in theory.
  
 I now had a look at 1.2.9-src und 1.2.8-bin, the struts-config.xml does
 not have these entries.
 I mean webapps/struts-mailreader.war/WEB-INF/struts-config.xml.
 So i did what the tour says. I had a look at the file and did not only
 look at what the tour says the file should contain.

Ah, well, I didn't know what tour you were looking at.

So I googled for struts tour editregistration and found this as the
first hit:

http://struts.application-servers.com/struts-layout/tour.htm

That's where I got the bits of the struts-config.xml file I quoted.

Good luck!

Chris

-- 
Christopher D. Goldman
[EMAIL PROTECTED]



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



Tiles Not Processing JSP Content

2006-02-27 Thread Christopher Prince

using tiles standalone (latest from the sandbox)  

the insert tag looks like

tiles:insert definition=default-layout flush=true 
   tiles:put name=title value=sign-up for a new account/
   tiles:put name=content value=/signupContent.jsp/
/tiles:insert

Problem is that the jsp pages in the tiles:put are placed into the
output as-is.  The JSP/JSF markup is not processed.  

I tried adding the type=page to the tag but that didn't help.

How do i ensure that the JSP is processed?

Thanks
Chris




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



Maintaining session state in remote servlet form post

2006-01-12 Thread Christopher Becker
We have a struts app (v1.2.7) that uses Tiles for UI presentation,
running in WebLogic 8.1.  We are trying to implement a form whose action
is to a remote servlet. The remote site actually generated the form
details for us, and one of the fields provided is a hidden field
entitled returnURL, which allows me to provide a URL to a page within my
web app. 
 
When the form is submitted, the remote servlet  returns to the URL
specified in the returnURL parameter, but the user session is lost and
the relative links for images in the tiles layout disappear.
 
We have tried appending the session id to the URL sent in the hidden
returnURL of the form, but this did not work. We then changed from URL
rewriting to cookies for handling session state, but this also did not
work.
 
Does anyone have any ideas on how to maintain session state when
posting to a remote servlet?
 
Regards,
 
--Chris
 


Re: external URL in struts app

2006-01-05 Thread Christopher Becker
By proxy action, do you refer to the external url that I have already
mentioned?
If so, that is what I am trying to circumvent. The external servlet
returns a response which I do not wish to display to the user of our
application and the format of the response (over which I have no
control) does not comply with our design, hence the desire to 'wrap' the
submission and supply our own locally formatted response to form
submission.
 
Regards, 
 
--Chris

 [EMAIL PROTECTED] 1/4/2006 4:56:50 PM 

The easiest way imho is to submit to your proxy action, which submits
to external server, receives response and returns this response to
browser.

Michael.

On 1/4/06, Christopher Becker [EMAIL PROTECTED] wrote:
 Greetings all;

 I have a Struts app (v1.27) and wish to add a user form whose ACTION
is
 a URL that is external to the application ( a remote servlet).

 I want to provide a message sent confirmation page to the user,
but
 dont know how to do this with an external form submission. Is there
a
 way to wrap the submit process within a Struts action so that a
 'success' Action Forward could be utilized and a confirmation page
 (internal to the struts app) be displayed?

 It is the external nature of this form posting that has me stumped.
Any
 thoughts on an approach would be appreciated.

 Regards,

 --Chris



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




external URL in struts app

2006-01-04 Thread Christopher Becker
Greetings all;
 
I have a Struts app (v1.27) and wish to add a user form whose ACTION is
a URL that is external to the application ( a remote servlet).
 
I want to provide a message sent confirmation page to the user, but
dont know how to do this with an external form submission. Is there a
way to wrap the submit process within a Struts action so that a
'success' Action Forward could be utilized and a confirmation page
(internal to the struts app) be displayed?
 
It is the external nature of this form posting that has me stumped. Any
thoughts on an approach would be appreciated. 
 
Regards,
 
--Chris


validation plug-in with multiple config files

2005-12-21 Thread Christopher Becker
I am developing a Struts (v1.2.7) app that has multiple struts-config
files, but not utilizing modules, so web.xml has one init param with
config files separated by commas, eg.
 
init-param
  param-nameconfig/param-name
 
param-value/WEB-INF/struts-config.xml,/WEB-INF/struts-bus1-config.xml,
WEB-INF/struts-bus2-config.xml/param-value
/init-param
 
My question involves the validator plug-in entry in the config files.
Does the plugin entry need to be added to all config files, or just the
default one? 
 
Regards,
 
--Chris 
 


Re: accessing request attributes

2005-12-07 Thread Christopher Becker
Atta;
 
Thanks for the response.  You are correct in your assumption about the
scriplet approach - it is exactly what I was attempting to avoid by
using tags.
 
I tried using the bean:write.. tag as you suggested, but was getting
the JSP error of not finding a bean value in any scope.
What did work for me was using the c:out...  tag with EL syntax, as
your example showed.
 
You got me back on track - thanks for your help!
 
Regards,
 
--Chris 
 
 

 [EMAIL PROTECTED] 12/6/2005 11:19:42 PM 

Chris,

I'm sure you'd know scriplet way of doing it, which I'm not going to
recommend: %=request.getAttribute(toDate) %.

Struts' bean:write should do it: bean:write scope=request
name=toDate/

Better still if you're using Servlet 2.4 compliant app server/servlet
container you could use JSTL expressions: ${toDate} and it will search
the
attribute in app, session, request and page scope for you. Same thing
as
c:out value=${toDate}/. You'd, of course, need to include TLDs for
JSTL
in the latter case.

Hope this helps.

ATTA



On 12/6/05, Christopher Becker [EMAIL PROTECTED] wrote:

 I am setting request attributes in an Action class such as in the
 following example:

 request.setAttribute(toDate, toDate);
 request.setAttribute(acctNum, acctNum);

 Both variables toDate and acctNum are Strings. I then process the
 action by returning a mapping.findForward to a JSP page.

 I wish to be able to access these attributes as scripting variables
on
 my JSP page, and display their values if they happen to have them
(e.g
 not empty String or null, which could be possible).

 My question - how do you access request attributes with Struts tags
and
 make them available as scripting variables?

 I have tried using bean:define, but have been unsuccessful.

 Any guidance or help would be appreciated... thanks!

 --Chris





accessing request attributes

2005-12-06 Thread Christopher Becker
I am setting request attributes in an Action class such as in the
following example:
 
request.setAttribute(toDate, toDate);
request.setAttribute(acctNum, acctNum);

Both variables toDate and acctNum are Strings. I then process the
action by returning a mapping.findForward to a JSP page.
 
I wish to be able to access these attributes as scripting variables on
my JSP page, and display their values if they happen to have them (e.g
not empty String or null, which could be possible).
 
My question - how do you access request attributes with Struts tags and
make them available as scripting variables?
 
I have tried using bean:define, but have been unsuccessful.
 
Any guidance or help would be appreciated... thanks!
 
--Chris


Re: [Shale] Using standalone tiles?

2005-11-29 Thread Christopher Becker
I am using Tiles in a Struts (v.1.2.7) app, and also experienced an
error when the Apache site was temporarily down. 
So to prevent this from happening in the future, what is the suggested
solution? 
 
Removing the DOCTYPE element from the tiles-def.xml file does not seem
appropriate - or is it?
 
Any suggestions would be appreciated... thanks!
 
Regards,
 
Chris

 [EMAIL PROTECTED] 11/28/2005 3:14:31 PM 


On Nov 28, 2005, at 1:57 PM, Craig McClanahan wrote:

 On 11/28/05, Greg Reddin [EMAIL PROTECTED] wrote:



  protected String registrations[] = {
  -//Apache Software Foundation//DTD Tiles Configuration  
 1.1//
 EN,
  /org/apache/tiles/resources/tiles-config_1_1.dtd,
  -//Apache Software Foundation//DTD Tiles Configuration  
 1.2//
 EN,
  /org/apache/tiles/resources/tiles-config_1_2.dtd,
  };



 Hmm ... Shale uses exactly this style for its own config resources,
 including the leading slash on the URLs, and it seems to work fine  
 when I
 disconnect from the Internet.  I suspect there might be version  
 specific
 issues with URL resolution between JVMs in this area.

I think the issue is this:  Standalone Tiles uses the ClassLoader  
directly, while Struts-Tiles goes through the Class (which delegates  
to the ClassLoader according to the Javadoc).  Compare Standalone
Tiles:

 URL url = this.getClass().getClassLoader().getResource(

to Struts-Tiles:

  URL url = this.getClass().getResource(

The effect is that if you use the ClassLoader you cannot have a  
leading / on the name.  Now I'm not sure which is more correct...

Greg



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




Upgrade problems from 1.2.4 to 1.2.7

2005-11-05 Thread Tim Christopher
Hi,

I've read the upgrade notes on the Wiki and have followed all the
instructions, including updating the validation.xml file.

When run with the 1.2.4 version of Struts it runs run but now I have
upgraded I always get a message saying the servlet is unavailable when
trying to view a page.  The error occurs in ActionServlet.java:364 and
dumps to following message to the log file:

java.lang.NoSuchMethodError:
org.apache.commons.validator.ValidatorResources.init([Ljava/io/InputStream;)V
at 
org.apache.struts.validator.ValidatorPlugIn.initResources(ValidatorPlugIn.java:237)
at org.apache.struts.validator.ValidatorPlugIn.init(ValidatorPlugIn.java:162)


This error always occurs after it tries to load the validation.xml
file, and yet when I remove references to the Struts Validator from
the Struts-Config file it all works fine:

  plug-in className=org.apache.struts.validator.ValidatorPlugIn
set-property property=pathnames
value=/WEB-INF/resources/xml/validator-rules.xml,/WEB-INF/resources/xml/validation.xml
/
  /plug-in


Anyone got any ideas?!

Cheers :-)

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



Associating validation errors with input fields

2005-10-18 Thread Christopher Becker



I have a form in a Struts app (v1.2.7) that I amattempting to usein conjunction with the validator framework. I wish to associate the error messages directly with the input field that caused them (e.g.additional row in a table,etc.) I am using the html: errors/ tag and can see that the errors are being generated correctly, but they are in a list and are not directly associated to the input fields. Is there a way to do this? I see an implied reference to the errors in the errorKey attribute of the html:text/ tag, but not sure how this works. Any suggestions or guidance would be appreciated

Regards,



Chris BeckerSenior Programmer/AnalystEnterprise IT(516) 803-3921[EMAIL PROTECTED]BEGIN:VCARD
VERSION:2.1
X-GWTYPE:USER
FN:Becker, Christopher
TEL;WORK:(516)803-3921
ORG:;Corporate Information Systems
TEL;PREF;FAX:(516)803-6115
EMAIL;WORK;PREF:[EMAIL PROTECTED]
N:Becker;Christopher
TITLE:Sr., Programmer/Analyst
ADR;DOM;WORK;PARCEL;POSTAL:New York
LABEL;DOM;WORK;PARCEL;POSTAL;ENCODING=QUOTED-PRINTABLE:Becker, Christopher=0A=
New York
END:VCARD


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

Re: Associating validation errors with input fields

2005-10-18 Thread Christopher Becker
Ramesh;
 
That was it... I  had overlooked the property attribute of the errors
tag...
thanks for your help!
 
Regards,
 
Chris

 [EMAIL PROTECTED] 10/18/2005 9:24:23 AM 

Hi there,

Say u hv a html:text/ with the property name
custName.  U can use html:errors
property=custName/ right below the html:text/. 
So, when an action error occurs, it will be displayed
right below the html:text/ corresponding to the
property.

Regards,
Ramesh M.

--- Christopher Becker [EMAIL PROTECTED]
wrote:

  
 I have a form in a Struts app (v1.2.7) that I am
 attempting to use in
 conjunction with the validator framework. I wish to
 associate the error
 messages directly with the input field that caused
 them (e.g. additional
 row in a table, etc.)  I am using the html:
 errors/ tag and can see
 that the errors are being generated correctly, but
 they are in a list
 and are not directly associated to the input fields.
 Is there a way to
 do this? I see an implied reference to the errors in
 the errorKey
 attribute of the html:text/ tag, but not sure how
 this works. Any
 suggestions or guidance would be appreciated
  
 Regards,
  
  
  
 Chris Becker
 Senior Programmer/Analyst
 Enterprise IT
 (516) 803-3921
 [EMAIL PROTECTED]
  BEGIN:VCARD
 VERSION:2.1
 X-GWTYPE:USER
 FN:Becker, Christopher
 TEL;WORK:(516)803-3921
 ORG:;Corporate Information Systems
 TEL;PREF;FAX:(516)803-6115
 EMAIL;WORK;PREF:[EMAIL PROTECTED]
 N:Becker;Christopher
 TITLE:Sr., Programmer/Analyst
 ADR;DOM;WORK;PARCEL;POSTAL:New York

LABEL;DOM;WORK;PARCEL;POSTAL;ENCODING=QUOTED-PRINTABLE:Becker,
 Christopher=0A=
 New York
 END:VCARD
 
 
 
-
 To unsubscribe, e-mail:
 [EMAIL PROTECTED]
 For additional commands, e-mail:
[EMAIL PROTECTED]






__ 
Yahoo! Music Unlimited 
Access over 1 million songs. Try it free.
http://music.yahoo.com/unlimited/

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




RE: [OT] question about XSL and XPATH

2005-09-27 Thread Christopher Chan
Your XSL should be something like:

xsl:template match=/data/id/value
   xsl:value-of select=text()/
/xsl:template

Basically, match the node you are interested in and get the text value for 
that node.

-- 
Christopher Chan
SpikeSource, Inc.
[EMAIL PROTECTED]
http://developer.spikesource.com

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



RE: Best way to store config variables

2005-08-17 Thread Marsh-Bourdon, Christopher
Have you considered Spring and it's IOC framework?  Works wonderfully with
Struts (even has a lovely plug-in to get the whole thing working together).


The configuration is only one aspect of the whole Spring framework.

Christopher Marsh-Bourdon
www.marsh-bourdon.com


-Original Message-
From: Dave Newton [mailto:[EMAIL PROTECTED] 
Sent: 17 August 2005 16:20
To: Struts Users Mailing List
Subject: Re: Best way to store config variables

Konrad Billewicz wrote:

At the moment I wish to do it using web.xml or, maybe better, context 
file in conf/Catalina/. Currently there are serveral things to change 
ie. data source parameters.

What do you think about it?
  

I think storing it under the Tomcat config directories would be a really bad
idea, since they're application (not server) level configs.

Personally, I keep things like this in either web.xml, a struts config file,
or an application-specific configuration mechanism (generally XML or YAML).

Dave



-
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-mail: [EMAIL PROTECTED]



<    1   2   3   4   5   6   >