Don brown
This presentation is the property of its rightful owner.
Sponsored Links
1 / 46

Struts 2.0 PowerPoint PPT Presentation


  • 108 Views
  • Uploaded on
  • Presentation posted in: General

Don Brown. Struts 2.0. Web, Circa 2000. Web, Circa 2006. Struts 2 Architecture. Struts 1 Action  ActionForm  ActionForward  struts-config.xml  ActionServlet  RequestProcessor . Struts 2 Action Action or POJO’s Result struts.xml

Download Presentation

Struts 2.0

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Don brown

Don Brown

Struts 2.0


Web circa 2000

Web, Circa 2000


Web circa 2006

Web, Circa 2006


Struts 2 architecture

Struts 2 Architecture


Struts 2 0

Struts 1

Action 

ActionForm 

ActionForward 

struts-config.xml 

ActionServlet 

RequestProcessor 

Struts 2

Action

Action or POJO’s

Result

struts.xml

FilterDispatcher

Interceptors


Struts plugins

Struts Plugins


Simple example

Simple Example


Struts 1

Struts 1

<html:errors/>

<html:form action="/SaveMeeting">

<table border="0" width="100%">

<tr>

<th align="right">

Name:

</th>

<td align="left">

<html:text property="name" size=”50” />

</td>

</tr>

<tr>

<th align="right">

Date:


Struts 2 0

</th>

<td align="left">

<html:text property="date" size="50"/>

</td>

</tr>

<tr>

<th align="right">

Invitees:

</th>

<td align="left">

<html:select property="invitees"

multiple="true">

<html:options collection="employees"

property="value"

labelProperty="label"/>

</html:select>


Struts 2 0

</tr>

<tr>

<th align="right">

Description:

</th>

<td align="left">

<html:textarea property="description"

rows="4" cols="50" />

</td>

</tr>

<tr>

<td align="right">

&nbsp;

</td>


Only four pages

...

Only four pages!

<td align="left">

<html:submit property="DO_SUBMIT">

Save

</html:submit>

</td>

</tr>

</table>

</html:form>


Struts 2

Struts 2

<s:form action="Meeting" validate="true">

<s:token />

<s:textfield label=”Name” name=“name” />

<s:textfieldlabel=”Date"name="date"/>

<s:select label=”Invitees” name="invitees"list="employees"/>

<s:textarealabel=”Description” name="description"

rows="4"cols="50"/>

<s:submitvalue=”Save"method="save"/>

</s:form>


Example revisited

Example Revisited


Struts 2 0

<s:textfield label="Name"

name="name"tooltip="Meeting name"/>


Struts 2 0

<s:datepickerlabel="Date" name="date"/>


Struts 2 0

<s:optiontransferselect ... />


Struts 2 0

<jsp:include

page="/ajax/commonInclude.jsp"/>

...

<s:textareatheme="ajax"label="Description"

name="description" rows="4" cols="50" />


But there s more

But there's more . . .


Brian kernighan law of debugging difficulty

Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.

Brian Kernighan Law of Debugging Difficulty


Prevention and cure

Prevention and Cure


Struts devmode true

struts.devMode = true


Built in testing support

Built-in Testing Support

public class MyActionTest

extends StrutsTestCase {

public void testExecute()

throws Exception {

assertTrue(true);

}

}


Struts 2 0

any.action?debug=console


Struts 2 0

any.action?profiling=yes


Struts 2 0

Time to Upgrade?


Struts 2 0

Tutorials, Guides, and FAQs


Struts 2 0

Struts 2 Training Course


Struts 2 0

Run Struts 1 Actions as Is

<action name="editGangster"

class="org.apache.struts2.s1.Struts1Action">

<param name="className">

com.mycompany.gangstas.EditGangsterAction

</param>

<result>

gangsterForm.jsp

</result>

</action>


Struts 2 0

How do I get started?


Struts 2 0

Where We are Going


  • Login