• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

web container displaying jsp intead of html

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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>


 
This tiny ad is guaranteed to be gluten free.
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic