prakash. rajeev

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

Recent posts by prakash. rajeev

Hello Everyone,

I am creating a sample application in Struts 2 but i am getting stuck due to some jar file missing used for the taglib.

My Programs are lke this:

My Pojo class:


My Action class:


My first jsp page:

My second jsp page:

My struts.xml:


My web.xml file:



Also I am using these jar files for my application:

struts2-core-2.2.3.jar
srtuts2-convention-plugin-2.2.3.jar
struts2-config-browser-plugin-2.2.3.jar

On deploying my application in Apache Tomcat 7

I am getting this type of error:





Which handler class is the Tomcat server talking about:
For struts-tags.tld file, I already knew that this tld file is stored in
struts2-core-2.2.3.jar file and I am using it too then why am i getting this type of error:


Also, What other jar files do i need for running my application.



Any reply for this topic is highly appreciable............


Thank You



13 years ago
I had integrated struts with spring,
in my web.xml whenever i am giving definition for listener class ,while saving the web.xml it shows error. why?




Any help in this regard is highly appreciable.
14 years ago
Which <generater-class> (in hbm.xml) file is suitable for Oracle.
Hi all,


I am getting the following exception in my project while inserting the data to the database.I am using Struts1 with Hibernate (but no spring ) with Oracle and my connection is established but following error is coming in my Tomcat Console.

The error is like this:





My Bean class is like this:




My hbm.xml file is:



And My Action class in Struts is:





Any help in solving this is highly appreciable.

I am facing trouble in making connection of srtuts1 with hibernate and oracle 11g which is a back end. Do i need spring also for connection establishment and successful CRUD operations of hibernate .How to display the data in webpage from the database ,for this display tag is better or datagrid from struts improve technologies is better?


Please help me out in these regard!
14 years ago
Any good example or turorial and useful website address or urls for how to connect struts1 with hibernate and oracle 11g in Eclipse IDE.


Any help in these regard is highly appreciable.
14 years ago
Is it possible to take input from datagrid.

I want to do this using struts1.

I know struts1 doesn't contain this datagrid functionality.

I came across with datagrid of struts-improve technologies.
that uses data grid.
but i want to know that whether is it possible to take input for various input fields in a datagrid.
I want it in struts1.


Any help in this regard is highly appreciable.
14 years ago
Hi,

I want to add and remove dynamically form elements like textboxes and text areas, in a webpage using struts1.
Suppose i am using a table and that table has five columns which contains three text boxes and two text areas.
I want to generate the rows dynamically for that table and also should be able to remove it dynamically.
For every row it's columns element's property should be different . I want to design this webpage in optimized manner., means i don't need too much coding for generating this type of web page.


I want to do this using struts1,


Any help would be highly appreciable.
14 years ago
Can you give some site addresses or url links that can elaborate in more clear way to me.
14 years ago
Is there any alternative way of implementing double select option of struts2 in struts 1.
I need a either a tutorial or a full example.
Any response for this regard is highly appreciable.
14 years ago
I want to use <html:select> tag as a filter between two select tag.
I want two list boxes in which
first act as a parent to the other list box.

It means
for example one list box contains countries and the other list box contain their respective cities.
So,when i click first list box, like: "India" it should display "delhi,mumbai,kolkata,chennai,bangalore,etc".
or if i click "USA" it should display "Washinton dc,newyork,new jercy,california,las vegas,etc".
Whether i need a backend support also for this.


i want to do this in struts1.
Any solution is highly appreciable.
14 years ago
Mr. sagar, thank you for your reply,
i have solved my problem.
actually error was in the value of the property attribute of code.It was not matching with the variable declared in loginform.java class.
14 years ago
Mr.Rohan, Can you please elaborate your statement.
14 years ago
right now i am getting this exception by tomcat:

type Exception report

message

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

exception

org.apache.jasper.JasperException: An exception occurred processing JSP page /login.jsp at line 18

15: <h2>Task Management System</h2>
16: <hr>
17: <html:errors property="login" />
18: <html:form action="/login.do" method="post" focus="userName"><br />
19: Login: <html:text property="userName" name="LoginForm" maxlength="25"/><br />
20: Password: <html:password property="userName" name="LoginForm" /><br/>
21: <html:submit value="Login"/> 


Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:401)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)


root cause

javax.servlet.ServletException: javax.servlet.jsp.JspException: Cannot retrieve definition for form bean /LoginForm on action /login.do
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:862)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:791)
org.apache.jsp.login_jsp._jspService(login_jsp.java:109)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)


root cause

javax.servlet.jsp.JspException: Cannot retrieve definition for form bean /LoginForm on action /login.do
org.apache.struts.taglib.html.FormTag.lookup(FormTag.java:767)
org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:443)
org.apache.jsp.login_jsp._jspx_meth_html_005fform_005f0(login_jsp.java:149)
org.apache.jsp.login_jsp._jspService(login_jsp.java:98)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)


