Hi, I am having two JSP's one for adding and another editing a customer details. My Requirement is such that I can have one extra field in Edit jsp where as its not present in add JSp. Here I want to use Single Action So I have created an action which subclasses DispatchAction. I am also using Struts validator which will redirect the request to a page base on "input" attribute value from struts-config.xml. Since my add and edit jsp's are different, I can't give a common jsp in the input attribute. Please suggest whether I can handle this problem.
Hi I dont think so its a big deal.There is no need to use different jsps..u can use the same JSP but u will be knowing whether u r performing add/edit depending on some parameter...hence u can add a logic tag in ur jsp to display the extra field........... r else assume that u dont know whether u r performing add/edit then u can include an additional field which is of type String(intialse it to "") ,and generate on fly the Html thing and even the value for this field in the edit logic generate that entire extra field on fly and in ur jsp say <bean:write property="formbeanattribute/> If its add it will defaultly dispay "" else in edit case it will display whatever u had generated in ur action class for edit
If you settle for what they are giving you, you deserve what you get. Fight for this tiny ad!