Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 663
  • Last Modified:

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?
0
ibo
Asked:
ibo
  • 4
  • 2
  • 2
  • +1
1 Solution
 
mohan_sekarCommented:
Hi,

  Try using request.getParameterName("param");

bye
0
 
jorjCommented:
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.

0
 
jorjCommented:
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.
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
mohan_sekarCommented:
Hi,

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

bye
0
 
jorjCommented:
Your problem resumes to attrib a different name to text boxex/areas
0
 
mgauravCommented:
You cannot get the type of the Object - viz whether TextBox or TextArea from inside the JSP, which has got the results from some form from other page. The type is a property of the form and is available only via JavaScript / DHTML on the same page only. You may add a variable to the form (of TYPE="hidden") which will hold the value whether the type of the form-input object is TextBox or TextArea.

Hope it helps.

Gaurav
0
 
iboAuthor Commented:
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 :)
0
 
jorjCommented:
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:
http://www.experts-exchange.com/jsp/qShow.jsp?ta=java&qid=20142195
0
 
iboAuthor Commented:
what? where do u do not agree with?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now