a4j:support partial update before submit the form












0














I want to make quick search in the JSF page before I submit the form (partial update) , so I have two values, one is input text and I want the result show in the output text when the user enter the value in the input text. for example I want to search about the name of the user using the user id, so in the input text the user will enter the user id (e.g 2323) then the search will happens and this will render the output text with the name of this user(2323).



I use a4j:support in order to achieve this but nothing shown with me and there is no any error or exception.



this is my JsF page:



<tr>
<td>
<table>
<tr>
<td width="80px"><h:outputLabel
value="user id"></h:outputLabel></td>
<td width="5px">&nbsp;</td>
<td><h:inputText id="secondIdNum" maxlength="6" style="width:240px"
value="#{ideaDetailsBean.addIdeaDto.secondId}">
<a4j:support event="onchanged" actionListener="#
{ideaDetailsBean.secondIdChange}"
reRender="secondNameId" />
</h:inputText></td>

<td width="15px">&nbsp;</td>
<td width="80px"><h:outputLabel value="user name "></h:outputLabel></td>
<td width="5px">&nbsp;</td>
<td><h:outputText id="secondNameId"
style="width:240px"
value="#{ideaDetailsBean.addIdeaDto.secondName}"></h:outputText>
</td>
</tr>
</table>
</td>
</tr>


in the backbean:



public void secondIdChange(ActionEvent actionEvent) {
if(addIdeaDto.getSecondId() != null){
addIdeaDto.setSecondName(getParticipantName(addIdeaDto.getSecondId()));
}
}

static String getParticipantName(String employeeId) {
IIMDelegate iimDelegate = new IIMDelegate();
UserInfoDto userInfoDto = new UserInfoDto();
iimDelegate.getParticipant(employeeId);
return userInfoDto.getUserName();
}


in the DAO:



    public UserInfoDto getParticipant(String employeeId) {
Connection connection = null;
PreparedStatement preparedStatement = null;
ResultSet searchResultSet = null;

try {
connection = getConnection();
preparedStatement = connection.prepareStatement(
"SELECT U_NAME FROM APPL_USER WHERE U_LOGIN = ?");
// Assign first value to first parameter
preparedStatement.setString(1, employeeId);
searchResultSet = preparedStatement.executeQuery();
return getParticipant(searchResultSet);

} catch (Exception e) {
throw new RuntimeException(e);
} finally {
try {
searchResultSet.close();

preparedStatement.close();
} catch (SQLException e) {
throw new RuntimeException(e);
}
}
}
private UserInfoDto getParticipant(ResultSet searchResultSet) throws SQLException {
List<UserInfoDto> result = new ArrayList<UserInfoDto>();
UserInfoDto userInfoDto = null;

while (searchResultSet.next()) {
userInfoDto = new UserInfoDto();
userInfoDto.setUserName(searchResultSet.getString(1));
result.add(userInfoDto);
}
return result == null ? null : result.size() > 0 ? result.get(0) :null;
}


Any suggestion to achieve this in different way?










share|improve this question
























  • Did you debug network traffic in the browser to see what is happening there?
    – Kukeltje
    Nov 20 '18 at 8:48










  • @Kukeltje I didn’t debug
    – wadha alketbi
    Nov 20 '18 at 10:36










  • Please do! (and for my curiosity, why not???)
    – Kukeltje
    Nov 20 '18 at 10:48
















0














I want to make quick search in the JSF page before I submit the form (partial update) , so I have two values, one is input text and I want the result show in the output text when the user enter the value in the input text. for example I want to search about the name of the user using the user id, so in the input text the user will enter the user id (e.g 2323) then the search will happens and this will render the output text with the name of this user(2323).



I use a4j:support in order to achieve this but nothing shown with me and there is no any error or exception.



this is my JsF page:



<tr>
<td>
<table>
<tr>
<td width="80px"><h:outputLabel
value="user id"></h:outputLabel></td>
<td width="5px">&nbsp;</td>
<td><h:inputText id="secondIdNum" maxlength="6" style="width:240px"
value="#{ideaDetailsBean.addIdeaDto.secondId}">
<a4j:support event="onchanged" actionListener="#
{ideaDetailsBean.secondIdChange}"
reRender="secondNameId" />
</h:inputText></td>

<td width="15px">&nbsp;</td>
<td width="80px"><h:outputLabel value="user name "></h:outputLabel></td>
<td width="5px">&nbsp;</td>
<td><h:outputText id="secondNameId"
style="width:240px"
value="#{ideaDetailsBean.addIdeaDto.secondName}"></h:outputText>
</td>
</tr>
</table>
</td>
</tr>


in the backbean:



public void secondIdChange(ActionEvent actionEvent) {
if(addIdeaDto.getSecondId() != null){
addIdeaDto.setSecondName(getParticipantName(addIdeaDto.getSecondId()));
}
}

