> > > >That needs some plug-ins to support,you can try "Lomboz" > how to install Lomboz ? should i only get it and put it in a eclipse > plugins > dir ? > *A:just download it and put it in the eclipse plug-in, you can google it > with key words: "eclipse Lomboz" for details* > >thirdly,configure the web.xml , below is a sample configure > can i just copy and paste your sample ? or should i modify it? based on > what > i need to modify my web.xml ? > *A: you can copy it to begin.* > >then,create a struts.xml in the src forder (src/struts.xml) and configure > it,below is a sample. > *A: If you create a action named MyAction,and the full package name is > com.mycompany.action.MyAction ,then you should change the action > name,class.*
<!--extends here is simlar to extends in Java language. you can inherit the configures from other packages or a default "package" .*see the doc's "Guides" about Configuration* --> <package name="a name to distinguish with other packages " extends="struts-default"> <!--Configure action is similar to configure "servlet" and "filter"--> <action name="a alias for MyAction,you can just use MyAction" class="the full package path, here is com.mycompany.action.MyAction"> <!-- the action's methods(the default is execute() ) return a String like "SUCCESS","ERROR","INPUT", the result elements "tell" struts what to do if certain string returns. *see the doc's "Guides" about Configuration* --> * *<result name="success">/success.jsp </result> <result name="input">/Login.jsp</result> </action> </package> *Just follow the docs's "Getting started", code the examples one by one*. I'am a newbie too. > On 8/16/07, Andvar Woo <[EMAIL PROTECTED]> wrote: > > > > Firstly,create a empty dynamic web project. That needs some plug-ins to > > support,you can try "Lomboz" > > sencondly,copy/import the following 5 essential jars to the /WEB-INF/lib > > folder > > struts2-core.jar > > xwork.jar > > ognl.jar > > freemarker.jar > > commons-logging.jar > > you can find these jars in the strtus pack you downloaded. > > > > thirdly,configure the web.xml , below is a sample configure > > --------------------------- > > web.xmlstart------------------------------------------- > > <?xml version="1.0" encoding="UTF-8"?> > > <web-app version="2.5" > > xmlns="http://java.sun.com/xml/ns/javaee" > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > > xsi:schemaLocation="http://java.sun.com/xml/ns/javaee > > http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> > > > > <display-name>Struts2 configure sample</display-name> > > > > <filter-name>struts2</filter-name> > > <filter-class> > > org.apache.struts2.dispatcher.FilterDispatcher > > </filter-class> > > </filter> > > > > <filter-mapping> > > <filter-name>struts2</filter-name> > > <url-pattern>/*</url-pattern> > > </filter-mapping> > > <welcome-file-list> > > <welcome-file>index.jsp</welcome-file> > > </welcome-file-list> > > </web-app> > > > > ---------------------------web.xml end > > --------------------------------------------- > > then,create a struts.xml in the src forder (src/struts.xml) and > configure > > it,below is a sample. > > you can refer the struts-doc 's guildes for how to configure "package > > ","action" and "result" elements > > > > --------------------------- > > struts.xmlstart------------------------------------------- > > <!DOCTYPE struts > > PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" > > "http://struts.apache.org/dtds/struts-2.0.dtd"> > > <struts> > > <include file="struts-default.xml" /> > > <package name="struts_OGNL" extends="struts-default"> > > <action name="Ognl" class="tutorial.action.OgnlAction"> > > <result>/Ognl.jsp</result> > > </action> > > </package> > > </struts> > > ---------------------------struts.xml end > > ------------------------------------------- > > I suggust you follow struts-doc's "Getting Started" to be familar with > > struts2 step by step. > > these docs are all contained in the full pack. > > besides, the struts's "Big-picture" may help to understand struts2's > > architecture > > http://struts.apache.org/2.x/docs/big-picture.html > > you can also find the doc in the full pack. > > Hope the above helps. > > Good luck. > > > > 2007/8/16, meisam sarabadani <[EMAIL PROTECTED]>: > > > > > > I have downloaded the full pack of struts and the all exampels, and > also > > i > > > have deployed it manually by putting it into my container (tomcat), > but > > > when > > > im going to use the eclipse as IDE to develop and start a struts > > > everything > > > messes and I can`t continue, actually it is not working, I have seen > so > > > many > > > tutorials but none of is 100% sure about what they are saying, can you > > > help > > > me with this ? > > > > > > On 8/16/07, meisam sarabadani <[EMAIL PROTECTED]> wrote: > > > > > > > > hey > > > > > > > > thanks for your help but the thing is that it does not work like > that > > in > > > > eclipse, yeah I have downloaded the full pack of struts and the all > > > > exampels, and also i have deployed it manually by putting it into my > > > > container (tomcat), but when im going to use the eclipse as IDE to > > > develop > > > > and start a struts everything messes and I can`t continue, actually > it > > > is > > > > not working, I have seen so many tutorials but none of is 100% sure > > > about > > > > what they are saying, can you help me with this ? > > > > > > > > > > > > On 8/16/07, Andvar Woo <[EMAIL PROTECTED]> wrote: > > > > > > > > > > You can refer to the Struts doc. > > > > > The easiest way is to use the struts2-blank-2.0.9.war as a start. > > > > > you can find it from the http://struts.apache.org > > > > > You'd better download a struts-2.x.all.zip from the download > pages. > > > > > Hope that helps,good luck. > > > > > 2007/8/16, meisam sarabadani <[EMAIL PROTECTED]>: > > > > > > > > > > > > Does anybody know how to configure struts on eclipse and build > > anew > > > > > > project > > > > > > by struts in eclipse ? > > > > > > > > > > > > On 8/16/07, red phoenix <[EMAIL PROTECTED]> wrote: > > > > > > > > > > > > > > For general Java class,we can make construction function,like > > > this: > > > > > > > public class test{ > > > > > > > String a; > > > > > > > public test(String a){ > > > > > > > this.a=a; > > > > > > > } > > > > > > > } > > > > > > > > > > > > > > I don't know if I can do it like above code under struts2 > > > action,for > > > > > > > > > > > some > > > > > > > reason,I want to initialize some variable and assign some > value > > to > > > > > > it,like > > > > > > > follows: > > > > > > > public class MyClass extends ActionSupport{ > > > > > > > private ....; > > > > > > > public MyClass(SomeType s){ > > > > > > > //make some common operaction,such get session and so > > > > > on,because > > > > > > I > > > > > > > want to run them only once > > > > > > > } > > > > > > > public String execute() throws Exception { > > > > > > > .... > > > > > > > } > > > > > > > public String .....{ > > > > > > > } > > > > > > > ... > > > > > > > } > > > > > > > > > > > > > > I can successly compile above code,but when I run above > code,it > > > will > > > > > say > > > > > > > error: > > > > > > > 1)MyClass action error > > > > > > > 2)java.lang.NullException because some code in > MyClass(SomeType > > s) > > > > > > > > > > > > > > When I remove the code in the MyClass(SomeType s) into > execute() > > > > > > > function,it > > > > > > > can run well. I am puzzle with it! Anybody could tell me how > to > > > do > > > > > > > it? An > > > > > > > example is better. > > > > > > > > > > > > > > Thanks, > > > > > > > phoenix > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > > Appreciated much, > > > > > > > > > > > > Meisam Sarabadani > > > > > > IBM Student Ambassador > > > > > > Vice president II, IT Society > > > > > > Multimedia University, Cyberjaya Capmus > > > > > > > ------------------------------------------------------------------ > > > > > > "The day the Lord created hope was probably the same day he > > created > > > > > > Spring." Bern Williams. > > > > > > > ------------------------------------------------------------------ > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > Appreciated much, > > > > > > > > Meisam Sarabadani > > > > IBM Student Ambassador > > > > Vice president II, IT Society > > > > Multimedia University, Cyberjaya Capmus > > > > ------------------------------------------------------------------ > > > > "The day the Lord created hope was probably the same day he created > > > > Spring." Bern Williams. > > > > ------------------------------------------------------------------ > > > > > > > > > > > > > > > > -- > > > Appreciated much, > > > > > > Meisam Sarabadani > > > IBM Student Ambassador > > > Vice president II, IT Society > > > Multimedia University, Cyberjaya Capmus > > > ------------------------------------------------------------------ > > > "The day the Lord created hope was probably the same day he created > > > Spring." Bern Williams. > > > ------------------------------------------------------------------ > > > > > > > > > -- > Appreciated much, > > Meisam Sarabadani > IBM Student Ambassador > Vice president II, IT Society > Multimedia University, Cyberjaya Capmus > ------------------------------------------------------------------ > "The day the Lord created hope was probably the same day he created > Spring." Bern Williams. > ------------------------------------------------------------------ >