Colin Pace

Greenhorn
+ Follow
since Sep 25, 2003
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 Colin Pace

In jsp file : If hiiden field is not part of form , it's can't pass.



Yes I agree, the hidden parameters must be part of the form. But that's not my concern.

The problem is that one MUST uses hidden parameters to pass data from one page to another but which is not available as form elements.

This makes it less neat than when we used to use a session bean with a business object in it.
19 years ago
I agree that by creating a base action form to group the common properties is elegant, however it doesn't solve my problem. Hidden parameters have to be used anyway - making the JSP page full of such tags, since that's the only way to pass the data through to the following JSPs.

In my opinion the concept of having a session bean with the business object used by a set of JSPs is more elegant and neat ... having said this Struts offer various other advantages but on this aspect I feels it does not help to keep your JSPs neat.
19 years ago
in struts actionforms are used to store the data submitted from a form to the Action. If there are other data in the action form which need to be passed but are not part of the form, hidden parameters have to be used?

I have used hidden parameters, however I feel this is a bit inefficient especially when a number of data has to be passed from one JSP to another. Sometimes you also need that the data be available to JSP further steps ahead than the next link, thus more hidden parameters have to be included in other JSPs.

In normal JSP procedure a session bean would be used with the business object needed - I feel this is more efficient - however the MVC model of structs would then be useless if action forms are not used.

Any views?
19 years ago
Java provides the big advantage of being platform independent and so excellent for the Internet where there are various PCs running different platforms.

On the other hand XML is excellent to markup ANY DATA in a format-independent way. Example: If one entity needs to send data to another entity, when these entities use different Database Schemas, the entity receiving the data will have difficulties in "understanding" the data. By formatting the data in XML and sent it in a defined format, this uniformity of data allows any entity to understand it and use the received data.

XML is extremely important in Web Services where data is open for various entities (who don't have to worry about the database they use thanks to XML). The data in fact will be made available in XML format.
19 years ago
you can read an excellent article on using java dates:
http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-dates.html

Colin Pace
20 years ago
hi,
i need to iterate through a String array property of the ActionForm, and display the elements in textfields such that they can be changed.
1. Iterate tag
<logic:iterate id="arrayelement" name="MyForm" property="StringArray">
Are the attributes of the iterator tag correctly set?
2. How to display the array elements in textfields?
i managed to display the elements, however using the <bean:write> tag
<bean:write name="arrayelement">
how can i display them using the <html:text> tag?
3. After displaying the elements in textfields, i need to display an empty textfield to allow the user to populate new elements in the array.
By setting the property attribute the array property should be filled automatically. Correct?

thanks,
20 years ago
It seems that I have solved all 3 problems.
1. I used name="banks" and this works fine.
2. I have added a String[] in the ActionForm and used the multibox successfully using the following code:
<html:multibox property="selectedBankIds">
<bean:write name="bank" property="id"/>
</html:multibox>
3. As you told me I used the following code:
<html:submit value="Edit" on*='<%= "return callEdit(" + ((com.fase.ims.logic.admin.Bank)bank).getId() + ")" %>' />
Thanks a lot.
20 years ago
Junilu Lacar, thanks for your help.
i have changed my display name according to the JavaRanch Naming Policy.
However I still have problems with the code I mentioned in my first posting.
1. I tried to get the collection by using the name "banks" directly in the iterate tag, however the following error cropped up:
org.apache.jasper.JasperException: Cannot create iterator for this
collection
Before calling the JSP I am calling an action that prepares the collection in a request attribute named banks - in fact using <%= request.getAttribute("banks") %> - I cannot understand why "banks" is not working.
2. I have added a String[] in the ActionForm and used the multibox successfully using the following code:
<html:multibox property="selectedBankIds">
<bean:write name="bank" property="id"/>
</html:multibox>
your code:
<html:multibox property="selectedBankIds" value="<%= bank.getId() %>" />
Maybe this problem is related to the fact that "banks" is not working in 1.
3.my last question is related to integrating struts tags with javascript:
<html:submit value="Edit" on*="return callEdit('<%= ((com.fase.ims.logic.admin.Bank)bank).getId() %>')"/>
* in this case click
I am trying to pass the bank id to a javascript method. However this is not working - the scriplet is not being compiled and interpreted.
NOTE: I am using this messy approach since in my JSP I am generating a number of buttons dynamically, with each button's Action requiring the id (the bank id) corresponding to the clicked button. This was the only way I could think of going aroung this problem. Does anyone has a better solution?
thanks for all your help,
colin pace
20 years ago
how can i populate the value attribuites of a multibox using an iterator to loop through a collection of beans?
and how to pass the bean's properties to javascript?
Code showing a list of bank names with a checkbox and an edit button for
each name:


thanks,
gava-follower
20 years ago