struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Li Ying <liying.cn.2...@gmail.com>
Subject Re: Struts2, convention plugin, websphere 6.1
Date Thu, 18 Nov 2010 12:24:30 GMT
Everything submit from the client side, are passed as String.

So you can't take object instance as your parameter.

You need take the ids of these objects as parameter, and load object
by the ids by you self.


2010/11/18 Harsh C <hchaudh1@gmail.com>:
> I think that is probably what it was. Basically in my action, I had a list
> of model objects (modelList) and a model object (selectedModel).
>
> I changed the Model type object selectedModel to String type selectedModelId
> and things work fine now.
>
> Now my question is, if I had a checkboxlist backed by a list of Model
> objects, and upon checking some models, I wanted a list of selectedModel
> objects, is there a way in struts to do it?
>
> Thanks,
> HC
>
> On Wed, Nov 17, 2010 at 11:47 AM, Dave Newton <davelnewton@gmail.com> wrote:
>
>> Could also be a type conversion error.
>> On Nov 17, 2010 2:46 PM, "Harsh C" <hchaudh1@gmail.com> wrote:
>> > So, result "input" is some kind of default result that struts sends a
>> user
>> > to?
>> >
>> > Is validation turned on by default, as I did not specify any validation?
>> If
>> > so, how can I turn it off?
>> >
>> > Thanks,
>> > HC
>> >
>> > On Wed, Nov 17, 2010 at 11:39 AM, Dave Newton <davelnewton@gmail.com>
>> wrote:
>> >
>> >> Failed validation will send user back to the input result.
>> >>
>> >> Dave
>> >> On Nov 17, 2010 2:29 PM, "Harsh C" <hchaudh1@gmail.com> wrote:
>> >> > Hi,
>> >> >
>> >> > I have an input page which has a checkbox list in a form. Clicking
>> submit
>> >> > takes the user to a 2nd JSP.
>> >> > The problem is that when I don't select a checkbox and click on
>> submit,
>> I
>> >> > get to the output page, of course no value is displayed on the output
>> >> page
>> >> > though.
>> >> > But if I select a checkbox and click submit, I get an error saying....
>> >> >
>> >> > No result defined for action .....action.ModelHomeAction and result
>> input
>> >> > I just started with struts and don't really know why it is looking
for
>> >> the
>> >> > result "input". I would appreciate any help with this.
>> >> >
>> >> > Relevant code is below.
>> >> >
>> >> > input.jsp
>> >> > <s:form method="post" action="modelUpload">
>> >> > <s:checkboxlist name="selectedModel" list="modelList"
>> listKey="modelId"
>> >> > listValue="modelName"/>
>> >> > <s:submit></s:submit>
>> >> > </s:form>
>> >> >
>> >> > output.jsp
>> >> >
>> >> > <s:property value="selectedModel"/>
>> >> >
>> >> > Action
>> >> > private ArrayList<Model> modelList;
>> >> > private Model selectedModel = new Model();
>> >> >
>> >> > public ArrayList<Model> getModelList() {
>> >> > FrameworkHandler handler = new FrameworkHandler();
>> >> > return handler.getModels();
>> >> > }
>> >> >
>> >> > public void setModelList(ArrayList<Model> modelList) {
>> >> > this.modelList = modelList;
>> >> > }
>> >> >
>> >> > public Model getSelectedModel() {
>> >> > return selectedModel;
>> >> > }
>> >> >
>> >> > public void setSelectedModel(Model selectedModel) {
>> >> > this.selectedModel = selectedModel;
>> >> > }
>> >> >
>> >> > public String execute() throws Exception {
>> >> > LOG.debug("Model Home Action");
>> >> > return SUCCESS;
>> >> > }
>> >> >
>> >> > public String upload() throws Exception{
>> >> > return SUCCESS;
>> >> > }
>> >> >
>> >> > struts.xml
>> >> >
>> >> > <action name="modelHome" class=".....action.ModelHomeAction"
>> >> > method="execute">
>> >> > <result name="success">/jsp/input.jsp</result>
>> >> > </action>
>> >> >
>> >> > <action name="modelUpload" class=".....action.ModelHomeAction"
>> >> > method="upload">
>> >> > <result name="success">/jsp/output.jsp</result>
>> >> > </action>
>> >>
>> >
>> >
>> >
>> > --
>> > *Thanks,
>> > Harsh*
>>
>
>
>
> --
> *Thanks,
> Harsh*
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message