note The full stack trace of the root cause is available in the Apache Tomcat/6.0.24 logs.

14 years ago
hi, i am new to sruts ..
i am using eclipse ganymede 3.4.2 along with tomcat 6.0.24, and struts 1.3.1

on a validation form in login.jsp following exception are shown by the apache tomcat

type Exception report

message

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

exception

org.apache.jasper.JasperException: java.lang.NullPointerException: Module 'null' not found.
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:491)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:419)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)


root cause

java.lang.NullPointerException: Module 'null' not found.
org.apache.struts.taglib.TagUtils.getModuleConfig(TagUtils.java:755)
org.apache.struts.taglib.TagUtils.getModuleConfig(TagUtils.java:735)
org.apache.struts.taglib.html.FormTag.lookup(FormTag.java:818)
org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:488)
org.apache.jsp.login_jsp._jspx_meth_html_005fform_005f0(login_jsp.java:149)
org.apache.jsp.login_jsp._jspService(login_jsp.java:98)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)


note The full stack trace of the root cause is available in the Apache Tomcat/6.0.24 logs.

Here are

my login.jsp page :

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ taglib uri="/WEB-INF/tld/struts-html.tld" prefix="html" %>
<%@taglib uri="/WEB-INF/tld/struts-logic.tld" prefix="logic" %>
<%@taglib uri="/WEB-INF/tld/struts-bean.tld" prefix="bean" %>
<!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=ISO-8859-1">
<title>eTask</title>
</head>

<body bgcolor="blue">

<h1>Login Form</h1>
<hr>
<html:errors property="login" />
<html:form action="/login" method="post" focus="userName"><br />
Login: <html:text property="userName" name="LoginForm" maxlength="25"/><br />
Password: <html:password property="userName" name="LoginForm" />
<html:submit value="Login"/>
<html:reset/>
</html:form>

</body>
</html>

my struts-config.xml

<?xml version="1.0" encoding="ISO-8859-1" ?>


<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.3//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_3.dtd">




<struts-config>


<form-beans>
<form-bean name="LoginForm" type="e.task.LoginForm"/>
</form-beans>






<!-- =========================================== Global Forward Definitions -->

<global-forwards>

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


<!-- =========================================== Action Mapping Definitions -->

<action-mappings>

<action path="/login" forward="/login.jsp" />
<action
path="/login" name="/LoginForm"
type="e.task.LoginAction" scope="request"
validate="true" input="/login.jsp" parameter=" /login.jsp">
<forward name="success" path="/index.jsp"/>
<forward name="failure" path="/login.jsp"/>
</action>
</action-mappings>


<!-- ======================================== Message Resources Definitions -->

<message-resources parameter="/MessageResources" null="false" />


<!-- =============================================== Plug Ins Configuration -->

<!-- =================================================== Validator plugin -->

<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
<set-property
property="pathnames"
value="/WEB-INF/validator-rules.xml,
/WEB-INF/validation.xml"/>
</plug-in>

</struts-config>


my web.xml

<?xml version="1.0" encoding="ISO-8859-1"?>


<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>
<display-name>Struts Blank Application</display-name>

<!-- Standard Action Servlet Configuration -->
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>


<!-- Standard Action Servlet Mapping -->
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>


<!-- The Usual Welcome File List -->
<welcome-file-list>
<welcome-file>login.jsp</welcome-file>
</welcome-file-list>

</web-app>
my validation.xml
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<!DOCTYPE form-validation PUBLIC
"-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.3.0//EN"
"http://jakarta.apache.org/commons/dtds/validator_1_3_0.dtd">

<form-validation>

<!--
This is a minimal Validator form file with a couple of examples.
-->

<global>

<!-- An example global constant
<constant>
<constant-name>postalCode</constant-name>
<constant-value>^\d{5}\d*$</constant-value>
</constant>
end example-->

</global>

<formset>

<!-- An example form -->
<form name="logonForm">
<field
property="username"
depends="required">
<arg key="logonForm.username"/>
</field>
<field
property="password"
depends="required,mask">
<arg key="logonForm.password"/>
<var>
<var-name>mask</var-name>
<var-value>^[0-9a-zA-Z]*$</var-value>
</var>
</field>
</form>

</formset>

<!-- An example formset for another locale -->
<formset language="fr">

<constant>
<constant-name>postalCode</constant-name>
<constant-value>^[0-9a-zA-Z]*$</constant-value>
</constant>

<!-- An example form -->
<form name="logonForm">
<field
property="username"
depends="required">
<arg key="logonForm.username"/>
</field>
<field
property="password"
depends="required,mask">
<arg key="logonForm.password"/>
<var>
<var-name>mask</var-name>
<var-value>^[0-9a-zA-Z]*$</var-value>
</var>
</field>
</form>

