Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

How to pass input field values in to java ?

Level 1
Level 1

I have designed one page using HTL . my page components contains one input text field and button. how  i can pass my text field values in to java class.

Here is my HTL code .

<sly data-sly-use.clientlib="/libs/granite/sightly/templates/clientlib.html" data-sly-call="${clientlib.all @ categories=''}"/>

<div data-sly-use.s7dataset="com.dam.service.Info">

<header id="header" class="hoc clear">

<form class="search foundation-form granite-omnisearch-form">

<input class="searchTerm" placeholder="search scene7 ..." /> <input

class="searchButton" type="submit" />



Here is my java code:


package  com.dam.service

public class Info extends WCMUsePojo {


    public void activate() throws Exception {




I am not sure that can i use WCMUsePojo or not . anybody help me to get value in to java .?

3 Replies
Level 2
Level 2

You can set the form method to "GET" and use this getRequest().getParameter("id") to get the values from the input fields.

Community Advisor
Community Advisor


You can pass value from HTL to java like below:


<div"${'' @ cfInput=properties.cfdata, variation=properties.variation},cfMode='some mode'">


public void activate() {

  String cfInput = get("cfInput", String.class);

String cfVariation = get("cfVar", String.class);

String mode = get("cfMode", String.class);

But In your case you can't pass value from client side to Java Use API.

But value can be pass when form is submitted and value can be fetched at action page/servlet/jsp etc.

Level 10
Level 10

When using HTL - to get values to Java, you can either use:

1 - a component dialog - Creating an Adobe Experience Manager 6.4 HTL component that uses the WCMUsePojo API

2 - or use a HTTP POST or GET operation - this would be sent to a servlet however.

In your form use case - you can use AJAX to sent the values to a Java Servlet - you cannot pass that to WCMUSEPojo as that happens when the dialog is filled out.