Re: problem.

2007-02-01 Thread Christopher Goldman
On Thu, 2007-02-01 at 07:21 -0800, styl9090 wrote:
> Hi All,
> 
> In my application, I need to generate check boxes for every row of data.
> I set the data as a list of objects in my controller and I access the same
> in JSP using 
> For each row of this data, I need to add a checkbox with 'value' attribute
> as a field in the data row object... here it is user_id.(data set is in
> request scope)
> How can I achieve this? Or do I need to use traditional java code in JSP :(
> 
> I have like this:
> 
> value= />
> and I have other data:
>
>...
> 

Shekar,

If you use the html-el taglib, your html:checkbox value can be
"${userObj.propertyName}" where "propertyName" is whatever property you
need from your user object.

With the non-EL HTML taglib, you would need to set the property value in
the page scope with something like this before the html:checkbox tag:

  

Then the value attribute of the checkbox tag should just be
"checkboxVal".

I'm not sure how the properties with underscores translate into EL
expressions.

And it may take some tweaking; I'm writing this out off the top of my
head.  But I felt that even that was better than allowing you to go
forward with Java scriptlets.

Chris


-- 
Christopher D. Goldman
[EMAIL PROTECTED]



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



Re: Section 508 and html:text tag issue

2007-01-25 Thread Christopher Goldman
On Thu, 2007-01-25 at 15:25 -0700, Weisfield, Russell (HAC) wrote:
> Hello,
> 
> To abide by Section 508 compliance I need to associate my form inputs
> with a  tag.  I therefore tried to add in an "id" attribute to my
> html:text tag (which is using the TextTag object).  While the page
> rendered successfully ( I did modify my .tld file to correct a rendering
> error), the text inputs did not have the id attribute with them and
> therefore, some of the assistive technology we have for testing
> (particularly Narrator which we do have to accommodate) failed to
> identify the name of the input box.  Is there a solution or work around
> for this and if so where might I find it?  I have scoured multiple sites
> to no avail.  Thanks.

Russell,

Try using the "styleId" attribute of the  element.  It will
render an "id" attribute in the resulting  element.

http://struts.apache.org/1.x/struts-taglib/tlddoc/html/text.html

Chris

-- 
Christopher D. Goldman
[EMAIL PROTECTED]



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



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



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



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.
> > >
> > >   > >   > >
> > > 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  > >
> > > 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=en&q=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: 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.
> 
>  type="text/javascript">
> 
> 
> 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: 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: 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  when 
> other then "EN" locale is in user's session?
> 
> At the same time if use "format" tag  
> 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)
 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: 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]



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









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  tag shown.  It's tied to the form-bean above
through the name attribute of the  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: 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 o"Done" 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]