How to pop out warning? [closed] - java

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
if(btnSubmit.equals("Submit")){
if(checkdata()== true){
InsertData();
url = "/mimy/Dbtable.jsp";
}
else{
out.println("Fill up all the field");
url = "/mimy/Register.jsp";
}
}
The following codes are the options I have tried to ensure that the user fill in all the fields of the form. If the user does not fill in any of the field,a pop up statement should be displayed. But the code above is not working. How can I work this out?

out.println won't pop up anything. Write Javascript code to pop up message.
e.g. alert("fill up all fields "); in javascript

This worries me:
if(btnSubmit.equals("Submit")){
Is your btnSubmit really a String? Somehow I doubt it. Somehow I think that it's a button of some kind.

Related

xpath is not working, i need a unique id to identify the element [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
i need a unique id to identify the text field(start - press)(end - press) mention in the below image
there is no id, name or class to identify them
this is the xml code seen in inspect element.
Try using
//input[contains(#placeholder,'Start')]
or
//div[#class="leaflet-routing-geocode"]/input
i think
By.cssSelector("input[placeholder=\"Start - press enter to drop
marker\"]")
...ought to work

Should I check if a text field has text and then clean it or directly clean it? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
So the question is basically if to have
getDriver().findElement(by).clear();
or to have
String text = getDriver().findElement(by).getText();
if (!text.equals(""))
getDriver().findElement(by).clear();
and after that a sendKeys.
Note: Most of the times, the field is empty.
This is simple math
getDriver().findElement(by).clear();
Costs as
getDriver().findElement(by).getText();
To the second line you add an if check and maybe getDriver().findElement(by).clear(); anyway.
So just call clear() without a check.

can we check that text in password field is displayed masked? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
Can we verify whether the text which is written in PASSWORD field is being displayed in masked format or not?
Here is an idea (assuming that you're using WebDriver driver):
WebElement input = driver.findElement(By.id("..."));
boolean isEncrypted = input.getAttribute("type").equals("password");
You'll need to replace the ... with the exact value of the password input box ID.

Can I put an ActionListener on a TextArea? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
Is there a way I can set a listener for if the TextArea is edited by the user?
If that is not possible, can I add one to its focus?
Get the document the text area is using via textArea.getDocument()
Then write a document listener. The document listener will tell you whenever the user edits the text area.

Programming a reset button? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I'm currently making a mortgage calculator, but I need some help. I have a reset button on my GUI that makes all of the forms blank again after typing something into them. The IDE already helped me make the button, so here is where I'm at:
private void resetActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
What do I need to put in here?
You either recreate your complete GUI (probably not an option), or painstakingly use .setText("") against each and every input field you have, and similar logic for radio buttons, etc. There's no royal way to it, unfortunately.

Categories

Resources