将值从JSP传递给Struts中的Action Class

时间:2021-06-01 11:52:57

In the following code Sample i am trying to pass param1 value from my jsp to myaction class. When the user clicks on file number i am trying to pass the file number as well as the param1 value.

在下面的代码示例中,我试图将param1值从我的jsp传递给myaction类。当用户点击文件编号时,我试图传递文件编号以及param1值。

<display:table   name="sessionScope.List" requestURI="${urlRepDetails}" pagesize='<%= pagesize %>' sort="list" class="displaytag" defaultsort="3" defaultorder="ascending"  >
<display:column href="/myaction.do?param1=xyz"paramId="fileNumber" paramProperty="fileNumber" property="fileNumber" title= 'fileNumber" %>' sortable="true" headerClass="sortable" class="tabel-border"/>
</display:table>

In my action class i am doing is:

在我的动作课中,我所做的是:

if(request.getParameter("param1")=="xyz"){
String REQUEST_NO = request.getParameter("fileNumber");
nextView=callMethod(mapping, form, request, response, REQUEST_NO);
}

But the value param1 is not passed and the control even does not go to the action class on click of the hyperlink. My application is designed in liferay. Generally i call action class as

但是值param1没有传递,控件甚至在点击超链接时也没有进入动作类。我的应用程序是在liferay中设计的。通常我将动作类称为

<display:table   name="sessionScope.List" requestURI="${urlDetail}" pagesize='<%= pagesize %>' sort="list" class="displaytag" defaultsort="3" defaultorder="ascending"  >
    <display:column href="${urlDetails}"paramId="fileNumber" paramProperty="fileNumber" property="fileNumber" title= 'fileNumber" %>' sortable="true" headerClass="sortable" class="tabel-border"/>
    </display:table>

and in my jsp i also have:

在我的jsp我也有:

<liferay-portlet:renderURL var="urlDetails">
  <liferay-portlet:param name="_xyz" value="/myaction.do" />
  <liferay-portlet:param name="table_select" value="abcd" />
</liferay-portlet:renderURL>

and in action class as:

在行动类中:

if(request.getParameter("table_select")!=null && request.getParameter("table_select").equals("abcd")){
                        String REQUEST_NO = request.getParameter("fileNumber");
                        nextView = callMethod(mapping, form, request, response, REQUEST_NO);    

I need to know how to pass values to my action class from href directly?

我需要知道如何直接从href将值传递给我的action类?

1 个解决方案

#1


0  

Seems to be issue with your ActionClass path which you have give

似乎是您提供的ActionClass路径的问题

/myaction.do

Make sure the path which you are giving in href is correct with respect to the struts-config file.

确保您在href中提供的路径相对于struts-config文件是正确的。

#1


0  

Seems to be issue with your ActionClass path which you have give

似乎是您提供的ActionClass路径的问题

/myaction.do

Make sure the path which you are giving in href is correct with respect to the struts-config file.

确保您在href中提供的路径相对于struts-config文件是正确的。