aspose file tools*
The moose likes Struts and the fly likes web container displaying jsp intead of html Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "web container displaying jsp intead of html" Watch "web container displaying jsp intead of html" New topic
Author

web container displaying jsp intead of html

Poonam Jain
Greenhorn

Joined: Nov 03, 2011
Posts: 1
I am beginner to struts and trying to make a simple login application in eclipse with tomcat . I am running tomcat through eclipse .
. Most of the application is working fine . but when the user logins in successfully the the control is forwarded to loggedin.jsp .
The page is not displayed in html .

Would appreciate any help
Thanks



Following are the files

Struts-config.xml


<!-- ========== Form Bean Definitions ============ -->
<form-beans>
<form-bean name="loginForm" type="dummies.struts.LoginForm" />
</form-beans>

<global-forwards>
<forward name="Login12" path="/login.do"/>

</global-forwards>



<!-- ========== Action Mapping Definitions ======== -->
<action-mappings>
<action path="/login"
type="dummies.struts.LoginAction"
name="loginForm"
scope="request"
input="/login.jsp"
validate="true">
<forward name="failure" path="/login.jsp" />
<forward name="success" path="/loggedin.jsp" />
</action>



</action-mappings>


<!-- ========== Message Resources Definitions =========================== -->
<message-resources parameter="ApplicationResources"/>



</struts-config>


index.jsp


<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Login</title>
</head>
<body>

</body>
</html>



<logic:redirect forward="Login12"/>


Login.jsp


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib uri="http://struts.apache.org/tags-html-el" prefix="html-el" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>


<%@ taglib uri ="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>


<html>
<html:html locale ="true" />


<head>

<fmt:setBundle basename="ApplicationResources"/>
<fmt:message key="login.title"/>
</head>
<body>


<html:errors property="login"/>
<html:form action="/login.do" focus="userName">
<table align="center">
<tr align="center">
<td><h1><fmt:message key ="login.message"/></h1></td>
</tr>
<tr align="center">
<td>
<table align ="center">
<tr>
<td align="right">
<fmt:message key="login.username"/>
</td>
<td align ="left">
<html:text property ="userName"
size="15"
maxlength="15" />
<html:errors property="userName" />
</td>
</tr>
<tr>
<td align="right">
<fmt:message key="login.password" />
</td>
<td align="left">
<html:password property="password"
size="15"
maxlength="15"
redisplay="false"/>
<html:errors property="password" />
</td>
</tr>
<tr>
<td colspan="2" align="center">
<html:submit>
<fmt:message key="login.button.signed"/>
</html:submit>
</td>
</tr>
</table>
</td>
</tr>
</table>
</html:form>
</body>
</html>


loggedin.jsp


<%@ page contentType="text/html:charset=UTF-8" language="java"%>


<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-html-el" prefix="html-el" %>
<%@ taglib uri ="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>


<html>
<html:html locale="true"/>

<head>
<fmt:setBundle basename="ApplicationResources"/>
<title><fmt:message key="loggedin.title"/></title>
</head>
<body>
<h2>
<fmt:message key="loggedin.msg">
<fmt:param value='${requestScope.userName}'/>

</fmt:message>

</h2>
</body>
</html>

Display in browser after successful login

<html>
<html lang="en"></html>

<head>

<title>Login Project</title>
</head>
<body>
<h2>
Welcome, ${requestScope.userName}. You are now logged in.

</h2>
</body>
</html>


 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: web container displaying jsp intead of html