struts 怎么通过Action访问页面 50

 我来答
百度网友7c3577596
2011-11-19 · 超过20用户采纳过TA的回答
知道答主
回答量:114
采纳率:0%
帮助的人:42.1万
展开全部
你是说struts1 还是 struts2??

估计你是遇到了地址问题 怎么样配置web.xml 去使用struts2:
<?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">
<filter>
<filter-name>strutsPreparAndExecuteFilter</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>
<filter-mapping>
<filter-name>strutsPreparAndExecuteFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>

里面的<url-pattern>/*</url-pattern> 这么写就是你不写.action也可以访问struts2的action了。
Storm代理
2023-08-29 广告
"StormProxies是全球大数据IP资源服务商,其住宅代理网络由真实的家庭住宅IP组成,可为企业或个人提供满足各种场景的代理产品。点击免费测试(注册即送1G流量)StormProxies有哪些优势?1、IP+端口提取形式,不限带宽,I... 点击进入详情页
本回答由Storm代理提供
miniappo2hx2n09ku9vs
2011-11-19 · 超过43用户采纳过TA的回答
知道小有建树答主
回答量:155
采纳率:0%
帮助的人:93.4万
展开全部
什么意思!你指的是如何从Action中跳转到页面中吧?
public ActionForward getList(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
{
return mapping.findForward("list");//这个就是跳转的
}
还在在Struts的XML文件中
<action
attribute="newsTypeForm"
input="/form/newsType.jsp"
name="newsTypeForm"
parameter="operate"
path="/newsType"
scope="request"
type="com.jth.struts.action.NewsTypeAction">
//指定对应的页面
<forward name="list" path="/WEB-INF/manage/News/NewsType/NTList.jsp"></forward>
</action>
如果你想在页面跳转到Action中
在页面把相应的参数通过表单、链接传入Action中就可以了,例如:
<html:form action="users.do?operate=doeditPwd" method="post">
<html:hidden property="item.adminId" value="${uid}" />//参数
</html:form>
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
百度网友b25f5f8
2011-11-19 · TA获得超过203个赞
知道小有建树答主
回答量:480
采纳率:0%
帮助的人:218万
展开全部
forward跳转
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 更多回答(1)
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式