Aaron,

Glad to see it works :-)  I corrected my typo before seeing your reply... .

You are free to do what you like in the JSP... but don't say it is better design... because unfortunately it isn't... . Scriplets and hard coding in JSPs is "bad" design period :-)

Yes - if there is one variable used in one JSP then technically you are coding in 2 places... but that doesn't make it better or best practice... . The other argument might be that it is easier to put it in the JSP because JSP's can be automatically re-compiled on changes but this doesn't hold water either because in production best practice has it to disable auto-recompile of JSPs for a number of reasons (e.g. more performant, security w.r.t. defacing, etc...). Perhaps its more convenient for you but convenience and good design don't always go hand in hand... often its a trade off.

In any event, it seems like you have little choice. But I'm curious why you would have to make changes in 2 places if the variable value changes? I only see a change in 1 place if a variable is say called DEFAULT_COUNTRY and its value needs to change. No?

--Nikolaos






Aaron Strmas wrote:
Hi Nikolaos,

Yes, initializing property in action works fine. I think that in this case my initial design is better, because I have to change the JSP later anyway, and it would be only change to the JSP only. Now I have to make change in two places

-a

On Jul 28, 2010, at 12:17, Nikolaos Giannopoulos <[email protected] <mailto:[email protected]>> wrote:

Aaron,

You shouldn't avoid hard-coding values in a JSP... even if it something as simple as a default value.

Have you tried putting the value as a constant in your action bean and referring to it from there? (the idea is if you have multiple JSPs then the value need only be maintained in one place)

If it works drop us a note as I am curious about this issue as well... .

--Nikolaos



Aaron Stromas wrote:
Greetings,

My application has a counttry property whose value eventually will be input in the form but for now is defaulted to "US", so I attempted to put it in the hidden field in the JSP:

<stripes:hidden name="country" value="US"/>

The generated HTML is

<input type="hidden" name="country" value=""/>

The same HTML is generated for <stripes:hidden name="country">US</stripes:hidden>.

The oddest thing is that the value is stripped and the same HTML is produced when I put <input type="hidden" name="country" value="US"/> directly in JSP. Is Websphere's JSP engine sabotaging the works? Anybody knows? Just curious...
Thanks,

-a

--
Aaron Stromas
Mobile: +1 703 203 9169

------------------------------------------------------------------------

------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share of $1 Million in cash or HP Products. Visit us here for more details:
http://ad.doubleclick.net/clk;226879339;13503038;l?
http://clk.atdmt.com/CRS/go/247765532/direct/01/
------------------------------------------------------------------------

_______________________________________________
Stripes-users mailing list
[email protected] <mailto:[email protected]>
https://lists.sourceforge.net/lists/listinfo/stripes-users


--
Nikolaos Giannopoulos
Director, BrightMinds Software Inc.
e. [email protected] <mailto:[email protected]>
w. www.brightminds.org <http://www.brightminds.org>
t. 1.613.822.1700
c. 1.613.797.0036
f. 1.613.822.1915
------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://p.sf.net/sfu/dev2dev-palm
_______________________________________________
Stripes-users mailing list
[email protected] <mailto:[email protected]>
https://lists.sourceforge.net/lists/listinfo/stripes-users


--
Nikolaos Giannopoulos
Director, BrightMinds Software Inc.
e. [email protected]
w. www.brightminds.org
t. 1.613.822.1700
c. 1.613.797.0036
f. 1.613.822.1915

------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://p.sf.net/sfu/dev2dev-palm
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to