struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Heikki Hyyrö <heikki.hy...@uta.fi>
Subject Re: Anyway to map properties to different request names?
Date Wed, 05 Nov 2014 21:13:06 GMT
Paul Benedict <pbenedict@apache.org> kirjoitti 5.11.2014 kello 22.54:
> 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.


One simple (but perhaps ugly?) way is to provide also page-specific setters along with the
usual JavaBean-setters:

// Page provides personId using the name ”a”.
public final void setA(String personId) { ... }

// JavaBean-version (if also needed)
public final void setPersonId(String personId) { ... }

-Heikki


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


Mime
View raw message