</formset>

</form-validation>





i have included these file in WEB-IN/lib




antlr.jar
cglib-nodep-2.1_3.jar
commons-beanutils.jar
commons-chain-1.2.jar
commons-collections-3.1.jar
commons-digester.jar
commons-fileupload.jar
commons-lang-2.1.jar
commons-logging.jar
commons-validator.jar
csv.jar
displaytag-1.1.jar
displaytag-export-poi-1.1.jar
displaytag-portlet-1.1.jar
dom4j-1.6.jar
ehcache-1.1.jar
hibernate3.jar
itext-1.3.jar
jakarta-oro.jar
jstl-1.1.2.jar
jta.jar
jtds-1.2.jar
log4j-1.2.12.jar
oro-2.0.8.jar
poi-2.5.1.jar
servlet.jar
spring.jar
spring.tld
spring-aop.jar
spring-beans.dtd
spring-beans.jar
spring-context.jar
spring-core.jar
spring-dao.jar
spring-hibernate.jar
spring-jdbc.jar
spring-mock.jar
spring-orm.jar
spring-remoting.jar
spring-support.jar
spring-web.jar
spring-webmvc.jar
standard-1.0.6.jar
struts.jar
struts-taglib-1.3.10.jar
struts-tiles-1.3.10.jar

i have included these tld files in
WEB-INF/tld folder in my project

struts-bean.tld
struts-html.tld
struts-logic.tld


my MessageResources.properties


# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# -- standard errors --
errors.header=<font color="red">
#errors.prefix=<LI>
#errors.suffix=</LI>
errors.footer=</font>
# -- validator --
errors.invalid={0} is invalid.
errors.maxlength={0} can not be greater than {1} characters.
errors.minlength={0} can not be less than {1} characters.
errors.range={0} is not in the range {1} through {2}.
#---------------------------------------------
errors.userName.required=UserName is required.
errors.password.required=Password is required.
errors.login.invalid=The system couldnot verify your username and password.
Is your CAPS Lock ON?
Please try again.
#---------login page text----------------------
login.title= Login Please.
login.message=Please Login!
login.username=username.
login.password=password.

login.button.signon=Log In.
#-------------------------------------------
label.username=Login.
label.password=Password.
label.welcome=Welcome.

#--------------------------------------------
index.title=eTask Project
index.message=welcome,[0].

errors.byte={0} must be an byte.
errors.date={0} is not a date.
errors.double={0} must be an double.
errors.float={0} must be an float.
errors.integer={0} must be an integer.
errors.long={0} must be an long.
errors.short={0} must be an short.
errors.creditcard={0} is not a valid credit card number.
errors.email={0} is an invalid e-mail address.
# -- other --
errors.cancel=Operation cancelled.
errors.detail={0}
errors.general=The process did not complete. Details should follow.
errors.token=Request could not be completed. Operation is not in sequence.
# -- welcome --
welcome.title=Struts Blank Application
welcome.heading=Welcome!
welcome.message=To get started on your own application, copy the struts-blank.war to a new WAR file using the name for your application. Place it in your container's "webapp" folder (or equivalent), and let your container auto-deploy the application. Edit the skeleton configuration files as needed, restart your container, and you are on your way! (You can find the MessageResources.properties file with this message in the /WEB-INF/src folder.)

my LoginAction.java
package e.task;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


import org.apache.struts.action.Action;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;

public class LoginAction extends Action {

private final static String SUCCESS = "success";
private final static String FAILURE= "failure";

public ActionForward execute(ActionMapping mapping,ActionForm form,
HttpServletRequest request,HttpServletResponse response) throws Exception
{
LoginForm loginForm=(LoginForm) form;
if(loginForm.getUserName().equals(loginForm.getPassword()))
{
return mapping.findForward(SUCCESS);
}
else
{
return mapping.findForward(FAILURE);
}
}
}


my LoginForm.java

package e.task;
import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;
public class LoginForm extends ActionForm {
/**
*
*/
private static final long serialVersionUID = -3720711292263799990L;
private String userName;
private String password;

public String getUserName() {
return userName;
}

public void setUserName(String userName) {
this.userName = userName;
}

public String getPassword() {
return password;
}

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

public void reset(ActionMapping mapping,HttpServletRequest request)
{
password=" ";
userName=" ";
}

public ActionErrors validate(ActionMapping mapping,HttpServletRequest request)
{
ActionErrors errors=new ActionErrors();
if(userName==null||userName.length()<1)
{
errors.add("userName",new ActionMessage("errors.userName.required"));
}
if (password==null||password.length()<1)
{
errors.add("password",new ActionMessage("errors.password.required"));
}
return errors;
}

}

14 years ago