Question

I am trying to rename all my JSP files used in WebFlow2 to JSPX.

I go in to my STS project and rename the files to JSPX from JSP then I change the defaultViewSuffix in my flow.xml

[CODE]<bean id="mvcViewFactoryCreator" class=
      "org.springframework.webflow.mvc.builder.MvcViewFactoryCreator">
     <property name="defaultViewSuffix" value=".jspx" />   
  </bean>[/CODE]

this is the error:

[CODE]SEVERE: Servlet.service() for servlet jsp threw exception
org.apache.jasper.JasperException: /WEB-INF/flows/helloworld/helloworld.jspx (line: 1, column: 2) The markup in the document preceding the root element must be well-formed.
[/CODE]

this is my helloworld.jspx

[CODE]<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<html>
<head>
    <title>Spring 3.0 MVC - Web Flow Example</title>
</head>
<body>
    <h2>Customer Registration</h2>

    <form:form commandName="customer">
      <input type="hidden" name="_flowExecutionKey"  value="${flowExecutionKey}"/>
     <table>
     <tr><td>
      <font color=red><form:errors path="name" /></font><b>Name: </b>
       </td><td>
       <form:input path="name"/><br/><p>
      </td></tr><tr><td>
      <font color=red><form:errors path="phoneNumber" /></font>

      <b>Phone number: </b></td><td><form:input path="phoneNumber"/><br/>
      </td></tr><tr><td>
      <font color=red><form:errors path="address" /></font>

      <b>Address: </b></td><td><form:input path="address"/><br/>
      </td></tr><tr><td>
      <font color=red><form:errors path="city" /></font>

      <b>City: </b></td><td><form:input path="city"/><br/>
      </td></tr><tr><td>
      <font color=red><form:errors path="state" /></font>

      <b>State: </b></td><td><form:input path="state"/><br/>

      </td></tr><tr><td>
      <font color=red><form:errors path="zipCode" /></font>
      <b>Zip Code: </b>
      </td><td>
      <form:input path="zipCode"/><br/>
      </td></tr>
      </table>
      <input type="submit" name="_eventId_submit"   value="Submit" />
      <input type="submit" name="_eventId_cancel"    value="Cancel" />
    </form:form>

    </body>
</html>[/CODE]
Was it helpful?

Solution

The syntax for JSPX files (JSPs with the XML syntax) is not the same as for JSP files (JSPs with the traditional syntax). See http://docs.oracle.com/javaee/1.4/tutorial/doc/JSPX3.html for details and examples.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top