Struts tutorial
Does anyone know a good free e-book teaching Struts??
Thanks =)
Though not a book, I found it helpful when I started learning.
http://javaboutique.internet.com/tutorials/Struts/index.html
Similar Messages
-
I was following the struts tutorial and everything was fine until I tried to run it. When starting OC4J, I got:
Error initializing server: Error instantiating default application at file:/home/mcdanijr/jdevhome/system9.0.5.1.1605/oc4j-config/application.xml: Constructing UserManager for default:caught oracle.security.jazn.JAZNRuntimeException
04/05/04 16:25:54 java.lang.IllegalStateException: Shutdown in progress
04/05/04 16:25:54 at java.lang.Shutdown.add(Shutdown.java:82)
04/05/04 16:25:54 at java.lang.Runtime.addShutdownHook(Runtime.java:193)
04/05/04 16:25:54 at oracle.security.jazn.util.PersistenceService$2.run(Unknown Source)
04/05/04 16:25:54 at java.security.AccessController.doPrivileged(Native Method)
04/05/04 16:25:54 at oracle.security.jazn.util.PersistenceService.<init>(Unknown Source)
04/05/04 16:25:54 at oracle.security.jazn.util.PersistenceService.getService(Unknown Source)
04/05/04 16:25:54 at oracle.security.jazn.util.PersistenceService$PersistenceThread.run(Unknown Source)
Is there some magic I missed?
Best,
Joe McDaniel
The Institute for Genomic Research
Rockville, MDNevermind (I think). I switched to 1.4.1 as the JDK for the project and it looks like OC4J is starting OK now.
-
Any easy Struts tutorial?
I was asked to do a reaaaally basic thing with struts... I have a web application already developed, and I need to be able to go to a certain jsp file, let's just call it view.jsp, by writing view.do in the URL bar instead of view.jsp. I'm finding it really difficult to find a simple tutorial...
Just make another action in action mappings, like this:
<action path = "/ViewView"
type = "sdmi.emp.web.maintenance.ViewViewAction"
scope = "request"
name = "viewForm"
validate = "false">
<forward name = "success" path = "/View.jsp"/>
</action>
<action path = "/View"
type = "sdmi.emp.web.maintenance.ViewAction"
scope = "request"
name = "viewForm"
validate = "true"
input = "/View.jsp">
<forward name = "success" path = "/employee_search.jsp"/>
</action> -
Hi
Can some one forwards me some good links to struts online tutorial. I have googled a lot on this but could not find a good decent one in lay man terms for begginers.
Thanx,the links on the left (user and dev guides, faq) are
exhaustive and their how-to guides were the only ones
i neded even when I started years ago. the blank
struts app is the best way to start.nice try, but realistically you'll be pulling your hair out the first week
there have been many, many comments about the learning curve of struts and i've never heard ANYONE say it was well documented before, until now i guess
not trying to be argumentative, just dont' want to give the wrong impression here -
I know its a basic Question but still i am Asking the reason is that i am unable to find a book on Struts in my Country that Happens to be Pakistan i need Some tutorials on Struts Plzzzzzzz Help Me i will be Greatfull to ALL of You out ther
Thanks in Advancei think ....umight get to know about struts ......from here....
http://www.packtpub.com/files/learning_jakarta_stuts_chapter4_Internationalization_and_Taglibs.pdf
ok thank u...... -
How to instantiate object in JSP/STRUTS page?
I worked through the STRUTS tutorial (http://rzserv2.fhnon.de/~lg002556/struts/Doku.html) but I get errors when I try to instantiate an object of a class that is in my WEB-INF/classes directory:
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 14 in the jsp file: /BookSerialize.jsp
Generated servlet error:
[javac] Compiling 1 source file
D:\Programme\jakarta-tomcat-4.1.12\work\Standalone\localhost\strutsdemo\BookSerialize_jsp.java:86: cannot resolve symbol
symbol : class Book
location: class org.apache.jsp.BookSerialize_jsp
Book book = new Book();
^
The Book.class (and other classes) is in the WEB-INF/classes directory. The BookSerialize.jsp is here:
<%@ page language="java" import="java.beans.XMLEncoder, java.beans.XMLDecoder, java.io.*"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<html:html locale="true">
<head>
<html:base/>
<title><bean:message key="index.title"/></title>
</head>
<body bgcolor="white">
<h2>Book Serialization</h2>
<%
Book book = new Book();
book.setTitle("A great Book about Struts");
book.setPages(100);
out.println("<member>First Title: " + book.getTitle() + "</member>");
try {
XMLEncoder encoder = new XMLEncoder(new BufferedOutputStream(new FileOutputStream("/Sample.xml")));
encoder.writeObject(book);
encoder.close();
} catch(Exception ex) {
out.println(ex);
book.setTitle("A great Book about Struts, Second Edition");
out.println("<member>Second Title: " + book.getTitle() + "</member>");
try {
XMLDecoder decoder = new XMLDecoder(new BufferedInputStream(new FileInputStream("/Sample.xml")));
book = (Book) decoder.readObject();
decoder.close();
} catch(Exception ex) {
out.println("<h1>" + ex + "</h1>");
out.println("<member>Third Title: " + book.getTitle() + "</member>");
%>
</body>
</html:html>
I also get the same error when deploying and (trying to) run on the J2EE 1.3.1 server.
So far, I just used JSP pages working with beans (usebean tag). Is it possible at all to just do a
MyClass myObject = new MyClass();
within a JSP page, if MyClass.class is in the WEB-INF/classes of the web application?
Is there any kind of import missing? Book.class is in the default package, so i can't state it in the page directive/import parameter of the JSP page...
any advice?I think, I got it: you have to use package names for your classes and avoid the default package. After I used a package name, it was possible to instantiate the object ....
-
Database connectivity in struts with mysql
Hi,
I want to database connectivity in struts with mysql in struts-config.xml file. I have give the code in struts-config.xml file is given below...................
<data-sources>
<data-source key="dbname" type="org.apache.commons.dbcp.BasicDataSource" >
<set-property property="driverClassName" value="com.mysql.jdbc.Driver" />
<set-property property="url" value="jdbc:mysql://localhost:3306/antrowinnovation" />
<!-- <set-property property="username" value=""/>
<set-property property="password" value="indra" /> -->
</data-source>
</data-sources>
And give the code in Action class is given below...
int i=0;
Connection con;
Statement stmt;
DataSource dataSource = (DataSource)servlet.getServletContext().getAttribute("dbname");
System.out.println(dataSource);
try{
System.out.println("Database connecting....");
con=dataSource.getConnection();
stmt=con.createStatement();
System.out.println("Database connected....");
i=stmt.executeUpdate("insert into login values('" + username + "','" + password + "')");
System.out.println("Values inserted....");
}catch(Exception e){
System.out.println(e.getMessage());
System.out.println("Exception in try");
e.printStackTrace();
return 0;
But when i have run this then i got this Exception....
INFO: Initialize action of type: login.LoginAction
null
Database connecting....
null
Exception in try
java.lang.NullPointerException
at login.LoginAction.insertUser(LoginAction.java:27)
at login.LoginAction.execute(LoginAction.java:47)
at org.apache.struts.chain.commands.servlet.ExecuteAction.execute(ExecuteAction.java:58)
at org.apache.struts.chain.commands.AbstractExecuteAction.execute(AbstractExecuteAction.java:67)
at org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)
at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
at org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304)
at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
at org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:825)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:743)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Unknown Source)
Plz help me..Read some Struts tutorial.
-
I already searched all post in this forum regarding struts tutorial.currently im looking for other alternative method to practice myself in struts using oracle jdeveloper
Somebody here can help me?
Pls post your link here abouts struts tutorial preferably using oracle jdeveloperGo to http://otn.oracle.com and search for "struts". There are lots of links including tutorials.
There are also tutorials within JDeveloper. -
Struts exception handling - Exception handler
Hi ,
I need some help for struts exception handling . Global exception is working fine in my struts application . But I need to show the exception stack trace also in the screen whenever the exception occurs.I guess this can be achieved if we use a custom exception handler instead of struts default exception handler . Can anyone please provide me a sample code to deal with a custom ExceptionHandler class ?
Thanks in advance...
Regards,
BGThe struts provides org.apache.struts.action.ExceptionHandler class for creating the custom exception handlers. All the custom Exception Handlers should extend the ExceptionHandler class and override the execute() method.
//An Example
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ExceptionHandler;
import org.apache.struts.config.ExceptionConfig;
public class CustomExceptionHandler extends ExceptionHandler {
public ActionForward execute(Exception exception, ExceptionConfig config, ActionMapping mapping, ActionForm formInstance,
HttpServletRequest request, HttpServletResponse response) throws ServletException {
try {
// TODO CustomeCode
System.out.println("Exception Handler for the specific error");
}catch (Exception e) {
return (super.execute(exception, config, mapping, formInstance, request, response));
Struts-config.xml File
<exception key="error.system" type="java.lang.RuntimeException"
handler="com.visualbuilder.handler.CustomExceptionHandler" path="/index.jsp" />
Note:- This will transfer the control to the index.jsp after calling the exception handler. In the struts-config.xml we are adding the global exception for RuntimeException. You can add any exception like the previous example to some actions only.
I have taken this example from following link. You may visit it.
http://www.visualbuilder.com/jsp/struts/tutorial/pageorder/38/
I would like if you share knowledge with me. -
Hi
I'm trying to deploy struts example. The example works fine in Tomcat 5.
when depolying in weblogic 8, it has the following error
<Sep 8, 2005 9:39:24 PM EDT> <Error> <HTTP> <BEA-101020>
<[ServletContext(id=4609270,name=struts-tutorial,context-path=/s
truts-tutorial)] Servlet failed with Exception
weblogic.servlet.jsp.JspException: (line 2): Error in using tag library
uri='/tags/struts-html' prefix='html': The Tag cl
ass 'org.apache.struts.taglib.html.FormTag' has no setter method
corresponding to TLD declared attribute 'disabled', (JSP
1.1 spec, 5.4.1)
at
weblogic.servlet.jsp.StandardTagLib.tld_jspException(StandardTagLib.java:123
5)
at
weblogic.servlet.jsp.StandardTagLib.parseTagDD(StandardTagLib.java:1363)
at
weblogic.servlet.jsp.StandardTagLib.parseDD(StandardTagLib.java:1261)
at
weblogic.servlet.jsp.StandardTagLib.<init>(StandardTagLib.java:292)
at
weblogic.servlet.jsp.TagLibHelper.loadTagLib(TagLibHelper.java:314)
at weblogic.servlet.jsp.JspLexer.loadTagLib(JspLexer.java:145)
at
weblogic.servlet.jsp.JspLexer.mTAGLIB_DIRECTIVE_BODY(JspLexer.java:5015)
at
weblogic.servlet.jsp.JspLexer.mTAGLIB_DIRECTIVE(JspLexer.java:4853)
at weblogic.servlet.jsp.JspLexer.mDIRECTIVE(JspLexer.java:4699)
at weblogic.servlet.jsp.JspLexer.mSTANDARD_THING(JspLexer.java:2094)
at weblogic.servlet.jsp.JspLexer.mTOKEN(JspLexer.java:1880)
at weblogic.servlet.jsp.JspLexer.nextToken(JspLexer.java:1753)
at weblogic.servlet.jsp.JspLexer.parse(JspLexer.java:963)
at weblogic.servlet.jsp.JspParser.doit(JspParser.java:106)
at weblogic.servlet.jsp.JspParser.parse(JspParser.java:230)
at weblogic.servlet.jsp.Jsp2Java.outputs(Jsp2Java.java:125)
at
weblogic.utils.compiler.CodeGenerator.generate(CodeGenerator.java:258)
at weblogic.servlet.jsp.JspStub.compilePage(JspStub.java:367)
at weblogic.servlet.jsp.JspStub.prepareServlet(JspStub.java:223)
at weblogic.servlet.jsp.JspStub.prepareServlet(JspStub.java:172)
at
weblogic.servlet.internal.ServletStubImpl.getServlet(ServletStubImpl.java:51
8)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:362)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:446)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:305)
at
weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImp
l.java:301)
at
org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:10
54)
at
org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcesso
r.java:259)
at
org.apache.struts.action.RequestProcessor.internalModuleRelativeForward(Requ
estProcessor.java:992)
at
org.apache.struts.tiles.TilesRequestProcessor.internalModuleRelativeForward(
TilesRequestProcessor.java:341)
at
org.apache.struts.action.RequestProcessor.processForward(RequestProcessor.ja
va:551)
at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:209)
at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1192)
at
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:412)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(Servle
tStubImpl.java:971)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:402)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:305)
at
weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(W
ebAppServletContext.java:6350)
at
weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubjec
t.java:317)
at
weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118)
at
weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletCo
ntext.java:3635)
at
weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java
:2585)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
I've copied all *.jar from example\lib to weblogic\common\lib, including xml
parser.
Can any one tell me how to deal with it?
Thanks lots in advance
John Woo
TorontoHi
What is the Service Pack you are using in weblogic 8.1?that's WebLogic Server 8.1 SP2
Could you send me the test case which you developed to my mail id?it's downloaded from
http://struts.apache.org/download.cgi
version 1.2.7, unzip the source version, get strut-blank.war.
then via weblogic console, copy the war-file to newly created folder
struts-tutorial and deploy it, testing it via
http://localhost:7001/struts-tutorial/
the error message in the browser is
/pages/Welcome.jsp(2): Error in using tag library
uri='http://jakarta.apache.org/struts/tags-html' prefix='html': The Tag
class 'org.apache.struts.taglib.html.FormTag' has no setter method
corresponding to TLD declared attribute 'name', (JSP 1.1 spec, 5.4.1)
probably occurred due to an error in /pages/Welcome.jsp line 2:
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>
PS
I found (in the internet) many people having similar problem, when using
WL5, WL6, struts 1.1, struts 1.2+
John woo
Toronto -
hi,
i'm trying to learn strut. can any person tell me the best place to get tutorials on it?
I'm finding it difficult to configure it. I only copied the lib of the to the lib in the WEB-INF of my directory and it didn't work
thanksThere are so many sites for struts tutorials.
www.coreservlets.com/Apache-Struts-Tutorial/
www.roseindia.net/struts/
these are best ones
If you have any doubt you can contact me directly to my mail id
[email protected]
I hope I will suggest you. -
Struts DynaActionForm's set method - is it correctly implemented?
Dear people:
I'm trying to make a struts based application that
chain-forwards a single request via two struts action classes.
when a user submits the form post, the first struts action receives the form, does some processings and forwards it to the next action.
however, just before it's forwarding the action,
it needs to change the DynaActionForm settings that it
received to another value:
((DynaActionForm)form).set("event","now_do_this");
and forward to the second action which will receive the
form and read the value which was set up by
the first action.
However, whenever I tried to do this, the second action
simply couldn't get the set up value from first action.
I've searched around couple of struts tutorial sites
and this should be working:
http://www.exadel.com/tutorial/struts/5.2/guess/strutstutorial-dynaform.html
So what I want to know is:
is JDeveloper's (oracle's) struts runtime not properly
functioning?
or, is it my mistake to misunderstand the struts?
Any comments are welcomed.I have not come across anything call validation.xml.
All that I know is that if validate is specify to true in the ActionMapping inside struts-config.xml, the validate() method in ActionForm will be invoked.
RequestProcessor that ActionServlet delegates to will pass the user to the "input" attribute specified in the ActionMapping inside struts-config.xml. Since action() method actually returns an ActionErrors object whereby if it is empty then consider there are no erros and RequestProcessor will proceed with getting the Action and invoked its execute() method.....which will then return a ActionForward object.......
I hope what i mention is correct. -
pl send me where can i get struts tutorial in flash presentation with myeclipse.
http://www.google.de/search?sourceid=navclient-ff&ie=UTF-8&rls=GGGL,GGGL:2006-32,GGGL:de&q=struts+myeclipse+tutorial+flash
-
Help to find Struts E-Book for Download
I'm a begginer to Struts framework
Please giude me to find a good E-Book to Download
Also give some links where i can get help
Thanks
tinuhttp://struts.apache.org/userGuide/index.html
http://struts.apache.org/api/index.html
http://www.coreservlets.com/Apache-Struts-Tutorial/ -
Invalid path /actions/register2 was requested
Hi , I am new in struts, I following the guide in http://www.coreservlets.com/Apache-Struts-Tutorial/ and always got
error
The request sent by the client was syntactically incorrect (Invalid path /actions/register2 was requested).
I havestruts-config.xml under TStruct\WEB-INF<action-mappings>
<action path="/actions/register1"
type="coreservlets.RegisterAction1">
<forward name="success"
path="/WEB-INF/results/result1.jsp"/>
</action>
<action path="/actions/register2"
type="coreservlets.RegisterAction2">
<forward name="bad-address"
path="/WEB-INF/results/bad-address2.jsp"/>
<forward name="bad-password"
path="/WEB-INF/results/bad-password2.jsp"/>
<forward name="success"
path="/WEB-INF/results/result2.jsp"/>
</action>i have RegisterAction2.class under coreservlets
I have register2.jsp under webapps\TStruct\forms
I have bad-address2.jsp.. TStruct\WEB-INF\results
I suppose right, why i always have mistake??
help to point out
Thank youIt work fine now. it just work like before it just not work, I don't why?
Maybe you are looking for
-
How can I add my custom ringtone to iTunes 10.7?
I recently got an iPhone 5 and I want to add a custom ringtone to it. I created a 29-second clip of a song using a software called Audacity and then saved it as an .m4r file. Then, I tried the drag-and-drop method to add the file to my Tones playlist
-
Will I be able to use my current Photoshop CC on a new computer when I upgrade?
I am looking into using Photoshop CC ($9.99/mo). I need a new program right now on my current laptop. I plan to upgrade my laptop at the end of the year. Will I be able to use the same Photoshop account?
-
Debugging ZdriverProg when attached toa Standard Transaction code
Hi all, iam doing with SAP Standard smartform initially the ZProgram and Zform are attached to standard Program : RV56TD00 for the transaction VT02N (ApplicationV7 - Shipment : Bill of Lading) + Zform Now iam working on Modifying the ZProgram
-
GMail sent messages do not appear on BB
I use a Google Apps account and a GMail account - both registered with my local BIS account server. I use Outlook 2010 on my desktop configured via IMAP. On 1st Nov 2010, my BB 9700 stopped receiving copies of items sent either through Outlook or Goo
-
Hi all, In our process, sales orders will be created background and are rush order in nature. Which means deliveries will be created immidiately. These order will be created in morning and user get the list of orders and corresponding deliveries. One