Help coderanch get a
new server
by contributing to the fundraiser

theju nagral

Greenhorn
+ Follow
since Mar 12, 2010
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by theju nagral

Hi Lorand Komaromi
I am very much new to struts
please can you elaborate...
14 years ago
web.xml


struts-config.xml


index.jsp

Welcome.jsp


Layout.jsp

header.jsp


footer.jsp

menu.jsp


I am getting the following error
-----------------------------------------------------------------
HTTP Status 404 - Servlet action is not available

type Status report

message Servlet action is not available

description The requested resource (Servlet action is not available) is not available.
Apache Tomcat/5.5.25
-------------------------------------------------------------
Please can anyone help me out with this
14 years ago
HTTP Status 500 -

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: Failed to load or instantiate TagExtraInfo class: org.apache.struts.taglib.tiles.UseAttributeTei
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:51)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:409)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:281)
org.apache.jasper.compiler.TagLibraryInfoImpl.createTagInfo(TagLibraryInfoImpl.java:423)
org.apache.jasper.compiler.TagLibraryInfoImpl.parseTLD(TagLibraryInfoImpl.java:249)
org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:163)
org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:424)
org.apache.jasper.compiler.Parser.parseDirective(Parser.java:493)
org.apache.jasper.compiler.Parser.parseElements(Parser.java:1557)
org.apache.jasper.compiler.Parser.parse(Parser.java:127)
org.apache.jasper.compiler.ParserController.doParse(ParserController.java:212)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:101)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:156)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:296)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:277)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:265)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:564)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:302)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

root cause

java.lang.ClassNotFoundException: org.apache.struts.taglib.tiles.UseAttributeTei
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1362)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1208)
org.apache.jasper.compiler.TagLibraryInfoImpl.createTagInfo(TagLibraryInfoImpl.java:420)
org.apache.jasper.compiler.TagLibraryInfoImpl.parseTLD(TagLibraryInfoImpl.java:249)
org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:163)
org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:424)
org.apache.jasper.compiler.Parser.parseDirective(Parser.java:493)
org.apache.jasper.compiler.Parser.parseElements(Parser.java:1557)
org.apache.jasper.compiler.Parser.parse(Parser.java:127)
org.apache.jasper.compiler.ParserController.doParse(ParserController.java:212)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:101)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:156)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:296)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:277)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:265)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:564)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:302)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

note The full stack trace of the root cause is available in the Apache Tomcat/5.5.25 logs.
14 years ago
Here is the code

struct-config.xml

---------------------------------------------------
login.jsp

--------------------------------------------------------------------------------------
success.jsp

-------------------------------------------------------------------------------
login form

---------------------------------------------------------------------
login action

------------------------------------------------
when i try to login it is not going to success.jsp page. instead it is showing me a blank page with url
http://localhost:8080/oxy/login.do

is there anything wrong in my program

========================
i am using tiles in my program

14 years ago
struct-config.xml

<struts-config>

<form-beans>

<form-bean name="loginForm"
type="app.LoginForm"/>

</form-beans>

<global-forwards>
<forward name="welcome"
path="/Welcome.do"/>

</global-forwards>


<action-mappings>
<action path="/Welcome"
forward="/pages/Home.jsp"/>

<action path="/login"
type="app.LoginAction"
name="loginForm"
scope="request"
validate="true"
input="/pages/Login.jsp">
<forward name="success"
path="/pages/success.jsp"/>
</action>

</action-mappings>

<controller
processorClass="org.apache.struts.tiles.TilesRequestProcessor"/>



<message-resources parameter="MessageResources" />


<plug-in className="org.apache.struts.tiles.TilesPlugin" >
<set-property property="definitions-config"
value="/WEB-INF/tiles-defs.xml" />

<set-property property="moduleAware" value="true" />
</plug-in>

</struts-config>
---------------------------------------------------
login.jsp

<%@ page language="java" pageEncoding="ISO-8859-1"%>
<%@ page language="java" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<HTML>
<HEAD>
<TITLE>Sign in, Please!</TITLE>
</HEAD>
<BODY>
<html:errors/>
<html:form action="/login">
<TABLE border="0" width="100%">
<TR>
<TH align="right"><FONT SIZE="5">Username:</FONT></TH>
<TD align="left"><html:text property="username"/></TD>
</TR>
<TR>
<TH align="right"><FONT SIZE="5">Password:</FONT></TH>
<TD align="left"><html:password property="password"/></TD>
</TR>
<TR>
<TD align="right"><html:submit/></TD>
<TD align="right"><html:reset/></TD>
</TR>
</TABLE>
</html:form>
</BODY>
</HTML>
--------------------------------------------------------------------------------------
success.jsp

<html>
<body>
<h1> successfully logged in</h1>
</body>
</html>
-------------------------------------------------------------------------------
login form

package app;

import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;

public final class LoginForm extends ActionForm {
private String password = null;
private String username = null;

public String getUsername() {
return (this.username);
}
public void setUsername(String username) {
this.username = username;
}

public String getPassword() {
return (this.password);
}
public void setPassword(String password) {
this.password = password;
}

}

}
---------------------------------------------------------------------
login action

package app;


import java.io.IOException;
import java.sql.SQLException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
//import org.apache.struts.action.ActionServlet;

import app.dao.mydao.dao;


public final class LoginAction extends Action {

public boolean isUserLogin(String username, String password)
{
dao t2=new dao();
String pass=null;
try
{
pass=t2.select(username);
}
catch (SQLException e)
{
e.printStackTrace();
}

if (password.equals(pass))
return true;
else
return false;
}



public ActionForward perform(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException {

String username = ((LoginForm) form).getUsername();
String password = ((LoginForm) form).getPassword();



boolean validated = false;
try
{
validated = isUserLogin(username,password);
}

catch (Exception e) {
ActionErrors errors = new ActionErrors();
errors.add(ActionErrors.GLOBAL_ERROR,
new ActionError("error.logon.connect"));
saveErrors(request,errors);
return (new ActionForward(mapping.getInput()));
}

return (mapping.findForward("success"));

}

}
------------------------------------------------
when i try to login it is not going to success.jsp page. instead it is showing me a blank page with url
http://localhost:8080/oxy/login.do

is there anything wrong in my program

14 years ago