Strust2中的Aaction默认访问方法为exeucte()方法,当一个Acton中有多个方法时,我们应该如何来做配置?Struts提供了三种方式来实现
书写Action方法时要注意的事项
1、在action里面的方法有返回值时,在配置文件中没有配置,会出现错误。
2、在action里面的方法有返回值时,返回值的类型必须是String。
3、在action里面的方法也可以没有返回值,没有返回值的时候 result标签不需要配置
1)没有返回值可写成 public void add();
2)或者让返回值返回"none" 推荐用这种方式
Action的三种访问方法的实现
1、使用action标签的method属性,在这个属性里面写执行的action的方法。
2、使用通配符方式实现。
3、动态访问实现(不用)。
使用action标签method访问多个方法
第一步创建类和多个方法
package com.netxintai.action; import com.opensymphony.xwork2.ActionSupport; public class Person extends ActionSupport { public String add() throws Exception { System.out.println("add()...."); return NONE; } public String update() throws Exception { System.out.println("update()....."); return NONE; } }
第二步配置struts.xml文件
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN" "http://struts.apache.org/dtds/struts-2.3.dtd"> <struts> <package name="default" namespace="/" extends="struts-default"> <!-- 实现Person类中的add()方法 --> <action name="addAction" class="com.netxintai.action.Person" method="add"></action> <!-- 实现Person类中的update()方法 --> <action name="updateAction" class="com.netxintai.action.Person" method="update"></action> </package> </struts>
总结:action每个方法都需要配置,如果类里面有多个方法,就要配置多个action
使用通配符配置实现(推荐!)
1、在action标签里面name属性加入*号,加入匹配值。
1)*理解:表示匹配任意内容
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN" "http://struts.apache.org/dtds/struts-2.3.dtd"> <struts> <package name="default" namespace="/" extends="struts-default"> <!-- 通配符实现Person类中的方法 --> <action name="person_*" class="com.netxintai.action.Person" method="{1}"></action> <!-- name属性值里面写符号* mehtod属性写method="{1}" 1代表* (1)执行aciton里面的add方法,访问person_add 使用person_*可匹配到。*相当于变成了add (2)执行action里面的update方法,访问person_update,使用person_*可以匹配到。*相当于变成update --> </package> </struts>
Induced deletion of p27 Kip1 in neonates led to 5 fold increased BrdU labeling in neonatal p27 L L; CreER vestibular macula relative to negative controls mean p27 L L; CreER 1, 948 BrdU cells mm 2 SE, mean negative controls 375 BrdU cells mm 2 SE, Sup canadian pharmacy cialis 20mg Ultimately, the Court took a middle ground approach, declining to adopt the scope of the patent rule espoused by the Eleventh Circuit, and also rejecting the quick look presumption that was advocated by the FTC and the plaintiffs bar and adopted by the Third Circuit in K Dur
They re good at explaining the information about the treatment and cost real cialis no generic Department of Energy DOE 2020
You actually make it seem really easy along with your presentation but I
find this topic to be actually something that I feel I’d never understand.
It kind of feels too complex and extremely broad for
me. I am looking forward in your subsequent post, I will try
to get the hang of it! Lista escape roomów
Very interesting details you have remarked, thank you for posting.!
I like this web site very much, Its a very nice billet to read and incur info.
Euro trip
I’m amazed, I have to admit. Seldom do I encounter a blog that’s equally educative and amusing, and without a doubt, you have hit the nail on the head. The issue is something which too few people are speaking intelligently about. I am very happy that I stumbled across this in my search for something concerning this.
I really like it when individuals get together and share ideas. Great blog, continue the good work.
You made some good points there. I checked on the internet for more info about the issue and found most individuals will go along with your views on this site.
Oh my goodness! Awesome article dude! Thank you, However I am encountering troubles with your RSS. I don’t know why I cannot subscribe to it. Is there anybody getting the same RSS issues? Anyone that knows the answer will you kindly respond? Thanx!!
I really like it when folks come together and share ideas. Great website, stick with it!
I love reading through a post that can make people think. Also, thanks for allowing me to comment.
After exploring a number of the blog articles on your site, I truly like your technique of blogging. I saved it to my bookmark website list and will be checking back in the near future. Please visit my web site too and let me know what you think.
I blog frequently and I really appreciate your content. Your article has truly peaked my interest. I’m going to book mark your site and keep checking for new information about once per week. I subscribed to your RSS feed too.
Right here is the right website for everyone who really wants to find out about this topic. You realize so much its almost hard to argue with you (not that I personally would want to…HaHa). You definitely put a brand new spin on a subject that has been discussed for a long time. Great stuff, just excellent.
I wanted to thank you for this very good read!! I certainly loved every bit of it. I have you book marked to check out new stuff you post…
Excellent article. I absolutely love this website. Stick with it!
I’m impressed, I must say. Seldom do I encounter a blog that’s both educative and amusing, and let me tell you, you have hit the nail on the head. The problem is something that not enough folks are speaking intelligently about. Now i’m very happy that I came across this during my hunt for something concerning this.
I used to be able to find good info from your blog articles.
This excellent website certainly has all the information I needed concerning this subject and didn’t know who to ask.
Good information. Lucky me I recently found your blog by accident (stumbleupon). I’ve bookmarked it for later.
Way cool! Some very valid points! I appreciate you writing this post plus the rest of the website is really good.
An impressive share! I’ve just forwarded this onto a friend who has been conducting a little research on this. And he actually bought me breakfast due to the fact that I stumbled upon it for him… lol. So let me reword this…. Thank YOU for the meal!! But yeah, thanx for spending the time to discuss this subject here on your website.
I really like reading through an article that can make people think. Also, thanks for allowing for me to comment.
Your style is unique compared to other folks I’ve read stuff from. Many thanks for posting when you have the opportunity, Guess I will just bookmark this blog.
I want to to thank you for this great read!! I absolutely loved every bit of it. I have you saved as a favorite to check out new things you post…
This is a very good tip especially to those fresh to the blogosphere. Short but very precise info… Thanks for sharing this one. A must read article.
I truly love your blog.. Excellent colors & theme. Did you develop this amazing site yourself? Please reply back as I’m hoping to create my very own site and would love to know where you got this from or what the theme is named. Many thanks!
I was able to find good advice from your content.
Everything is very open with a precise explanation of the issues. It was truly informative. Your site is extremely helpful. Thank you for sharing.
Right here is the perfect site for anybody who would like to find out about this topic. You realize so much its almost tough to argue with you (not that I personally will need to…HaHa). You definitely put a fresh spin on a subject that’s been written about for years. Wonderful stuff, just great.
I blog frequently and I genuinely thank you for your information. This article has truly peaked my interest. I am going to book mark your blog and keep checking for new information about once a week. I opted in for your Feed too.
Spot on with this write-up, I honestly believe this amazing site needs far more attention. I’ll probably be back again to read through more, thanks for the information!
Everything is very open with a clear description of the issues. It was really informative. Your site is very helpful. Thank you for sharing.
I was very pleased to uncover this web site. I want to to thank you for ones time for this particularly fantastic read!! I definitely liked every little bit of it and I have you book-marked to see new things on your site.
Nice post. I learn something totally new and challenging on sites I stumbleupon on a daily basis. It will always be interesting to read through articles from other writers and practice a little something from their web sites.
That is a great tip especially to those new to the blogosphere. Short but very accurate info… Thanks for sharing this one. A must read article!
Hello! I simply would like to offer you a big thumbs up for the excellent information you’ve got right here on this post. I’ll be returning to your website for more soon.
Pretty! This has been an incredibly wonderful post. Thanks for supplying this information.
Saved as a favorite, I love your web site.
After going over a number of the blog articles on your site, I honestly like your way of blogging. I saved as a favorite it to my bookmark webpage list and will be checking back soon. Take a look at my website too and tell me your opinion.
This is a topic which is near to my heart… Many thanks! Exactly where are your contact details though?
Having read this I believed it was really informative. I appreciate you taking the time and energy to put this short article together. I once again find myself personally spending a lot of time both reading and posting comments. But so what, it was still worth it!
It’s nearly impossible to find experienced people in this particular topic, but you seem like you know what you’re talking about! Thanks
Howdy, I believe your site might be having web browser compatibility issues. When I take a look at your web site in Safari, it looks fine however, when opening in I.E., it’s got some overlapping issues. I merely wanted to provide you with a quick heads up! Aside from that, excellent site.
There’s definately a lot to know about this issue. I love all of the points you’ve made.
You made some good points there. I looked on the internet for more info about the issue and found most individuals will go along with your views on this web site.
Hello! I could have sworn I’ve been to your blog before but after going through some of the articles I realized it’s new to me. Anyways, I’m certainly delighted I found it and I’ll be bookmarking it and checking back often!
I like it whenever people come together and share views. Great site, continue the good work.
This is the perfect blog for anyone who really wants to find out about this topic. You realize so much its almost tough to argue with you (not that I personally would want to…HaHa). You definitely put a new spin on a topic which has been discussed for many years. Great stuff, just wonderful.