struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Geeta Ramani" <geeta.ram...@cmpco.com>
Subject Re: Form Submission
Date Wed, 18 Feb 2004 15:52:23 GMT
Mark:

Not sure what you meant by your remark about javascript, but I believe
javascript was ruled out earky on (not an option or something).  The reason I
thought saving the user as a session was ok is that I do not believe they are
evil (:) either, and further, I can just see this sort of problem recurring
throughout his application.  Since the user is something that will not
change, i felt it's ok to save this as a session variable. (and this I
sometimes use as a way to judge whether or not I should save something as a
session variable, thus removing the headaches of remembering to reset/remove
them)..

That said, I have to reiterate that I did not read/understand Avinash's note
carefully enough, as you seem to have, so your note may well make more sense
than mine..:)

Hope this will sustain you without the crack..;)
Geeta

Mark Lowe wrote:

> I said no such thing about javascript.
>
> I'm in the httpsession != evil school and I'd say this isn't an
> occasion where you'd use it as you don't need anything to persist
> beyond the request (accept this default action thing whatever thats
> about).
>
> The single action class as a type of command dispatcher sounds
> ingenious. But it has to be using a form property or request parameter
> otherwise the id in the link wouldn't do what you want. I can see how
> this has helped make life less complex :o) I assume it extracts a map
> iterates through is and then selects the relevant 'command' based on
> the map's contents.
>
> You cant submit a form with a link without using javascript. You can
> use an image as a button, but thats another subject. I have no more
> suggestions than those I've already made, else I'll start getting urges
> to go out and score come crack in an attempt to save my teeth from all
> the brick-chewing.
>
> On 18 Feb 2004, at 14:15, Geeta Ramani wrote:
>
> > Hi Avinash:
> >
> > I have not followed your description very carefully - my eyes started
> > glazing over about mid-way..;) - but here's a thought (and I'm only
> > going by what i remember of your original question, so forgive me if I
> > misspeak..): If you do not have access to the request object, do you at
> > least have access to the session?  In which case how about putting the
> > user in a session variable (maybe right after logon) and then you
> > should
> > be able to get his/her userId etc etc wherever you want it from..?  I
> > know there has been **extensive** discussion in this list re. the pros
> > and cons of using session variables and if you are of the
> > all-session-vars-are-bad school of thought, this won't do you any good.
> > But personally,  this seems to be a situation where a session variable
> > would come in handy..
>
> >
> > If however this idea wn't work in your situation, you may want to
> > discuss with your clients their absolute requirement about wanting a
> > link vs. a button (I believe you indicated earlier that the latter case
> > will pose no prblems for you..?)
>
> >
> > Good luck!
> > Geeta
> >
> > avinash.tiwari@tcs.com wrote:
> >
> >>
> >> Hi Geeta/Paul/Mark/Wendy
> >>
> >> What Geeta has suggested is basically the same thing but Paul is using
> >> JSTL for that.
> >> But such is the restriction of my application that I can not use
> >> request object to get the values from form directly by calling
> >> request.getParameter(...);
> >>
> >> I will explain this why.
> >>
> >> The framework that we are working with right now gives some add on
> >> features over struts. Basically taken from StrutsEJB framework.
> >>
> >> We are using Map Based DTOs to transfer data from view layer to model
> >> layer and other way round.
> >> We are also using the feature of Command Files. I will explain it what
> >> it is for people unaware of StrutsEJB framework.
> >>
> >> In Struts we are supposed to mention the Action Class in the
> >> struts-config.xml. And from the Action class we generally call some
> >> java programs (say command files) to access the model layer basically
> >> to avoid keeping business logic in Action Classes.
> >>
> >> But in my framework we just need to mention the Command file name in
> >> struts-config.xml instead of Action classes. There is only one action
> >> class that is DefaultAction class which handles all the requests and
> >> diverts the program control to the command file. I will give here one
> >> typical entry in my struts-config.xml for your reference.
> >>
> >> <action
> >>     path="/CreateUser"
> >>     type="framework.common.web.DefaultAction"
> >>     name="UserForm"
> >>     scope="request"
> >>     input = "/CreateUser.jsp"
> >>     parameter="app.cmd.CreateUserCmd">
> >>     <forward name="Success" path = "/UserSucc.jsp" />
> >>   </action>
> >>
> >> in the above action tag the attribute parameter is the name of the
> >> command file where i would like my control to go after the form gets
> >> submitted.
> >>
> >> Now the problem is in the Command File "CreateUserCmd" where i would
> >> keep my business logic -- i dont have the "request" object. so i cant
> >> do a
> >> "request.getParameter(.....); " here.
> >>
> >> the way i get values from forms is like this.
> >>
> >> if I have this code in JSP
> >> <html:text property="dto(txtUsname)" styleClass="listItem" size="14"
> >> />
> >>
> >> I will have to write the following code in my command file to get the
> >> value of "User Name"
> >> String UserName = (String)paramDTO.get("txtUsName");
> >>
> >> As Mark/Wendy were asking me why i cant use JavaScript is because
> >>
> >> whenever i use something like this in JavaScript I get javascript
> >> error at runtime
> >> document.UserForm.dto(txtUsName).value = val;
> >> document.UserForm.submit();
> >>
> >> This is obvious because whenever javascript parses something like
> >> dto(txtUsName) it takes it as a function call.
> >>
> >> I hope I could explain the problem properly.
> >>
> >> Regards
> >> Avinash Tiwari
> >> Tata Consultancy Services
> >> Mailto: avinash.tiwari@tcs.com
> >> Website: http://www.tcs.com
> >>
> >>
> >> "Geeta Ramani"
> >                                               Struts Users Mailing List
> >   <geeta.ramani@cmpco.com>                 To
> > <struts-user@jakarta.apache.org>
> >
> >   02/17/2004 09:57 PM                      cc
> >           Please respond to           Subject Re: Form Submission
> >      "Struts Users Mailing List"
> >    <struts-user@jakarta.apache.org>
> >
> >>
> >>
> >>
> >> Avinash:
> >>
> >> How about trying something like this:
> >>
> >> <%String myLink = "/EmplyeeDetailAction.do?employeeId=" + employeeId;
> >> %>
> >>
> >> <html:link page="<%=myLink">Employee Detail Page</html:link>
> >>
> >> Regards,
> >> Geeta
> >>
> >> avinash.tiwari@tcs.com wrote:
> >>
> >>>
> >>> I want to use a hyperlink instead -
> >>>
> >>> for example
> >>> On a typical employee list page clicking the employee id of an
> >>> employee takes you to the employee detail page.
> >>>
> >>> In this scenario employee id can not be displayed over a button - it
> >>
> >>> has to be a hyperlink..
> >>>
> >>> Use of javascript is restricted. So i cant call a javascript
> >> function
> >>> to set the action atribute and then call the submit function.
> >>>
> >>> Avinash Tiwari
> >>> Tata Consultancy Services
> >>> Mailto: avinash.tiwari@tcs.com
> >>> Website: http://www.tcs.com
> >>>
> >>>
> >>> Mark Lowe <mark.lowe@talk21.com>
> >>                                           To "Struts Users Mailing
> >> List"
> >>
> >> <struts-user@jakarta.apache.org>
> >>  02/17/2004 08:57 PM
> >>                                           cc
> >>          Please respond to
> >>     "Struts Users Mailing List"      Subject Re: Form Submission
> >>   <struts-user@jakarta.apache.org>
> >>
> >>>
> >>>
> >>>
> >>> May I ask why you don't want a submit button?
> >>>
> >>>
> >>> On 17 Feb 2004, at 15:55, avinash.tiwari@tcs.com wrote:
> >>>
> >>>>
> >>>> Hi
> >>>>
> >>>> How can we submit a form without using <html:submit> tag. I dont
> >>> want
> >>>> to use JavaScript for this?
> >>>>
> >>>> Thanks & Regards
> >>>>  Avinash Tiwari
> >>>>  Tata Consultancy Services
> >>>>  Mailto: avinash.tiwari@tcs.com
> >>>>  Website:
> >>>> http://
> >>>>
> >>>
> >> www.tcs.com<InterScan_Disclaimer.txt>---------------------------------
> >> -
> >>
> >>>
> >>>> -----------------------------------
> >>>> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> >>
> >>>> For additional commands, e-mail:
> >> struts-user-help@jakarta.apache.org
> >>>
> >>>
> >>>
> >>>
> >> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> >>> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> >>
> >>>
> >>>
> >>> ForwardSourceID:NT00004E3A
> >>>
> >>>    ----------------------------------------------------------------
> >>>
> >> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> >>> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> >>
> >>>
> >>
> >> ForwardSourceID:NT00004E76
> >>
> >>    ----------------------------------------------------------------
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> >> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> >>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message