Java Mailing List Archive

http://www.junlu.com/

Google
Google
Mailing List
Home
Forum Home
JBoss - Java Application Server
Tomcat - JSP/Servlet container
Struts - A MVC web framework
iText - An open source PDF Java Library
JDOM - JDOM XML Parser
JSP - A mailing list about Java Server Pages specification and reference
J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition
J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog
Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology
Struts & Hibernate
Subjects
JSP editor plugin for eclipse ?
org apache jasper JasperException: Unable to compile class for JSP
Tomcat: Connection reset by peer: socket write error
Cannot retrieve definition for form bean null
Struts Tiles Tutorial (free Struts training)
Where do I download Tomcat 4 0 6?
Data Access Object (DAO) pattern, example DAO 's
Where to download Tomcat v 4 1 24 from?
Tomcat 5 0 16 Requested resource not available
Servlet : Session invalidate
Oracle Connection Pooling in 3 2 2
Servlet action is currently unavailable
Tomcat/Struts Unicode Encoding/Decoding problems
Running a Simple JMS Example
Tomcat and webapplication specific java library path
Mapping in workers2 properties
org apache jasper JasperException
problem with html:text bean throwing exception
Cannot find message resources under key org apache struts action
   MESSAGE
Cannot find message resources under key org apache struts action MESSAGE
invalid direct reference problem with solution
Tool for jsp debug Try Sysdeo Eclipse Plugin
Tomcat 5 Cannot load JDBC driver class 'null ' SQL state: null
weblogic ejbc
java properties file
Jboss 3 2 3 Coyote Can 't re
Tomcat 5, Apache2 and mod jk2 integration problem
JBoss example problem new to J2EE
Value attribute of <html:checkbox
url string for connecting jboss to oracle
javax servlet ServletException: BeanUtils populate
5 0 18: Windows XP Pro vs Windows 2000
HTTP Status 404 The requested resource is not available
 
-none-

-none-

2007-08-14       - By Oleg Konovalov

 Back
That worked for me:
<% String str="form.action='action.do?command=notify&rowId="; %>
onclick="<%= str%><c:out value='${list.rowId}'/>'" />

And in Action:
String rowId = request.getParameter("rowId");


Thank you all,
Oleg.


On 8/13/07, Frank W. Zammetti <fzlists@(protected)> wrote:
>
> Oleg Konovalov wrote:
> >> make each button on the form a submit button
> > I can't do it, because button has to have image, so I use <input
> > type=image...>
> > Will that work ?
>
> I believe so... best way to be sure would be to try it :) ... but I
> don't see why it wouldn't.
>
> > Also, are you sure this    this.form.rowId.value='${list.rowId}';
> > will work together with my    form.action='action.do?command=notify'
> > I think, Javascript will get screwed up - will complain.
> > And I will have to make all inside a scriplet, something like:
> > onClick="<% form.rowId.value=<*c:out* *value=*'${list.rowId}/>;
> > form.action='action.do?command=notify'  %>"
> > Is that better ?
>
> No, that would be wrong... go ahead and give it a try, you'll get a
> compile error on the JSP because the expression isn't valid.  You may
> however be right to a degree... you may need to use <c:out> in place of
> ${list.rowId} (I think ${list.rowId} is valid JSP 2.0 EL, but that
> assumes JSP 2.0)... I think that's a valid JSP expression... again, give
> it a try, this is a syntactical issue that a minute or two of playing
> will resolve, it's the conceptual part you need to understand first.
>
> Frank
>
> --
> Frank W. Zammetti
> Founder and Chief Software Architect
> Omnytex Technologies
> http://www.omnytex.com
> AIM/Yahoo: fzammetti
> MSN: fzammetti@(protected)
> Author of "Practical Ajax Projects With Java Technology"
> (2006, Apress, ISBN 1-59059-695-1)
> and "JavaScript, DOM Scripting and Ajax Projects"
> (2007, Apress, ISBN 1-59059-816-4)
> Java Web Parts - http://javawebparts.sourceforge.net
> Supplying the wheel, so you don't have to reinvent it!
>
> >
> >
> > On 8/13/07, Frank W. Zammetti <fzlists@(protected)> wrote:
> >> Oleg Konovalov wrote:
> >>> No, I am not using any AJAX.
> >>>
> >>> On Submit it supposed to process that row, go to DB and refresh the
> >> whole
> >>> page,
> >>> so to come back on the same page.
> >>>
> >>> Also, my form is declared as <html:form>, so onClick I use
> >>> "form.action='action.do?command=notify'", I can't get rid of it,
> >>> but it doesn't want to coexist with any Javascript.
> >>>
> >>> I would not like to have multiple forms on one JSP page.
> >>>
> >>> So which of your suggestions would you recommend in my case ?
> >>> And how do I get a value of rowId in Action class (notify action),
> >>> via request.getSession().getAttribute("rowId") ?
> >> You wouldn't get it from SESSION, you'd get it from REQUEST... Unless
> >> your intention is to have a session-scoped ActionForm, but then you
> >> wouldn't get at the value as you've shown anyway (in fact, even if it's
> >> a request-scoped from, that's the wrong way to get the value, since
> your
> >> bypassing Struts to do it).
> >>
> >> Since you aren't using AJAX, and you want a single form, all you need
> to
> >> do is set things up in a 100% typical Struts fashion... have the HTML
> >> form submit to the Action you want it to, and connect an ActionForm,
> >> probably request-scoped, to that Action.  Make sure your ActionForm
> >> includes the properly named getter/setter/field for it.  Then, on your
> >> HTML form, add a hidden field with the name rowId, and make each button
> >> on the form a submit button (you can have more than one), and add an
> >> onClick event to it that does this:
> >>
> >> this.form.rowId.value='${list.rowId}';
> >>
> >> That should do it.  Then, in your Action you just do:
> >>
> >> String rowId = form.getRowId();
> >>
> >> ...assuming form is the name of the ActionForm parameter.  That should
> >> be all you need to do.
> >>
> >> Frank
> >>
> >> --
> >> Frank W. Zammetti
> >> Founder and Chief Software Architect
> >> Omnytex Technologies
> >> http://www.omnytex.com
> >> AIM/Yahoo: fzammetti
> >> MSN: fzammetti@(protected)
> >> Author of "Practical Ajax Projects With Java Technology"
> >> (2006, Apress, ISBN 1-59059-695-1)
> >> and "JavaScript, DOM Scripting and Ajax Projects"
> >> (2007, Apress, ISBN 1-59059-816-4)
> >> Java Web Parts - http://javawebparts.sourceforge.net
> >> Supplying the wheel, so you don't have to reinvent it!
> >>
> >>> Thank you,
> >>> Oleg.
> >>>
> >>>
> >>>
> >>> On 8/12/07, Frank W. Zammetti <fzlists@(protected)> wrote:
> >>>> Oleg Konovalov wrote:
> >>>>> I have a bunch of rows [ArrayList of ValueObject Classes], and a
> >> button
> >>>>> corresponding to each row.
> >>>>> I populate the data from each row in forEach loop.
> >>>>> User is supposed to click on one of these buttons [selecting one row
> >> to
> >>>>> process],
> >>>>> and onClick event I need to pass the rowId of the to the new Action
> >>>>> ["notify"] in Action class.
> >>>>> Sounds like a trivial task ?
> >>>>> I am just not sure how to implement that correctly in Struts, pretty
> >> new
> >>>> to
> >>>>> Struts.
> >>>> Depends on what you expect to happen when they click the button... is
> >>>> the entire page refreshed, or are you thinking of doing some AJAX
> here?
> >>>> If the entire page is going to refresh, I'd simply make each row its
> >>>> own form and have the button be a regular submit button.  Add a
> hidden
> >>>> field to each form that has the rowId as its value.  Simple,
> standard,
> >>>> will work just fine.  Alternatively, if you don't like multiple
> forms,
> >>>> then have a single hidden form field which again is the row Id, then
> >>>> onClick of the button do:
> >>>>
> >>>> this.form.rowId.value='${list.rowId}';this.form.submit();
> >>>>
> >>>> If your thinking AJAX here, then there's all sorts of ways you could
> do
> >>>> it.
> >>>>
> >>>>> Maybe I should use
> >>>>> <html:submit src=pic.gif onclick="
> >> form.action='action.do?command=notify'"
> >>>> *
> >>>>> value*="${list.rowId}">
> >>>>> instead of HTML <input type=image...> ?
> >>>> Yes, in theory that could work, but I think it's a bit too
> complicated.
> >>>> Again, if your not thinking AJAX here, just do a plain form
> >>>> submission, it's the best answer.  If you DO want to do AJAX, let us
> >>>> know and we can suggest ways to go about it.
> >>>>
> >>>> Dave's suggestions are good too, it just comes down to how you really
> >>>> want this to work.
> >>>>
> >>>>> TIA,
> >>>>> Oleg.
> >>>> Frank
> >>>>
> >>>> --
> >>>> Frank W. Zammetti
> >>>> Founder and Chief Software Architect
> >>>> Omnytex Technologies
> >>>> http://www.omnytex.com
> >>>> AIM/Yahoo: fzammetti
> >>>> MSN: fzammetti@(protected)
> >>>> Author of "Practical Ajax Projects With Java Technology"
> >>>> (2006, Apress, ISBN 1-59059-695-1)
> >>>> and "JavaScript, DOM Scripting and Ajax Projects"
> >>>> (2007, Apress, ISBN 1-59059-816-4)
> >>>> Java Web Parts - http://javawebparts.sourceforge.net
> >>>> Supplying the wheel, so you don't have to reinvent it!
> >>>>
> >>>> -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------
> >>>> To unsubscribe, e-mail: user-unsubscribe@(protected)
> >>>> For additional commands, e-mail: user-help@(protected)
> >>>>
> >>>>
> >>>
> >>>
> -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
> >>>
> >>> No virus found in this incoming message.
> >>> Checked by AVG Free Edition.
> >>> Version: 7.5.476 / Virus Database: 269.11.15/949 - Release Date:
> >> 8/12/2007 11:03 AM
> >>
> >>
> >>
> >> -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------
> >> To unsubscribe, e-mail: user-unsubscribe@(protected)
> >> For additional commands, e-mail: user-help@(protected)
> >>
> >>
> >
> >
> > -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
> >
> > No virus found in this incoming message.
> > Checked by AVG Free Edition.
> > Version: 7.5.476 / Virus Database: 269.11.15/949 - Release Date:
> 8/12/2007 11:03 AM
>
> -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

©2008 junlu.com - Jax Systems, LLC, U.S.A.