Michael Stains

Greenhorn
+ Follow
since Mar 07, 2008
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Michael Stains

Hi,
In an updateable page I provide a Cancel button which cancels the update and re-displays the previous page. I can think of 3 ways of doing this:

1 - Java Script in the button to 'go back' to the previous page.
2 - Code a complete re-display of the previous page including retrieveing data from the database.
3 - As for 2 but use data previously stored as Session attributes.

Is there a better way of doing this ? Which method conforms to Struts best practice ?

Thanks for your help.

Michael Stainsbury
15 years ago
Hi Ove, thanks for your reply. However my security model is quite simple so I decided not to go down this route.

I discovered that it is not possible to do what I wanted with pure struts tags. But it is possible by mixing in straight html input tags which still get resloved into the returned Struts Form Bean. This is what I did:

<%lockForm = request.getAttribute("LockForm").toString();%>
...
<input name="SUPPLIERCODE" type="text" <%=lockForm %> value='<bean:write name="ListSupplierContactsRowBean" property="SUPPLIERCODE" />' class="dataChrBold" size="40" >

When LockForm = "readonly" the form is locked. when lockFrom ="" the form is updatable.

Mike
15 years ago
Hi, I have a requirement have a web form editable by one group of users and locked for another group. I need advice on how to write a form that can be locked/unlocked and still conform to Struts (i.e. not code arround struts). This logic will be used on many other forms so I would like to avoid 'double' coding a locked and unlocked form.

I have looked at making the readonly attribute of the html:text a variable, but I could not get it to work (probably it is not possible). I am now looking at using the logic tag to switch between a read only html:text and an editable html:text. I could also use straight JSP to do this.

Can anyone think of better way to do this ?

Thanks for your help

Mike
15 years ago
Hi, I am displaying a list of items on a JSP page using Struts. I want to be able to select an item from the list to display more information about the item in another page. To display the items details on the second page I need to know what the ITEM_NUMBER is so that I can retieve the Item details in the Action Form and pass the data to the new JSP page. What is the best method to achieve this whist preserving the Struts MVC architecture. Below is an example of the first JSP page displaying a list of Items ready for selection:

<TABLE border="1" width="100%">
<TR class="pm2">
<TH>Number_</TH>
<TH>Length_cm</TH>
<TH>Width_cm</TH>
<TH>Height_cm</TH>
<TH>Details</TH>

</TR>
<logic:iterate name="listitemsBean" property="listitems_rows" scope="request" id="listitemsRow">
<html:form action="/DetailsOfanItem">
<TR>
<TD><bean:write name="listitemsRow" property="ITEM_NUMBER" />
</TD>
<TD><bean:write name="listitemsRow" property="LENGTH_CM" />
</TD>
<TD><bean:write name="listitemsRow" property="WIDTH_CM" />
</TD>
<TD><bean:write name="listitemsRow" property="HEIGHT_CM" />
</TD>

<TD>
<html:submit property="Submit" value="View"></html:submit>
</TD>
</TR>
</html:form>
</logic:iterate>
</TABLE>

Thanks for your help
15 years ago
Hi, how can I retrieve the value of

<bean:write name="cat" property="catid" />

in the action class ?
15 years ago