Link to home
Start Free TrialLog in
Avatar of ibo
ibo

asked on

JSP : textbox or textarea?

im using jsp.

i want to know what kind of form element im getting using
request.getParameter("param"), it could be either text box or text area. how will i know?
Avatar of mohan_sekar
mohan_sekar
Flag of United States of America image

Hi,

  Try using request.getParameterName("param");

bye
If you have a from which uses GET when submit the form, the string will look like this:
A html tag can have these words inside:
TYPE
NAME
VALUE

You can name your textbox as TXTBX and the text area as TXTAR and getParameter("TXTBX") and getParameter("TXTAR") will return what you are looking for.

Oh, I've made a little mistake in the previous answer. Anyway, few more details:
getServerNames() retrieve all the names you have and it hasn't any parameter, as mohan said.
Hi,

     I'm sorry. It should be request.getParamaterNames() rather.

bye
Your problem resumes to attrib a different name to text boxex/areas
ASKER CERTIFIED SOLUTION
Avatar of mgaurav
mgaurav

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ibo
ibo

ASKER

sigh..

since im using the same name for textarea and text box (and using POST method since i have tons of form elements),
obviously the result of those getWhateverMethod() will be the same. anyway i just made a workaround by counting the string length hehe :)
I do not agree with your choise regarding the answer. Anyway, if you'd said about using POST i'd have direct you to learn from here:
https://www.experts-exchange.com/jsp/qShow.jsp?ta=java&qid=20142195
Avatar of ibo

ASKER

what? where do u do not agree with?