Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Namespace prefix for form fields..

 
Sachin Holla
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I prefix a form field with portlet namespace, should I use this prefixed parameter name to get the value in my portlet class??

To be specific... my jsp looks like this:


Now, how should I access myfield in my render() method???


I strongly feel it should be the second way. But I did not find any convenient answer in JSR...
 
Stefan Zoerner
Author
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
holla,

if you define the field names of your form like that, the second way should do. And yes, it is not very handy. Why do you want to prefix the input names of the form? I do not know your use case, but normally prefixing the form name is sufficient to avoid name ambiguities on a portal page for JavaScript etc., or do I miss something? If you ony prefix the name of the form, the name of the parameter is just like it is in the HTML tag.

Btw.: Welcome to the Java Ranch! Your login name does not adhere to the Official policy on registered names.

Greetings, Stefan
 
Jessica Sant
Sheriff
Posts: 4313
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"holla"
Welcome to the JavaRanch! It's great that you found our snazzy new Portal and Portlets forum... but can you do me one favor? Please change your display name to match the JavaRanch Naming Policy (basically you should have a legitmate sounding first and last name). You can tweak it here

Thanks! and again welcome to the JavaRanch!
- Jess
 
Sachin Holla
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Stefan,
thanks for your comments.. the second method should be the logical one. i was just playing with different combinations and i came across this scenario..


regarding my name -
my name is sachin holla. most of my friends call me holla, so i kept that display name..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic