Struts1
Hi, I am sort of new to struts....
On setting taglib in index.jsp.....
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>.....
Following error encounters..... plz help me out of this....
rg.apache.jasper.JasperException: The absolute uri: http://struts.apache.org/tags-html cannot be resolved in either web.xml or the jar files deployed with this application
at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:51)
at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:409)
at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:116)
at org.apache.jasper.compiler.TagLibraryInfoImpl.generateTLDLocation(TagLibraryInfoImpl.java:315)
at org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:148)
at org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:431)
at org.apache.jasper.compiler.Parser.parseDirective(Parser.java:494)
at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1444)
at org.apache.jasper.compiler.Parser.parse(Parser.java:138)
at org.apache.jasper.compiler.ParserController.doParse(ParserController.java:216)
at org.apache.jasper.compiler.ParserController.parse(ParserController.java:103)
at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:154)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:315)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:295)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:282)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:586)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
can you plz specify : The uri specified should match the one specified in jsp
web.xml is already posted there.... following is my index.jsp......
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<!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>Insert title here</title>
</head>
<body>
<html:form action="Lookup">
<table>
<TR>
<TD>Symbol :</TD>
<TD><html:text property="symbol"></html:text></TD>
</TR>
<tr>
<td colspan="2" align="center"><html:submit /></td>
</tr>
</table>
</html:form>
</body>
</html>
and web.xml....
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="WebApp_ID" version="2.5">
<display-name>ch03app</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<!-- Struts tag library descriptors -->
<jsp-config>
<taglib>
<taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-html.tld</taglib-location>
</taglib>
</jsp-config>
<!-- Standard ActionServlet Config -->
<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>1</load-on-startup>
</servlet>
<!-- Standard ActionServlet Mapping -->
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
</web-app>
Similar Messages
-
What is difference between struts1.1 and struts1.2?
hai
what is difference between struts1.1 and struts1.2> hai,this is shastry pls can u tell me the diff
between struts1.1 and struts1.2
http://struts.apache.org/1.2.4/userGuide/release-notes.html
~ -
Validating id and password against rdbms using struts1.1
hi
in our current project we r using struts1.1. in my action class i have to validate the login id and password against database, iam also using DAO pattern my DAO is a java bean.
so pls help me to validate loginid and password against database using DAO pattern.
thanksHi,
You can use OJB (http://db.apache.org/ojb/). We are using OJB with Structs and work perfectly, you can check it or look for other equivalents.
Of course, you can program your own DAO pattern, but I recommend you try this software.
Good luck,
Gerardo -
Please help to integrate struts1 into weblogic portal
I'm a newbie in weblogic portal, so much documents for me on Oracle's website, but I didn't know where 's startup? please help on this :)
1. Weblogic Portal: I could connect to jdbc datasource (using ms sqlserver 2005) and created database successfully. But I didn't how to my application can get data (from database), e.g. using portlet to connect? I'm really need to help to get data from db, and display it, please help understand it.
2. I had a existing struts1 project (spring + struts1 + hibernate + ms sqlserver), this project could connect and get data from database. And I implemented the following guide on oracle's website, but I faced with so much problem, please help me clearly on integration struts1 in weblogic portal, what's required? if can, please step by step.
Thanks in advance,
NhanJava Message Service (JMS) is a standard API for accessing enterprise messaging systems.
And WebLogic JMS is an enterprise-class messaging system that is tightly integrated into the WebLogic Server platform. It fully supports the JMS Specification.
Please refer to the following links to get more information on this and how to configure the jms resources:
http://docs.oracle.com/cd/E15051_01/wls/docs103/jms/fund.html
http://middlewaremagic.com/weblogic/?page_id=1976
Thanks,
Patrick -
Struts1 ear app is not invoked in weblogic10.3.4 same works in 10.3.0
Hi,
I have an exploded ear which is a a struts 1 application. I have deployed it on Weblogic 10.3.0. and same is deployed on Weblogic10.3.4 also.
Now when I try to invoke it on 10.3.4, I get "Error 404--Not Found", But the same can be invoked in 10.3.0 and I have made no changes in it.
I am using struts action as welcome page as :
<welcome-file-list>
<welcome-file>security/loginInit.do</welcome-file>
</welcome-file-list>
I think something is wrong with Weblogic 10.3.4 and struts1.
Please help.Hi --
Thanks for the update, glad you have it working.
Just wanted to fill in some more information.
According to the Java EE 5 specification, if you have an empty context-root entry in application.xml the following applies:
>
Assign a context root for each web module included in the Java EE application. The context root is a relative name in the web namespace for the application. Each web module must be given a distinct and non- overlapping name for its context root. The web modules will be assigned a complete name in the namespace of the web server at deployment time. If there is only one web module in the Java EE application, the context root may be the empty string. If no deployment descriptor is included in the application package, the context root of the web module will be the name of the web module file relative to the root of the application package, with the .war extension removed. See the servlet specification for detailed requirements of context root naming.
>
So it should be possible to have <context-root></context-root> as you had.
I haven't tested it, but I presume if this is the case, then the actual context-root that is assigned will be the name of the web module war file, minus the .war extension. You have "Web" (no .war?) as the web-uri, so presumably the context-root for your application in this case would be "/Web".
cheers
-steve- -
What is the difference bitween struts1.1 and struts1.2
Hai please telme the difference between the struts1.1 and 1.2
Hi please read the Struts release notes and documentation.
-
Error while integrating Struts1.2.9 with Hibernate on WEBLOGIC 8.1 sp2
Hi,
I am trying to use Hibernate in my application but while integration struts with Hibernate i m getting the following error
<Error> <HTTP> <BEA-101216> <Servlet: "action" fail
ed to preload on startup in Web application: "DefaultWebApp".
javax.servlet.UnavailableException
at org.apache.struts.action.ActionServlet.init(ActionServlet.java:399)
at javax.servlet.GenericServlet.init(GenericServlet.java:258)
at weblogic.servlet.internal.ServletStubImpl$ServletInitAction.run(Servl
etStubImpl.java:1094)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticate
dSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:
121)
at weblogic.servlet.internal.ServletStubImpl.createServlet(ServletStubIm
pl.java:970)
at weblogic.servlet.internal.ServletStubImpl.createInstances(ServletStub
Impl.java:949)
at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubI
mpl.java:888)
at weblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppS
ervletContext.java:3430)
at weblogic.servlet.internal.WebAppServletContext.preloadServlets(WebApp
ServletContext.java:3375)
at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAp
pServletContext.java:3356)
at weblogic.servlet.internal.WebAppServletContext.setStarted(WebAppServl
etContext.java:6208)
at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:864)
at weblogic.j2ee.J2EEApplicationContainer.start(J2EEApplicationContainer
.java:2134)
at weblogic.j2ee.J2EEApplicationContainer.activate(J2EEApplicationContai
ner.java:2175)
at weblogic.j2ee.J2EEApplicationContainer.activate(J2EEApplicationContai
ner.java:2122)
at weblogic.management.deploy.slave.SlaveDeployer$Application.setActivat
ion(SlaveDeployer.java:3099)
at weblogic.management.deploy.slave.SlaveDeployer.setActivationStateForA
llApplications(SlaveDeployer.java:1768)
at weblogic.management.deploy.slave.SlaveDeployer.resume(SlaveDeployer.j
ava:351)
at weblogic.management.deploy.DeploymentManagerServerLifeCycleImpl.resum
e(DeploymentManagerServerLifeCycleImpl.java:229)
at weblogic.t3.srvr.SubsystemManager.resume(SubsystemManager.java:136)
at weblogic.t3.srvr.T3Srvr.resume(T3Srvr.java:965)
at weblogic.t3.srvr.T3Srvr.run(T3Srvr.java:360)
at weblogic.Server.main(Server.java:32)
>
Please help me
Regards,
ArunThat appears to be a bug in the console. You might try the command-line tool java weblogic.Deployer for deploying apps. java weblogic.Deployer -examples will give detailed usage info.
-- Rob
WLS Blog http://dev2dev.bea.com/blog/rwoollen/ -
How to use ADF Faces with struts1.3.8
Hi
Can anybody guide us how to use ADF faces with Struts 1.3.8.
Your help will be appreciated.
Thanks
ChetanXpp,
Have a look at the ADF Developer's Guide for specific instructions on menus (the ADF Developer's Guide for Forms/4GL Developers has the information in section 19.2).
You can put javascript handlers on the components to get keyboard event handling.
John -
Struts1.1 + tomcat 5.5 and jndi
Hi all,
I have made a web application using struts 1.1. In this I am using tomcat container security check for log in. For this I have REALM tag in META-INF/context.xml. Now I am thinking to use JNDI for connection pooling, so that I can avoid to put database userid and password in struts-config.xml (datasource). Before implementing jndi it was working perfectly and security check as well, but now it always decline to verify the login.
Here is my code for the the following files:
context.xml
<?xml version="1.0" encoding="UTF-8"?>
<Context path="/InformProject" docBase="InformProject">
<Resource name="jdbc/informDB" auth="Container" type="javax.sql.DataSource"
maxActive="100" maxIdle="30" maxWait="10000"
username="singh14" password="informPass" driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost/INFORM?autoReconnect=true"/>
<Realm className="org.apache.catalina.realm.DataSourceRealm" debug="99"
dataSourceName="jdbc/informDB" localDataSource="true"
userTable="users" userNameCol="user_name" userCredCol="user_pass"
userRoleTable="user_roles" roleNameCol="role_name"/>
</Context>
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>InformProject</display-name>
<!-- /// jndi /// -->
<resource-ref>
<description>DB Connection</description>
<res-ref-name>jdbc/informDB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</web-app>
login.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
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>inform Login</title>
</head>
<body>
<form method="POST" action='<%= response.encodeURL("j_security_check") %>' >
Username: <input type="text" name="j_username">
Password: <input type="password" name="j_password">
<input type="submit" value="Login"> <input type="reset">
</form>
</body>
</html>
Can some one help me why it is not working and what is missing? Any help would be appreciated.
ThanksAny kind of help are welcome.
-
Struts1.1(multi_app_modules) and JDev
Hi.
I am using JDev(903 & 10g) to develop a web app containing "multiple application modules" (a Struts 1.1 feature). However i met a problem to retrieve content from resource file defined in the struts-submodule-config.xml files. Here's the detail:
1> I defined two struts config files in the web.xml files, like
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<init-param>
<param-name>config/mod1</param-name>
<param-value>/WEB-INF/struts-config-mod1.xml</param-value>
</init-param>
2> All default module's jsp files were resided in /pages/ folder, and jsp files for mod1 were in /mod1/ folder.
3> I tried to switch from the default module to mod1 like this:
in /index.jsp page
<html:link forward="goToMod1">goToMod1</html:link>
in struts-config.xml file
<forward name="goToMod1" contextRelative="true" path="/mod1/index.do"/>
in struts-mod1-config.xml file
<action-mappings>
<action path="/index" forward="/index.jsp"/>
</action-mappings>
4> here's the content in /mod1/index.jsp
<bean:message key="index.heading"/>
<html:link forward="gotosomewhere">gotosomewhere</html:link>
in this page i tried to include a link to /mod1/somewhere.jsp and I defined also in struts-config-mod1.xml
<forward name="gotosomewhere" path="/somewhere.jsp" />
5> content in /mod1/somewhere.jsp
<bean:message key="msg" />
6> I created two resource files for both default and mod1 modules seperatly, defined them in the correct struts-config files and made sure that all required "key=value" paires are existed.
Now I run the program. I switched to /mod1/index.jsp file by clicking the "goToMod1" link from the /index.jsp page, and everything were correct so far.("index.heading" were retrieved from mod1's resource file correctly)
I clicked the "gotosomewhere" link in the /mod1/index.jsp page,and met the error page, said that [Missing message for key "msg"]. However, after i added a msg=abcdef in the resource file of the default module, it can work correctly, which proved that the /mod1/somewhere.jsp file incorrectly looked for "msg" in the default module's resource file, although /mod1/index.jsp file did the looking up correctly.
If i made something wrong, please help me to point it(them) out. thanks a lot.When the application gets stuck - is there any error reported in the Weblogic log window?
In your IE - do you have XMLHttpRequest enabled? -
Struts1.1b2 and websphere 4.00 problem !
Anyone here tried using the above two combination ?
I am getting this error
I SRVE0092I: [Servlet LOG]: Error Page Exception: : com.ibm.servlet.engine.webapp.WebAppErrorReport: Cannot find message resources under key org.apache.struts.action.MESSAGE
Any help would be appreciated.
ThanksStruts is trying to find a property somewhere, and the key it's using to find it can't be found. Assuming you are using some sort of ApplicationResources properties file, it's probably just a typo.
-
Struts1.3 Application migration to webcenter
Hi,
I have struts 1.3 application, Tiles used running on weblogic Server . Now I need to migrate to Webcenter what is the best way I can do . So my plan is create Webcenter portal Application and create task flow ,portlet for exited code .Is that the right way or any sujjestion please If u have any sujestion or do im dooing wrong , do i need to recoding everything any sujestionYou have varius alternatives:
- Register your Struts + Tiles in WebCenter External Applications and you can execute your application without migrating code.
- Creating a Portlet to be consumed by WSRP protocol is the easiest way to migrate a struts applications.
- On the other hand you can build Custom Task Flow. Probably if you haven't good skills at ADF you can lost more time with this way.
You have the last decision.
PD: You have a Sample of register External Application in WebCenter (including SSO) in Andrejus Blog: http://andrejusb.blogspot.com/2011/03/automated-single-sign-on-through.html
Kind regards.
Edited by: Daniel Merchán on 04-nov-2011 9:00 -
These are the files can any experts help me..no error iam getting but the data are not entered in to database..why so?Thanks in advance
Done all those dbcp setting in tomcat.donno whether it may be right:if you know that too please reply me.how to config dbcp in tomcat
jsp file
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<html:html locale="true">
<head>
<title><bean:message key="welcome.title"/></title>
<html:base/>
<link rel="stylesheet" href="css/stylesheet.css" type="text/css"></link>
</head>
<body bgcolor="white">
<img src="tiles/img/logo.jpg" class="contentimg1">
<html:form action="/Address" method="post" onsubmit="return AddressForm(this);" >
<html:javascript formName="AddressForm" />
<div class="roof">
<html:errors/>
</div>
<table class="addContent" >
<tr>
<td align="center" colspan="2">
<font size="4">ADD NEW USER</font></td>
</tr>
<tr>
<td align="left">
User Authority
</td>
<td align="left">
<html:select property="userAuthority" value="UserAuthority">
<html:option value="State Manager"></html:option>
<html:option value="City Manager"></html:option>
<html:option value="Store Manager"></html:option>
<html:option value="Store User"></html:option>
</html:select>
</td>
</tr>
<tr>
<td align="right">
State
</td>
<td align="left">
<html:text property="state" size="30" maxlength="30"/>
</td>
</tr>
<tr>
<td align="right">
City
</td>
<td align="left">
<html:text property="city" size="30" maxlength="30"/>
</td>
</tr>
<tr>
<td align="right">
<html:submit>Submit</html:submit>
</td>
<td> </td>
</tr>
</table>
</html:form>
</body>
</html:html>
========
actionclass
package com.Reliance.struts.Action;
* @author Raja;
import java.sql.*;
import java.util.ArrayList;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import javax.sql.DataSource;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessages;
import com.Reliance.struts.form.AddressForm;
import com.Reliance.struts.Dao.dbServiceComponent;
public class AddressAction extends Action
public ActionForward execute(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws Exception{
String done=null;
dbServiceComponent objdbServiceComponent =null;
// String strUserAuthority=objAddressForm.getUserAuthority();
//String strEmailAddress=objAddressForm.getEmailAddress();
String query="INSERT INTO ADD_USER(STATE,CITY) VALUES (?,?)";
boolean add=false;
DataSource DataSource = null;
try{
AddressForm objAddressForm =(AddressForm)form;
HttpSession mySession = request.getSession(false);
ActionMessages myActionMessages = new ActionMessages();
DataSource = (DataSource)getDataSource(request, "IMS:IDEA");
objdbServiceComponent = new dbServiceComponent(DataSource);
System.out.println("address.objdbservice");
String strAddressState = objAddressForm.getState();
String strAddressCity = objAddressForm.getCity();
ArrayList queryArgumentList = new ArrayList();
System.out.println("array");
queryArgumentList.add(strAddressState);
queryArgumentList.add(strAddressCity);
System.out.println("array2");
add=objdbServiceComponent.addUser(query, queryArgumentList);
System.out.println("addreturn");
catch(Exception e){
System.out.println("address action");
System.out.println(e.getMessage());
if(add)
done="success";
else
done="failure";
return mapping.findForward(done);
=============
action form
package com.Reliance.struts.form;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.*;
* @author Raja.A
* Form bean for the Address Entry Screen.
public class AddressForm extends ActionForm
private String state=null;
private String city=null;
private String userAuthority=null;
public void setUserAuthority(String userAuthority){
this.userAuthority=userAuthority;
public String getUserAuthority(){
return this.userAuthority;
public void setState(String state){
this.state=state;
public String getState(){
return this.state;
public void setCity(String city){
this.city=city;
public String getCity(){
return this.city;
* Reset all properties to their default values.
* @param mapping The mapping used to select this instance
* @param request The servlet request we are processing
public void reset(ActionMapping mapping, HttpServletRequest request) {
this.state=null;
this.city=null;
* Reset all properties to their default values.
* @param mapping The mapping used to select this instance
* @param request The servlet request we are processing
* @return errors
public ActionErrors validate(
ActionMapping mapping, HttpServletRequest request ) {
ActionErrors errors = new ActionErrors();
if( getUserAuthority() == null || getUserAuthority().length() < 1 ) {
errors.add("userAuthority",new ActionMessage("error.userAuthority.required"));
if( getState() == null || getState().length() < 1 ) {
errors.add("State",new ActionMessage("error.state.required"));
if( getCity() == null || getCity().length() < 1 ) {
errors.add("City",new ActionMessage("error.city.required"));
return errors;
==============
dbcomponent
package com.Reliance.struts.Dao;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.sql.DataSource;
public class dbServiceComponent{
public Connection conn = null;
* declared as private inorder to avoid it to create an instance of this
* class.
protected dbServiceComponent() {
* This constructor initializes the class object dataSource with reference
* datasource as object
* @param ds
public dbServiceComponent(DataSource Datasource) throws Exception {
if (conn == null) {
try {
Context initContext = new InitialContext();
Context envContext = (Context)initContext.lookup("java:/comp/env");
ds = (DataSource)envContext.lookup("jdbc/RILDB");
System.out.println(ds);
conn = ds.getConnection();
System.out.println("final");
/* ADDED BY RAJA MAY 08 */
Context context = new InitialContext();
if (context == null ) { throw new Exception("Boom - No Context"); }
Datasource = (DataSource)context.lookup("java:comp/env/jdbc/RILDB");
if (Datasource == null ) { throw new Exception("Boom - No DataSource"); }
System.out.println("here");
conn=Datasource.getConnection();
System.out.println("conn printing");
//con = ds.getConnection();
conn.setAutoCommit(false);
} catch (SQLException sqlEx) {
System.out.println("Exception while creating connection in "
+ "constructor com.Reliance.struts.dao.dbServicecomponent."
+ "DBServiceComponent(DataSource ds)");
System.out.println(sqlEx);
public boolean addUser (String query,ArrayList argsList) throws SQLException {
boolean result=false;
PreparedStatement pstmt=null;
ResultSet rs = null;
try {
System.out.println("dbse-prp1");
pstmt = conn.prepareStatement(query);
System.out.println("dbse-prp2");
for (int index = 0; index < argsList.size(); index++) {
pstmt.setString(index + 1, (String) argsList.get(index));
System.out.println("dbse-prp3");
System.out.println("try");
rs = pstmt.executeQuery();
System.out.println("execut");
result=true;
if (rs.next()) {
System.out.println("if");
result=true;
if(rs.getString(1)=="dbcp"){
System.out.println("rs-check");
result = true;
} catch (Exception ex) {
System.out.println("dbservice.adduser.first");
System.out.println("ex.toString() = " + ex.getMessage());
finally {
try {
if (rs != null) {
rs.close();
if (pstmt != null) {
pstmt.close();
} catch (SQLException se) {
System.out.println("Query is " + query);
System.out.println("Exception while closing PrepareStatement in "
+ "com.Reliance.daoDBServiceComponent."
+ "addUser (String query,ArrayList argsList)" + se.getMessage());
return result;
=========
struts-config
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.2//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_2.dtd">
<!--
This is a blank Struts configuration file with an example
welcome action/page and other commented sample elements.
Tiles and the Struts Validator are configured using the factory defaults
and are ready-to-use.
NOTE: If you have a generator tool to create the corresponding Java classes
for you, you could include the details in the "form-bean" declarations.
Otherwise, you would only define the "form-bean" element itself, with the
corresponding "name" and "type" attributes, as shown here.
-->
<struts-config>
<!-- ============================================ Data Source Configuration -->
<data-sources>
<data-source key="IMS:IDEA" type="org.apache.commons.dbcp.BasicDataSource">
<set-property property="driverClassName" value="oracle.jdbc.driver.OracleDriver"/>
<set-property property="url" value="jdbc:oracle:thin:@192.168.1.14:1521:rildb"/>
<set-property property="username" value="adventity"/>
<set-property property="password" value="adv_123"/>
<set-property property="minCount" value="5"/>
<set-property property="maxActive" value="50"/>
<set-property property="defaultAutoCommit" value="true"/>
<set-property property="defaultReadOnly" value="false"/>
<set-property property="removeAbandoned" value="true"/>
<set-property property="logAbandoned" value="true"/>
</data-source>
</data-sources>
<!-- ================================================ Form Bean Definitions -->
<form-beans>
<form-bean
name="AddressForm"
type="com.Reliance.struts.form.AddressForm"/>
<!-- sample form bean descriptor for an ActionForm
<form-bean
name="inputForm"
type="app.InputForm"/>
end sample -->
<!-- sample form bean descriptor for a DynaActionForm
<form-bean
name="logonForm"
type="org.apache.struts.action.DynaActionForm">
<form-property
name="username"
type="java.lang.String"/>
<form-property
name="password"
type="java.lang.String"/>
</form-bean>
end sample -->
</form-beans>
<!-- ========================================= Global Exception Definitions -->
<global-exceptions>
<!-- sample exception handler
<exception
key="expired.password"
type="app.ExpiredPasswordException"
path="/changePassword.jsp"/>
end sample -->
</global-exceptions>
<!-- =========================================== Global Forward Definitions -->
<global-forwards>
<!-- Default forward to "Welcome" action -->
<!-- Demonstrates using index.jsp to forward -->
<forward
name="welcome"
path="/Welcome.do"/>
</global-forwards>
<!-- =========================================== Action Mapping Definitions -->
<action-mappings>
<!-- Default "Welcome" action -->
<!-- Forwards to Welcome.jsp -->
<action
path="/Welcome"
forward="/pages/Welcome.jsp"/>
<action
path="/TestAction"
type="com.Reliance.struts.Action.TestAction">
<forward name="testAction" path="/pages/TestAction.jsp"/>
</action>
<action
path="/Address"
type="com.Reliance.struts.Action.AddressAction"
name="AddressForm"
scope="request"
validate="true"
input="/index.jsp">
<forward name="success" path="tilesdefsuccess"/>
<forward name="failure" path="tilesdeffailure"/>
</action>
<action
path="/AddressJavascriptValidation"
type="com.Reliance.struts.Action.AddressAction"
name="AddressForm"
scope="request"
validate="true"
input="/pages/AddressJavascriptValidation.jsp">
<forward name="success" path="/pages/success.jsp"/>
</action>
<action
path="/Tiles/Example"
forward="Tiles.Example"/>
<!-- sample input and input submit actions
<action
path="/Input"
type="org.apache.struts.actions.ForwardAction"
parameter="/pages/Input.jsp"/>
<action
path="/InputSubmit"
type="app.InputAction"
name="inputForm"
scope="request"
validate="true"
input="/pages/Input.jsp"/>
<action
path="/edit*"
type="app.Edit{1}Action"
name="inputForm"
scope="request"
validate="true"
input="/pages/Edit{1}.jsp"/>
end samples -->
</action-mappings>
<!-- ============================================= Controller Configuration -->
<controller
processorClass="org.apache.struts.tiles.TilesRequestProcessor"/>
<!-- ======================================== Message Resources Definitions -->
<message-resources parameter="com.Reliance.struts.properties.MessageResources" />
<!-- =============================================== Plug Ins Configuration -->
<!-- ======================================================= Tiles plugin -->
<!--
This plugin initialize Tiles definition factory. This later can takes some
parameters explained here after. The plugin first read parameters from
web.xml, thenoverload them with parameters defined here. All parameters
are optional.
The plugin should be declared in each struts-config file.
- definitions-config: (optional)
Specify configuration file names. There can be several comma
separated file names (default: ?? )
- moduleAware: (optional - struts1.1)
Specify if the Tiles definition factory is module aware. If true
(default), there will be one factory for each Struts module.
If false, there will be one common factory for all module. In this
later case, it is still needed to declare one plugin per module.
The factory will be initialized with parameters found in the first
initialized plugin (generally the one associated with the default
module).
true : One factory per module. (default)
false : one single shared factory for all modules
- definitions-parser-validate: (optional)
Specify if xml parser should validate the Tiles configuration file.
true : validate. DTD should be specified in file header (default)
false : no validation
Paths found in Tiles definitions are relative to the main context.
-->
<plug-in className="org.apache.struts.tiles.TilesPlugin" >
<!-- Path to XML definition file -->
<set-property property="definitions-config"
value="/WEB-INF/tiles-defs.xml" />
<!-- Set Module-awareness to true -->
<set-property property="moduleAware" value="true" />
</plug-in>
<!-- =================================================== 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>Hi,
Does anybody know where to find examples of using this jakarta dbcp in tomcat servlet?
I looked at http://jakarta.apache.org/commons/dbcp/ examples but they are all about run the Java class at command line. Where to config the tomcat with JDBC pooling?
Thanks in advance!
Icy -
Got a problem with my Chatting-Room program, please help me if you can.
There is one bug in the code (should be just one), but I couldn't find it, I even recoded the whole thing, after I recoded the code, the same problem seems still there. I just can't find where the problem is. So I hope someone here can help me, thank you very much.
First, I made a Server and a Client. Server has 5 classes, and Client has 2 classes. My intention is that all the clients(running on other computers) will connect to the server (which is my laptop), and then they can communicate with each other. For example, if person A typed "Hello", person B and person C's computers will receive this message and display it.
The problem is that several clients can connect to the server (My laptop), but if one person type something, other people won't receive the message, it's blank on their screens. Maybe there is a problem when server receiving the message. So this is the problem I want to solve.
I have the code down there, here is a brife description what each class mainly does.
First class of Server is for connecting client, this class is named Server. Everytime a client is connected, the Server class calls the second class to store the client's information (which is its IP address), the second class is named People.
Third class is named Receiver, it is for receiving the massage from any one of the clients, then stores the message to a static field variable in Fourth class, fourth class is named Saying.
Fifth class of Server is named Sender, it is for sending the massage to the client, that message is the one that stored in Saying.
The First class of client is named Client, it prints any message that the server send to it.
The Second class of client is named SendFromClient, it wait for user to type something, and then send the message to the server, so server's Receiver class hopefully will get it and store it to the field variable in the Saying class.
Here is all the codes:
Server Class:
import java.net.*;
import java.io.*;
import java.util.*;
public class Server
public static void main(String[] args)
/*port number*/
final int port = 41333;
/*welcome messages:*/
System.out.println("This is FriendlyJ 1.0 running");
System.out.println("Listening on ports 41333");
try
/*Clear the ArrayList*/
People clear = new People();
clear.IPs.clear();
/*Create a server socket that will accept any connection on this port*/
ServerSocket ss = new ServerSocket(port);
/*keep getting clients*/
while(true)
/*connect with one client at a time*/
Socket s = ss.accept();
PrintWriter out = new PrintWriter(s.getOutputStream(),true);
Scanner in = new Scanner(s.getInputStream());
/*indicate one establish of connection*/
System.out.println("One connection estabolished!");
/*two classes, one foe receiving, one for sending*/
Receiver receive = new Receiver(in);
Thread ty = new Thread(receive);
Sender send = new Sender(out, s);
Thread yt = new Thread(send);
ty.start();
yt.start();
/*add IP to ArrayList*/
clear.storing(s.getInetAddress().toString());
out.println("There are " + clear.IPs.size() + " people online;");
System.out.println("Connected to " + s.getInetAddress().toString());
catch (Exception e)
System.out.println("System exception");
}People Class:
import java.util.*;
public class People
ArrayList<String> IPs = new ArrayList<String>();
/*A method for storing IPs*/
public void storing(String IP)
IPs.add(IP);
}Receiver Class:
import java.util.*;
public class Receiver implements Runnable
final private Scanner in;
/*Constructor to get the scanner*/
public Receiver(Scanner abc)
in = abc;
public void run()
Saying say = new Saying();
try
while(true)
/*waiting for input from client, then give it to Saying*/
say.setSaying(in.nextLine());
catch (Exception e)
e.printStackTrace();
}Saying Class:
public class Saying
static String saying = "";
public void setSaying(String a)
saying = a;
public String getSaying()
return saying;
public void resetSaying()
saying = "";
public int getlength()
return saying.length();
}Sender Class:
import java.io.*;
import java.net.*;
public class Sender implements Runnable
final private PrintWriter out;
final private Socket s;
public Sender(PrintWriter abcd, Socket abcde)
out = abcd;
s = abcde;
public void run()
out.println("Feel free to chat.");
int count;
Saying says = new Saying();
try
while(!s.isClosed())
count = says.getlength();
if(count>0)
out.println(says.getSaying());
says.resetSaying();
/*disconnect with the client*/
s.close();
System.out.println("Connection with " + s.getInetAddress().toString() + " is closed.");
catch (IOException e)
System.out.println("Network error!");
}Client Class:
import java.util.*;
import java.net.*;
import java.io.*;
public class Client
public static void main(String[] args)
Socket sc;
System.out.println("Welcome to FriendlyJ IM program");
System.out.println("Connecting to the server...");
int port = 41333;
/*A variable for storing IP address of Server*/
InetAddress ip;
try
ip = InetAddress.getByName("192.168.1.68");
sc = new Socket(ip, port);
System.out.println("Connected with Server");
Scanner in = new Scanner(sc.getInputStream());
PrintWriter out = new PrintWriter(sc.getOutputStream());
/*a thread for sending message to the server*/
sendFromClient sendin = new sendFromClient(out);
Thread sending = new Thread(sendin);
sending.start();
/*display welcome message*/
System.out.println(in.nextLine());
/*displaying how many people are online now*/
System.out.println(in.nextLine());
while(true)
/*print out the message sent by the server*/
System.out.println(in.nextLine());
catch(UnknownHostException e)
System.out.println("Couldn't find the host!");
catch(IOException e)
System.out.println("Network error!");
catch (Exception e)
e.printStackTrace();
}SendFromClient Class:
import java.io.*;
import java.util.*;
public class sendFromClient implements Runnable
private PrintWriter send;
public sendFromClient(PrintWriter sendto)
send = sendto;
public void run()
Scanner sc = new Scanner(System.in);
while(true)
/*get a message, then send to the server*/
send.println(sc.nextLine());
That's all, thank you for helping!
Edited by: stdioJ on Oct 31, 2007 3:58 PMHi pgeuens ,
I tried it ...but it didn't work for me.
I changed my .jsp like this
<%@ page language="java" %>
<%@ taglib uri="/tags/struts-html" prefix="html"%>
<html:form action="Registration.do">
UserName:<html:text property="username"/><br>
enter password:<htnl:password property="password1"/><br>
re-enter password:<html:password property="password2"/><br>
<html:submit value="Register"/>
</html:form>And i changed that web.xml like..
<taglib>
<taglib-uri>/tags/struts-html</taglib-uri>
<taglib-location>/WEB-INF/struts-html.tld</taglib-location>
</taglib>Now I am getting an error like ......."File "/WEB-INF/struts-html.tld"not found.
Hi Ashish
I didn't find struts-form.tld in WEB-INF folder.But all the remaining file all there.
Again I downloaded that struts1.2.9 ...in that also i couldn't find struts-form.tld file(except this remaining are there).
Please tell me, if there any other ways....
Thanks,
kona. -
Log 4 j error in struts 1.2.8
I am using struts1.2.8 with hibernate 3.
I am getting below error.
Is there any solution for this problem ?
private DailyRollingFileAppender cAeroAppender;
java.util.Calendar cal=java.util.Calendar.getInstance(); // getting calendar instance
logger = Logger.getLogger(cal.getTime()+"");
strLogLevel=CAeroConstants.getProperty(CAeroConstants.PROPTYPE_CONFIG,CAeroConstants.CONFIGPROP_LOG_LEVEL);
logger.setLevel(Level.DEBUG);
else if ( strLogLevel.equalsIgnoreCase("DEBUG") ) {
logger.setLevel(Level.DEBUG);
else if ( strLogLevel.equalsIgnoreCase("ERROR") ) {
logger.setLevel(Level.ERROR);
cAeroAppender = new DailyRollingFileAppender(new SimpleLayout(),strLogPath+".log","'_'MM-dd-yyyy");
logger.addAppender(cAeroAppender);
06/04/18 20:50:01 log4j:WARN No appenders could be found for logger (org.apache.struts.util.PropertyMessageResource
s).
06/04/18 20:50:01 log4j:WARN Please initialize the log4j system properly.
RaghuIt's not an error; it is merely a warning saying that the system is unable to find any log4j configuration. Create a log4j.properties and add it to the server classpath.
Maybe you are looking for
-
Adobe reader opens "save as" box when clicking on save button rather than saving in the same file
Hi everybody, I have a fillable PDF form designed in Livecycle designer and it is reader extended. When I fill that form on MAC it let me fill and save the form as many times as I like. Everytime I make any change I just click the save button it save
-
Hi, I am doing SAP query, If I select Company Code, i need to get the resule of GL a/c, Buss Area, Cost Center, Profit Center For this in table joints i taken KNA1, KNB1, SKB1, CSKS then also i could not run the report. Rgds sunfico
-
Mssclamp not work in solaris 10
hello i can't set parament in ipnat.conf with mssclamp like this map sppp0 form xxx.xxx.xxx.xxx/xx to any -> xxx.xxx.xxx.xxx/xx mssclamp 1452 i set work before in solaris 9 anyone can help me...many thx
-
Automatic creation of interaction record
Hi Experts, We have a requirement to create the interaction record automatically. Below is the scenario. 1. E-mail will have a subject specified with BP number, On receiving of an e-mail from a business partner(Customer) 2.The syst
-
Custom fields against SFC and standard ME reports
Hello All, We are using Custom fields against SFC to store additional informations in the system. It's done through XML message "Quick complete". I know it's working and that the data are well created in the custom_fields table, but I don't find any