Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem With <html:form> name property not being rendered

Status
Not open for further replies.

vicmundim

Programmer
Aug 11, 2003
2
BR
Hi, I´m having problems with the <html:form> tag in struts 1.27

I´ve made a simple JSP:

Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">[/URL]

<%@ taglib uri="[URL unfurl="true"]http://struts.apache.org/tags-html"[/URL] prefix="html" %>
<%@ taglib uri="[URL unfurl="true"]http://struts.apache.org/tags-bean"[/URL] prefix="bean" %>

<html:html xhtml="true">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
	<title>Simple Form</title>
</head>
<body>

<html:form action="simple.do">
	<html:text property="user" />
	<html:submit value="Submit" />
</html:form>

</body>
</html:html>

My struts-config.xml is:

Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE struts-config PUBLIC
          "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN"
"[URL unfurl="true"]http://jakarta.apache.org/struts/dtds/struts-config_1_2.dtd">[/URL]
<struts-config>
	<form-beans>
		<form-bean
			name="simple"
			type="simple.SimpleForm" />
	</form-beans>
    <global-exceptions>
    </global-exceptions>

    <global-forwards>
    </global-forwards>
         <action-mappings>
		<action
			path="/simple"
			type="simple.SimpleAction"
			name="simple"
			scope="session"
			input="/simple_form.jsp"
			unknown="false"
			validate="false" >
			<forward name="go"   path="/simple_form.jsp"/>
		</action>
	</action-mappings>
</struts-config>

But the rendered HTML code of this JSP is as follow:

Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">[/URL]




<html xmlns="[URL unfurl="true"]http://www.w3.org/1999/xhtml"[/URL] lang="pt-BR" xml:lang="pt-BR">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
	<title>Simple Form</title>
</head>
<body>

<form method="post" action="/test-struts/simple.do">
	<input type="text" name="user" value="" />
	<input type="submit" value="Submit" />
</form>

</body>
</html>

Note that the form name property isn´t rendered. And in struts 1.2.x the name property is not valid anymore. The correct behavior should be the form name property coming from the actionmapping in struts-config.xml, but its not happening. What I do wrong?
 
I´ve think this is a bug, because when I´ve removed the xhtml=true property of <html:html> the JSP renders the name property in the form. I think this is an unexpected behavior since xhtml would accept the name property on a <form> tag, I´ve checked this in the w3c site.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top