static String getParticipantName(String employeeId) {
IIMDelegate iimDelegate = new IIMDelegate();
UserInfoDto userInfoDto = new UserInfoDto();
iimDelegate.getParticipant(employeeId);
return userInfoDto.getUserName();
}


in the DAO:



    public UserInfoDto getParticipant(String employeeId) {
Connection connection = null;
PreparedStatement preparedStatement = null;
ResultSet searchResultSet = null;

try {
connection = getConnection();
preparedStatement = connection.prepareStatement(
"SELECT U_NAME FROM APPL_USER WHERE U_LOGIN = ?");
// Assign first value to first parameter
preparedStatement.setString(1, employeeId);
searchResultSet = preparedStatement.executeQuery();
return getParticipant(searchResultSet);

} catch (Exception e) {
throw new RuntimeException(e);
} finally {
try {
searchResultSet.close();

preparedStatement.close();
} catch (SQLException e) {
throw new RuntimeException(e);
}
}
}
private UserInfoDto getParticipant(ResultSet searchResultSet) throws SQLException {
List<UserInfoDto> result = new ArrayList<UserInfoDto>();
UserInfoDto userInfoDto = null;

while (searchResultSet.next()) {
userInfoDto = new UserInfoDto();
userInfoDto.setUserName(searchResultSet.getString(1));
result.add(userInfoDto);
}
return result == null ? null : result.size() > 0 ? result.get(0) :null;
}


Any suggestion to achieve this in different way?










share|improve this question
























  • Did you debug network traffic in the browser to see what is happening there?
    – Kukeltje
    Nov 20 '18 at 8:48










  • @Kukeltje I didn’t debug
    – wadha alketbi
    Nov 20 '18 at 10:36










  • Please do! (and for my curiosity, why not???)
    – Kukeltje
    Nov 20 '18 at 10:48














0












0








0







I want to make quick search in the JSF page before I submit the form (partial update) , so I have two values, one is input text and I want the result show in the output text when the user enter the value in the input text. for example I want to search about the name of the user using the user id, so in the input text the user will enter the user id (e.g 2323) then the search will happens and this will render the output text with the name of this user(2323).



I use a4j:support in order to achieve this but nothing shown with me and there is no any error or exception.



this is my JsF page:



<tr>
<td>
<table>
<tr>
<td width="80px"><h:outputLabel
value="user id"></h:outputLabel></td>
<td width="5px">&nbsp;</td>
<td><h:inputText id="secondIdNum" maxlength="6" style="width:240px"
value="#{ideaDetailsBean.addIdeaDto.secondId}">
<a4j:support event="onchanged" actionListener="#
{ideaDetailsBean.secondIdChange}"
reRender="secondNameId" />
</h:inputText></td>

<td width="15px">&nbsp;</td>
<td width="80px"><h:outputLabel value="user name "></h:outputLabel></td>
<td width="5px">&nbsp;</td>
<td><h:outputText id="secondNameId"
style="width:240px"
value="#{ideaDetailsBean.addIdeaDto.secondName}"></h:outputText>
</td>
</tr>
</table>
</td>
</tr>


in the backbean:



public void secondIdChange(ActionEvent actionEvent) {
if(addIdeaDto.getSecondId() != null){
addIdeaDto.setSecondName(getParticipantName(addIdeaDto.getSecondId()));
}
}

static String getParticipantName(String employeeId) {
IIMDelegate iimDelegate = new IIMDelegate();
UserInfoDto userInfoDto = new UserInfoDto();
iimDelegate.getParticipant(employeeId);
return userInfoDto.getUserName();
}


in the DAO:



    public UserInfoDto getParticipant(String employeeId) {
Connection connection = null;
PreparedStatement preparedStatement = null;
ResultSet searchResultSet = null;

try {
connection = getConnection();
preparedStatement = connection.prepareStatement(
"SELECT U_NAME FROM APPL_USER WHERE U_LOGIN = ?");
// Assign first value to first parameter
preparedStatement.setString(1, employeeId);
searchResultSet = preparedStatement.executeQuery();
return getParticipant(searchResultSet);

} catch (Exception e) {
throw new RuntimeException(e);
} finally {
try {
searchResultSet.close();

preparedStatement.close();
} catch (SQLException e) {
throw new RuntimeException(e);
}
}
}
private UserInfoDto getParticipant(ResultSet searchResultSet) throws SQLException {
List<UserInfoDto> result = new ArrayList<UserInfoDto>();
UserInfoDto userInfoDto = null;

while (searchResultSet.next()) {
userInfoDto = new UserInfoDto();
userInfoDto.setUserName(searchResultSet.getString(1));
result.add(userInfoDto);
}
return result == null ? null : result.size() > 0 ? result.get(0) :null;
}


