Solved

JSP : textbox or textarea?

Posted on 2001-06-29
9
602 Views
Last Modified: 2008-02-26
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
Comment
Question by:ibo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
  • +1
9 Comments
 
LVL 15

Expert Comment

by:mohan_sekar
ID: 6237192
Hi,

  Try using request.getParameterName("param");

bye
0
 
LVL 2

Expert Comment

by:jorj
ID: 6237251
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
 
LVL 2

Expert Comment

by:jorj
ID: 6237279
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 15

Expert Comment

by:mohan_sekar
ID: 6237314
Hi,

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

bye
0
 
LVL 2

Expert Comment

by:jorj
ID: 6237324
Your problem resumes to attrib a different name to text boxex/areas
0
 
LVL 2

Accepted Solution

by:
mgaurav earned 50 total points
ID: 6237370
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
 
LVL 3

Author Comment

by:ibo
ID: 6237373
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
 
LVL 2

Expert Comment

by:jorj
ID: 6237399
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
 
LVL 3

Author Comment

by:ibo
ID: 6239537
what? where do u do not agree with?
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
web application structure 18 111
throw exception 21 66
What browser will run Java? 7 122
Html split(text) 2 26
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question