wood burning stoves 2.0*
The moose likes HTML, CSS and JavaScript and the fly likes Problem with buttons action in jsp page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Problem with buttons action in jsp page " Watch "Problem with buttons action in jsp page " New topic
Author

Problem with buttons action in jsp page

Nora Green
Greenhorn

Joined: Sep 09, 2003
Posts: 7
This is a jsp page on struts-based web application. With this jsp page, buttons work perfectly in IE and Netscape7.0, but these buttons(add and save)do not work at all in Netscape4.7. The redirect action does not work. Could anyone give me some suggestion and comments? Appreciated a lot.
<%-- code start --%>
<%@ page language="java" %>
<%@ taglib uri="/WEB-INF/struts.tld" prefix="struts" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<html>
<head>
<title>Test</title>
</head>
<script language="Javascript">
function submitPage(button){
if (button=='add') {
document.forms[0].action = "../jsp/page1.do?task=add";
document.forms[0].submit();
}
if (button=='save') {
document.forms[0].action = "../jsp/page1.do?task=save";
document.forms[0].submit();
}
}
</script>
<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<html:form action="/jsp/test.do?task=get" name="testForm" type="formbeans.TestForm" scope="session">
<tr>
<td colspan="4"> </td>
</tr>
</html:form>
<tr>
<td colspan="4"> </td>
</tr>
<tr>
<td colspan="3">
<%--THE ADD BUTTON--%>
<html:link href="javascript:submitPage('add')"><html:img srcKey="imgRecSetNav.btnAdd.src" border="0"/></html:link>
<%--THE SAVE BUTTON--%>
<html:link href="javascript:submitPage('save')"><html:img srcKey="imgModFunct.btnSave.src" border="0"/></html:link>
</td>
<td width="19%"> </td>
</tr>
<tr>
<td colspan="4"> </td>
</tr>
</table>
</body>
</html>
<%-- code end --%>
Thanks again,
Nora
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60766
    
  65

Despite appearing within a JSP page, this is clearly an HTML/Javascript question and I'll move this topic along to that forum.
bear


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Nora Green
Greenhorn

Joined: Sep 09, 2003
Posts: 7
Thanks Bear for moving the question here. I am just searching help everywhere. First I posted on struts forum, but one one response yet. It seems a struts action problem, that formbean not submitted in NetScape 4.7. And there is no error message. It works well in IE and Netscape7.0. Thanks,
Nora
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Just a quick glance, not 100% positive, but your buttons are outside your fowm, Netscape 4 might have problems with that. Try to move the form tags to encompass the whole body. aka. place open form tag under body tag and closed form tag over the closed body tag.
Netscape 4.X is picky about format stuff....
Nora Green
Greenhorn

Joined: Sep 09, 2003
Posts: 7
Thank you Eric for the suggestion. I replaced the tag <html:form> </html:form> just below the <body> layer. It is the same result as before.
Nora Green
Greenhorn

Joined: Sep 09, 2003
Posts: 7
The problem was solved! It is because the formbean is empty which has no property inside. We keep the empty formbean to make structure consistent. The Netscape4.7 does not like the empty formbean, then stopping submit the form. Just let you know the result in case you have interested in it.
Nora.
 
Don't get me started about those stupid light bulbs.
 
subject: Problem with buttons action in jsp page
 
Similar Threads
javax.servlet.jsp. JspException: Cannot find message resources under key
buttons do not work in netscape4.7
using Multiple submit buttons.
images not display on Struts forwarding JSP page
Images are not coming in JSP pages