Any suggestion to achieve this in different way?










share|improve this question















I want to make quick search in the JSF page before I submit the form (partial update) , so I have two values, one is input text and I want the result show in the output text when the user enter the value in the input text. for example I want to search about the name of the user using the user id, so in the input text the user will enter the user id (e.g 2323) then the search will happens and this will render the output text with the name of this user(2323).



I use a4j:support in order to achieve this but nothing shown with me and there is no any error or exception.



this is my JsF page:



<tr>
<td>
<table>
<tr>
<td width="80px"><h:outputLabel
value="user id"></h:outputLabel></td>
<td width="5px">&nbsp;</td>
<td><h:inputText id="secondIdNum" maxlength="6" style="width:240px"
value="#{ideaDetailsBean.addIdeaDto.secondId}">
<a4j:support event="onchanged" actionListener="#
{ideaDetailsBean.secondIdChange}"
reRender="secondNameId" />
</h:inputText></td>

<td width="15px">&nbsp;</td>
<td width="80px"><h:outputLabel value="user name "></h:outputLabel></td>
<td width="5px">&nbsp;</td>
<td><h:outputText id="secondNameId"
style="width:240px"
value="#{ideaDetailsBean.addIdeaDto.secondName}"></h:outputText>
</td>
</tr>
</table>
</td>
</tr>


in the backbean:



public void secondIdChange(ActionEvent actionEvent) {
if(addIdeaDto.getSecondId() != null){
addIdeaDto.setSecondName(getParticipantName(addIdeaDto.getSecondId()));
}
}

static String getParticipantName(String employeeId) {
IIMDelegate iimDelegate = new IIMDelegate();
UserInfoDto userInfoDto = new UserInfoDto();
iimDelegate.getParticipant(employeeId);
return userInfoDto.getUserName();
}


in the DAO:



    public UserInfoDto getParticipant(String employeeId) {
Connection connection = null;
PreparedStatement preparedStatement = null;
ResultSet searchResultSet = null;

try {
connection = getConnection();
preparedStatement = connection.prepareStatement(
"SELECT U_NAME FROM APPL_USER WHERE U_LOGIN = ?");
// Assign first value to first parameter
preparedStatement.setString(1, employeeId);
searchResultSet = preparedStatement.executeQuery();
return getParticipant(searchResultSet);

} catch (Exception e) {
throw new RuntimeException(e);
} finally {
try {
searchResultSet.close();

preparedStatement.close();
} catch (SQLException e) {
throw new RuntimeException(e);
}
}
}
private UserInfoDto getParticipant(ResultSet searchResultSet) throws SQLException {
List<UserInfoDto> result = new ArrayList<UserInfoDto>();
UserInfoDto userInfoDto = null;

while (searchResultSet.next()) {
userInfoDto = new UserInfoDto();
userInfoDto.setUserName(searchResultSet.getString(1));
result.add(userInfoDto);
}
return result == null ? null : result.size() > 0 ? result.get(0) :null;
}


Any suggestion to achieve this in different way?







jsf ajax4jsf






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 20 '18 at 8:48









Kukeltje

8,77541338




8,77541338










asked Nov 20 '18 at 7:57









wadha alketbi

274




274












  • Did you debug network traffic in the browser to see what is happening there?
    – Kukeltje
    Nov 20 '18 at 8:48










  • @Kukeltje I didn’t debug
    – wadha alketbi
    Nov 20 '18 at 10:36










  • Please do! (and for my curiosity, why not???)
    – Kukeltje
    Nov 20 '18 at 10:48


















  • Did you debug network traffic in the browser to see what is happening there?
    – Kukeltje
    Nov 20 '18 at 8:48










  • @Kukeltje I didn’t debug
    – wadha alketbi
    Nov 20 '18 at 10:36










  • Please do! (and for my curiosity, why not???)
    – Kukeltje
    Nov 20 '18 at 10:48
















Did you debug network traffic in the browser to see what is happening there?
– Kukeltje
Nov 20 '18 at 8:48




Did you debug network traffic in the browser to see what is happening there?
– Kukeltje
Nov 20 '18 at 8:48












@Kukeltje I didn’t debug
– wadha alketbi
Nov 20 '18 at 10:36




@Kukeltje I didn’t debug
– wadha alketbi
Nov 20 '18 at 10:36












Please do! (and for my curiosity, why not???)
– Kukeltje
Nov 20 '18 at 10:48




Please do! (and for my curiosity, why not???)
– Kukeltje
Nov 20 '18 at 10:48

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53388529%2fa4jsupport-partial-update-before-submit-the-form%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53388529%2fa4jsupport-partial-update-before-submit-the-form%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

"Incorrect syntax near the keyword 'ON'. (on update cascade, on delete cascade,)

Alcedinidae

RAC Tourist Trophy