aspose file tools*
The moose likes Servlets and the fly likes How to displays pop up message when error occurs? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "How to displays pop up message when error occurs?" Watch "How to displays pop up message when error occurs?" New topic
Author

How to displays pop up message when error occurs?

Timotius Pamungkas
Greenhorn

Joined: Feb 26, 2005
Posts: 28
Hi all,

I'd like to know if there any way to display pop up window contains error message? I can do it with javascript embedded in jsp, but I wonder if I can use pure java (I mean, without javascript at all).

For example, please examine following snippet :

public void doGet(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException {
try {
String fullName = request.getParameter(ApplicantEntryConstant.PARAM_FULL_NAME);

if (fullName == null || fullName.length() == 0) {
// show pop up message contains string
// "Full name must be filled"
}
} catch (SQLException ex) {
logger.getLogger().error("Error inserting applicant");
}
}
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61623
    
  67

No Javascript == no client-side activity


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4968
    
    1

JavaScript, or perhaps havinga link open up in a new parent window, are pretty much the only way to get things to pop-up. Simple Java won't be able to do it.

-Cameron McKenzie
Timotius Pamungkas
Greenhorn

Joined: Feb 26, 2005
Posts: 28
So I must use javascript, whether I like it or not, for such client-side activity?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61623
    
  67

Yes. JSP and servlet technology is just a server-side mechanism to create dynamically generated HTML pages to send to the browser.

Regardless of what happens on the server, a good old fashioned HTML page is still sent to the browser so there's no magic to make the browsers do anything other than what they know: HTML and Javascript.
Timotius Pamungkas
Greenhorn

Joined: Feb 26, 2005
Posts: 28
OK guys, thanks for your explanations.
 
 
subject: How to displays pop up message when error occurs?