Hi,
I am trying to run a struts 1.1 login example in RAD 7.0 within websphere 6.1 server. My code looks as follows. It has simple form, action, three simple jsps and a validation. When i try to run it giving error saying 'unable to locate tag library tags-html as in attachment
ApplicationResources.prope
rties looks like
# Resources for parameter 'com.myeclipseide.example.
struts.App
licationRe
sources'
# Project StrutsLoginExample
error.name.required=User Name Required
error.password.required=Pa
ssword Required
error.name.myeclipse=Pleas
e enter MyEclipse1 as the User Name
error.password.myeclipse=P
lease enter MyEclipse2 as the Password
index.jsp looks like
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"
http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>MyEclipse Struts Login Example</title>
</head>
<body>
<h1>
MyEclipse Struts Login Example Project
</h1>
<div
style="padding-left: 5px; padding-top: 10px; padding-bottom: 10px; background: #f0f0f0">
<b><a href="userLogin.jsp">Click
here</a> to begin testing this
example</b>
</div>
<h2>
Description
</h2>
A tutorial showing how to develop a simple login-style Struts application.
<br>
<h2>
Requirements
</h2>
MyEclipse 6.0 or a previous version of MyEclipse with an application
server that the project can be deployed to and run.
<h2>
How to Run
</h2>
You can right-click on this project and go to Debug As or Run As then select
"MyEclipse Server Application". MyEclipse 6.0 and later will automatically deploy
the application to the MyEclipse Tomcat Server, then start it up and open
a browser window for you to the index.jsp page.
<br>
<h2>
Related Links
</h2>
<ul>
<li>
MyEclipse Web Project Tutorial -
<a href="
http://www.myeclipseide.com/documentation/quickstarts/webprojects/">
http://www.myeclipseide.com/documentation/quickstarts/webprojects/</a>
</li>
<li>
MyEclipse Application Server Tutorial -
<a href="
http://www.myeclipseide.com/documentation/quickstarts/appservers/">
http://www.myeclipseide.com/documentation/quickstarts/appservers/</a>
</li>
<li>
MyEclipse Struts 1.x Tutorial -
<a href="
http://www.myeclipseide.com/documentation/quickstarts/struts/">
http://www.myeclipseide.com/documentation/quickstarts/struts/</a>
</li>
</ul>
<h2>
Feedback
</h2>
We hope you found this example project helpful. If you ran into any
problems
<br>
while working with the example project, please feel free to post to
our Example
<br>
Project Forum (
<a href="
http://www.myeclipseide.com/PNphpBB2-viewforum-f-54.html">
http://www.myeclipseide.com/PNphpBB2-viewforum-f-54.html</a>)
and
<br>
let us know. Also if you had any suggestions for improvements, noticed
something
<br>
wrong or just wanted to ask questions we encourage you to post and let
us know!
</body>
</html>
userLogin.jsp looks like
<%@ page language="java" pageEncoding="ISO-8859-1"%
>
<%@ taglib uri="
http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="
http://struts.apache.org/tags-html" prefix="html"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html:html lang="true">
<head>
<html:base />
<title>JSP for UserLoginForm form</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control"
content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2
,keyword3"
>
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<body>
<html:form action="/userLogin">
<table border="1" cellpadding="4">
<tbody>
<tr>
<td align="right">
User Name:
</td>
<td>
<html:text property="userName" />
</td>
<td>
<html:errors property="userName" />
</td>
</tr>
<tr>
<td align="right">
Password:
</td>
<td>
<html:password property="password" />
</td>
<td>
<html:errors property="password" />
</td>
</tr>
<tr>
<td>
</td>
<td>
<html:submit />
<html:cancel />
</td>
</tr>
</tbody>
</table>
</html:form>
</body>
</html:html>
userLoginSuccess looks like
<%@ page language="java" pageEncoding="ISO-8859-1"%
>
<%@ taglib uri="
http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="
http://struts.apache.org/tags-html" prefix="html" %>
<%@ taglib uri="
http://struts.apache.org/tags-logic" prefix="logic" %>
<%@ taglib uri="
http://struts.apache.org/tags-tiles" prefix="tiles" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html:html>
<head>
<title>My Struts 'userLoginSuccess.jsp' ending page</title>
</head>
<body>
Hello <bean:write name="userName" scope="request" />, you successfully logged in!
</body>
</html:html>
struts-config looks like
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.3//EN" "
http://struts.apache.org/dtds/struts-config_1_3.dtd">
<struts-config>
<form-beans>
<form-bean name="userLoginForm"
type="com.myeclipseide.exa
mples.stru
ts.form.Us
erLoginFor
m" />
</form-beans>
<global-exceptions />
<global-forwards />
<action-mappings>
<action attribute="userLoginForm" input="/userLogin.jsp"
name="userLoginForm" path="/userLogin" scope="request"
validate="true"
type="com.myeclipseide.exa
mples.stru
ts.action.
UserLoginA
ction">
<forward name="success" path="/userLoginSuccess.js
p" />
<forward name="failure" path="/userLogin.jsp" />
</action>
</action-mappings>
<message-resources
parameter="com.myeclipseid
e.examples
.struts.Ap
plicationR
esources" />
</struts-config>
web.xml looks like
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="
http://java.sun.com/xml/ns/javaee"
xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance" version="2.5"
xsi:schemaLocation="
http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<servlet>
<servlet-name>action</serv
let-name>
<servlet-class>
org.apache.struts.action.A
ctionServl
et
</servlet-class>
<init-param>
<param-name>config</param-
name>
<param-value>/WEB-INF/stru
ts-config.
xml</param
-value>
</init-param>
<init-param>
<param-name>debug</param-n
ame>
<param-value>3</param-valu
e>
</init-param>
<init-param>
<param-name>detail</param-
name>
<param-value>3</param-valu
e>
</init-param>
<load-on-startup>0</load-o
n-startup>
</servlet>
<servlet-mapping>
<servlet-name>action</serv
let-name>
<url-pattern>*.do</url-pat
tern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.jsp</w
elcome-fil
e>
</welcome-file-list>
</web-app>
UserLoginAction looks like
package com.myeclipseide.examples.
struts.act
ion;
import javax.servlet.http.HttpSer
vletReques
t;
import javax.servlet.http.HttpSer
vletRespon
se;
import org.apache.struts.action.A
ction;
import org.apache.struts.action.A
ctionForm;
import org.apache.struts.action.A
ctionForwa
rd;
import org.apache.struts.action.A
ctionMappi
ng;
import com.myeclipseide.examples.
struts.for
m.UserLogi
nForm;
public class UserLoginAction extends Action {
@Override
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
UserLoginForm userLoginForm = (UserLoginForm) form;
if (userLoginForm.getUserName
().equalsI
gnoreCase(
"myeclipse
1")
&& userLoginForm.getPassword(
).equalsIg
noreCase("
myeclipse2
")) {
request.setAttribute("user
Name", userLoginForm.getUserName(
));
return mapping.findForward("succe
ss");
}
return mapping.findForward("failu
re");
}
}
userLoginForm looks like
package com.myeclipseide.examples.
struts.for
m;
import javax.servlet.http.HttpSer
vletReques
t;
import org.apache.struts.action.A
ctionError
s;
import org.apache.struts.action.A
ctionForm;
import org.apache.struts.action.A
ctionMappi
ng;
import org.apache.struts.action.A
ctionMessa
ge;
public class UserLoginForm extends ActionForm {
private static final long serialVersionUID = 1L;
private String password;
private String userName;
@Override
public ActionErrors validate(ActionMapping mapping,
HttpServletRequest request) {
ActionErrors errors = new ActionErrors();
if (getUserName() == null || getUserName().length() < 1) {
errors.add("userName", new ActionMessage("error.name.
required")
);
} else if (!getUserName().equalsIgno
reCase("my
eclipse1")
) {
errors.add("userName", new ActionMessage("error.name.
myeclipse1
"));
}
if (getPassword() == null || getPassword().length() < 1) {
errors
.add("password", new ActionMessage(
"error.password.required")
);
} else if (!getPassword().equalsIgno
reCase("my
eclipse2")
) {
errors.add("password",
new ActionMessage("error.passw
ord.myecli
pse2"));
}
return errors;
}
@Override
public void reset(ActionMapping mapping, HttpServletRequest request) {
password = null;
userName = null;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
}
Any ideas, suggestions, sample code, links highly appreciated. Thanks in advance.