struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Benedict <pbened...@apache.org>
Subject Re: Anyway to map properties to different request names?
Date Wed, 05 Nov 2014 20:54:29 GMT
It bothers me that the Java programming model dictates the parameter names.
In theory "personId" could be sent as "a" -- although a variable named "a"
in Java is bad naming conventions. There isn't a good technical reason to
keep this 1:1 mapping. The shorter the bytes sent too the better.... And in
reverse, if one is working on re-implementing an existing servlet/service,
you have to give poor names to your Java model to match existing form names.


Cheers,
Paul

On Wed, Nov 5, 2014 at 2:47 PM, JOSE L MARTINEZ-AVIAL <jlmagc@gmail.com>
wrote:

> You only need to set the attribute name of the field
>
> <field name="personId" type="text"></input>
>
> You can even use a different Id, if you want to refer to the field in
> javascript.  Why does it bother you?
>
> 2014-11-05 15:39 GMT-05:00 Paul Benedict <pbenedict@apache.org>:
>
> > Let's say I have a getter/setter for field personId. That means in my
> > markup, I need to have a field named personId too. However, I am not
> really
> > found of bleeding Java naming conventions into my web page. Shouldn't
> there
> > be a way -- is there a way? -- of assigning another name to it?
> >
> > Hopeful example:
> >
> > @RequestParam("person")
> > public final void setPersonId(String personId) { ... }
> >
> > Cheers,
> > Paul
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message