활동이 없어 이 대화는 잠겼습니다. 새 게시물을 작성해 주세요.
활동이 없어 이 대화는 잠겼습니다. 새 게시물을 작성해 주세요.
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='s7.s7dataset.style'}"/>
<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" />
</form>
</header>
Here is my java code:
-------------------
package com.dam.service
public class Info extends WCMUsePojo {
@Override
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 .?
조회 수
답글
좋아요 수
You can set the form method to "GET" and use this getRequest().getParameter("id") to get the values from the input fields.
조회 수
답글
좋아요 수
HI,
You can pass value from HTL to java like below:
HTL
<div data-sly-use.cf="${'com.aem.community.core.components.ContentFragmentContent' @ cfInput=properties.cfdata, variation=properties.variation},cfMode='some mode'">
Java
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.
조회 수
답글
좋아요 수
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.
조회 수
답글
좋아요 수
조회 수
Likes
답글