I have a JSP file and I want to get the value of the input text and send it to a java class. How can I do it?

<form name="boxSettingForm" action="/ScanToBox/ScanJobServlet" method="post" >
<div style="height: 417px; width: 790px; background-color: #ffffff; margin-left: 0px; margin-top: 0px;">
<div style="height: 116px; ">
    <br><input id="boxName" value="BoxName" style="height: 49px; width:128px; font-size:16px; font-family:Albany; background-color:#D4D6D9" type="button" onfocus="this.blur()">
    *<input id="boxName" style="text-align:left; font-size:24px; font-family:Albany; height: 47px; width: 624px" type="text" value="myBox">*
</div>

<input type="button" value="Start"
style="position: absolute; left: 250px; top: 220px; height: 80px; width: 280px; font-size: 16px; font-family: Albany; background-color: #D4D6D9"
onfocus="this.blur()" onclick="get_input()"></div>

I want to get the value of the input text and send it to a java class.

Recommended Answers

All 2 Replies

and the problem is?

Just submit the form to a servlet, and you're doing exactly that.

Of course if you're under the impression you can run Java classes on the client in a JSP you're gravely mistaken.

most likely, if you go over the JSP forum, you'll find all the information you need about working with jsp's and servlets.

if not, I can recommend the book Head First Servlets & JSP

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.