-1

I'm new for atg and I have input field in my .jsp file as below..

    <input type="email"  id="email" placeholder="Your Email" class="form-control">

I want to pass value in this field, to my java file. I don't know hoe to do that. Can anyone help me please.

Lanka
  • 29
  • 2
  • 11

3 Answers3

0

if you want to set a field in a FormHandler, you should use dsp tag library dsp:input and it should be inside of form tag dsp:form. In that way you'll have fields populated by atg on form submission.

0

The way ATG works for form binding (the process of attaching a value from an HTML form field to a value in a Java component) is to use the DSP form tags along with a formhandler.

Create a java class as a bean with a property called, say, email. I.e. with a getEmail and setEmail method (this is standard Java, look up how to define a JavaBean in Java).

Create a request-scoped named Nucleus component as an instance of this class (refer to the Programming Guide in the ATG documentation, specifically the section called Nucleus: Organizing JavaBean Components)

Then in your JSP page use the dsp:input tag to bind to your bean property (refer to the Forms section in the ATG Page Developers guide).

You will also need to implement a submit handler method for your form (refer to the section Working with Forms and Form Handlers in the ATG Programming Guide).

Vihung
  • 12,947
  • 16
  • 64
  • 90
-1

Create a ATG component(Java file and properties file). Keep two properties in it named firstName and lastName and a handler method named handleSubmitForm.
Now add this content in your jsp:

<dsp:page>
<dsp:body>
<dsp:form>
<dsp:input name="studentName" type="test" bean="MyFormHandler.firstName"/>
<dsp:input name="studentName" type="test" bean="MyFormHandler.lastName"/>
<dsp:input name="submit" value="Submit" bean="MyFormHandler.submitForm"/>
</dsp:form>
</dsp:body>
</dsp:page>

Refer this for more explanation.

Hexfire
  • 5,945
  • 8
  • 32
  • 42
Swati Ghai
  • 41
  • 1
  • 5