Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

passing HTML value to JSP

Posted on 2004-10-04
21
Medium Priority
?
769 Views
Last Modified: 2010-04-01
Frds,
   I want to pass selected value from HTML(may be Text or drop down)
to JSP code ?
Thanks in advance ...
karan
0
Comment
Question by:Manish
[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
  • 8
  • 6
  • 5
21 Comments
 
LVL 33

Accepted Solution

by:
hongjun earned 100 total points
ID: 12216591
You can always do this

<form action="page2.jsp" method="post">
<input type="text" name="Text1">
<input type="submit">
</form>


in your page2.jsp, you do this to get the text value
    request.getParameter("submit");


hongjun

0
 
LVL 33

Expert Comment

by:hongjun
ID: 12216609
to print out the text, you do this

out.println(request.getParameter("Text1));


hongjun
0
 
LVL 9

Expert Comment

by:Nick_72
ID: 12216610
You will have to resubmit the page and retreve the parameter.

for example:

<%
  if (request.getParameter("myTextField") != null) {
%>   alert('Parameter found: <%=request.getParameter("myTextField")%>');
<%}
%>

<form method="post" name="myform" action="#">
  <input type="text" name="myTextField" onBlur="this.form.submit();">
</form>

/Nick
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 33

Expert Comment

by:hongjun
ID: 12216616
ignore my first comment on "request.getParameter("submit");"...
0
 
LVL 11

Author Comment

by:Manish
ID: 12216623
I want to use on same page without submitting ?
Is it possible?
0
 
LVL 33

Expert Comment

by:hongjun
ID: 12216639
For the same page, you can always use METHOD=get and submit to the same page.
To retrieve it, you do the same thing.
0
 
LVL 33

Expert Comment

by:hongjun
ID: 12216640
<form method="get">
...
</form>
0
 
LVL 9

Expert Comment

by:Nick_72
ID: 12216645
>>I want to use on same page without submitting ?
>>Is it possible?

I'm afraid not.
0
 
LVL 11

Author Comment

by:Manish
ID: 12216670
But I have to remember all other selected value..
Is it possible to pass the value to javascript and use in
java code of jsp?
0
 
LVL 9

Assisted Solution

by:Nick_72
Nick_72 earned 100 total points
ID: 12216689
no it's not, since javascript is executed on the client, while all jsp code is processed on the server. That is why you have to submit the page so the server gets the values.
0
 
LVL 11

Author Comment

by:Manish
ID: 12216699
So without sumit it is not possible?
0
 
LVL 9

Expert Comment

by:Nick_72
ID: 12216706
that's right
0
 
LVL 11

Author Comment

by:Manish
ID: 12216878
Thanks hongjun and Nick..
U both cleared my problem...
There should be sharing points among u...
karan
0
 
LVL 9

Expert Comment

by:Nick_72
ID: 12217102
There is a feature to share points ;) not now though, it's too late since it's already accepted.
No problem.

/Nick
0
 
LVL 33

Expert Comment

by:hongjun
ID: 12217349
0
 
LVL 33

Expert Comment

by:hongjun
ID: 12224258
@ee_ai_construct

OK. I am fine with the split if the questionner replies.

hongjun
0
 
LVL 11

Author Comment

by:Manish
ID: 12247988
How to share points ,Sorry I dont know?
0
 
LVL 33

Expert Comment

by:hongjun
ID: 12255754
Yeah.
0
 
LVL 9

Expert Comment

by:Nick_72
ID: 12257278
Thank you guys, I appreciate it :)

/Nick
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Article by: Shawn
IT teams define success as solving problems quickly. To enable ITSM modernization we have to think of adopting the tools and methods that will enable resolution of ITSM issues more quickly.
In this article, WatchGuard's Director of Security Strategy and Research Teri Radichel, takes a look at insider threats, the risk they can pose to your organization, and the best ways to defend against them.
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

730 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