Tim Kernan

Greenhorn
+ Follow
since Aug 25, 2010
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 Tim Kernan

I have an html page which presents two lists and lets the user move items from one to the other. One list is a set of avaliable options to choose from and the second is a list of options which the user want to store/save. This second list will be initially populated with previously selected and stored options and the user can make the desired changes to his options list. This option transfer between lists all works nicely.

When the user clicks the SUBMIT button, I use an ONCLICK="" function to mark the items in the second list as SELECTED. Again, this all works fine.

The problem is receiving the data in the ActionForm. I can not access the returning data.

It appears that when the form is submitted the name assigned to each selected value is the same name as the Collection from which the options in the second list were generated. This seems odd.

Here is the DAO segment, calling setter:



Here is the GETTER and SETTER methods in the ActionForm



The JSP showing the second list only:


The error message I get shows that the setAssignedExceptionTable() method is called, the very same one used in the DAO to place the Collection in the Bean in the first place. This does not seem right.:


What puzzles me is that it appears that the name assigned to the selected value fields is the same name as the Collection form which they originated. The property defined in the <html:select statement is the name used and MUST be the name of the Collection (I get an error if it is not).Yet the <html:coptionsCollection statement seems to do the iterating.. It seem that one can not set a field name other than that which is the name of the Collection.

What dont I get??

Thank You.

13 years ago
Yes, I did change the DTD in tiles-def.xml

I reverted back to struts-tiles (tiles 1) and have started a separate test project to use Tiles 2. Perhaps a simpler project will flesh out the problem.

Could you explain, or point me to some place that will, the difference between a tiles server, listener and filter. Apparently, just one of these need to run but I have not found an explaination as to how to determine which one best fits the application.


Thanks for your help.
Tim
13 years ago
(I ment to post to Struts forum)
I have just installed Tiles 2 for use in my Struts 1 application. Tiles version 2.2.2

It seems that attributes defined in the tiles-def.xml file are not "carring over" into the JSP pages. I get the following error:



Browser displays the message:






I have configured a Tiles 2 listener (not a server or filter) in web.xml:






Snippet from tiles-defs.xml:



I am getting the following messages in the Tomcat logs



I have not added tiles-portlet.jar to the classpath.When I did, I got compile failures so I backed off.

Thanks for your help.
TIm
13 years ago
I am closing this because the solution to the original problem was to convert to Tiles 2.

I am having trouble getting Tiles 2 to work and will deal with that separately.

Thanks for everyones help.
Tim
13 years ago
The AdminMenuBar.jsp contains only a set of drop down menus. It contains no reference to tiles.

The only tiles:inserted page which does contain another <tiles:insert ....> is, or could be based upon user option, the "body". But that should not blow up the whole page.

I am using a tiles Listener.

This message I got this morning seems to say that the attribute is not available to the page.



I must be missing something simple.

Thanks
Tim
13 years ago
I am now getting NullPointerExceptions on every line of the jsp file where <tiles:insertAttribute name="this_content.jsp/> and all other <tiles: xxxx > usage.

Here is the section of tiles-defs-sml


MainPage2.jsp:



Error:



Thanks for you help.
Tim
13 years ago
Earl and Lucas:
Update
The above error was caused because I needed to add tiles-template to the project library.

I also discovered that the following need to be added:
slf4j-api-1.5.8.jar
slf4j-jdk14-1.5.8.jar

These were not mentioned in the Struts migration page.

Thanks
Tim

13 years ago
lucas and earl

Thanks. I upgraded to Tiles 2 per Struts web site migration page and get the following error:



Any clue?

Thanks agian
TIm
13 years ago
E Robb
Thanks for your suggestion and example. However, I am still having a problem.
1) tiles is giving me a "No tag found" error with the line <tiles:putAttribute.. />

2) Here is my tiles-defs.xml:




Here is a snippet from the main page:



Here is a snippet from the page identified by "body" (ResourceConfiguration.jsp):


I tried using the import statement as welll, but got the same error



The error I get is:
(I am using Netbeans on Linus)

Jan 7, 2011 4:14:54 PM org.apache.struts.tiles.taglib.InsertTag$InsertHandler doEndTag
SEVERE: ServletException in '/ResourceConfiguration.jsp': javax.servlet.jsp.JspException: Error - tag useAttribute : attribute 'config_page_content' not found in context. Check tag syntax
org.apache.jasper.JasperException: An exception occurred processing JSP page /ResourceConfiguration.jsp at line 87

84:
85:
86: <%-- Begin Column header layout --%>
87: <tiles:useAttribute name="config_page_content" ignore="false" />
88: <logic:notEmpty name="config_page_content">
89: <tiles:insert attribute="config_page_contentx" ignore="false" beanScope="request" />
90: </logic:notEmpty>

Thanks for your help, I really appreciate it.
Tim





13 years ago
Lucas,
Thanks. I am using Struts 1.
-Tim

13 years ago
I can not determine how to use tiles to insert a page into a page which itself was the result of a tiles:insert

My main layout inserts a content page (<tiles:insert attribute="content-page-A" /> )

This page in turn inserts another page (<tiles:insert attribute="content-page-B" /> or <tiles:insert attribute="content-page-C" />) based upon users prior selection.

However, I get the message:
javax.servlet.jsp.JspException: Error - Tag Insert : No value found for attribute 'content-page-B'.
I am reasonably certain this is not the case due to the testing I did.


I beleive (from reading other web sites) that it is not possible to cascade tiles because the tiles attributes are not passed through to a subsequent layout page.

If this is the case, what recommendations do you have for alternative means of "cascading" tiles,

Thanks
Tim
13 years ago
Sriram
javascript:emoticon('');
IT worked!!!
I understand the code, but not why it worked. It seem that the key was:
public Line getLines(int index) VS public Line getLines(Integer index)

I persume that without this the BeanUtils parser could not identify the signature of the method to call??

THANKS A TON!!!

-TIm


13 years ago
Sriram
Thanks for you help on this, it is driving me nuts.
Here is my ActionForm class:

-Tim




Also here is a copy of simple Line

13 years ago
Poonam
You may be having the same problem I am having, that is, the HTML pages is correct, indexed properties appear as the should (view html source), data is being displayed correctly.

BUT, when submitted, your ActionForm does not pick up the indexed properties. It appears that the indexed properties in the query string returned to the ActionForm are skipped over, all other properties are parsed by the ActionForm.

If this seems to be your problem, see if the query string (request.getQueryString() ) has actual brackets ("[" and "]" ) around the index or not. That is does it look like: lines%5B0%5D.name=tim or like: lines[0].name=tim ?

See my post: https://coderanch.com/t/508028/Struts/Struts-queryString-indexed-properties-not

I have not found a solution other that to write a parser in the Action.execute() method, which seems unnecessary. I am still looking for the right solution.

Hope this helps.
Tim
13 years ago
Sriram
Thanks for refering me to that article. Unless I am missing something, the article presented a "typical" indexed property example of both JSP code and the bean ActionForm getters and setters.Altho, it avoided the use of <html:test .../> to construct the page.
This is indeed the model I am using. The problem is that the % signs used in the query string returning to the ActionForm are preventing the indexed objects from being parsed. Thus the setter methods are not invoked.


Here is the JSP code


Here is the resulting query string:
test=5&testb=6&lines%5B0%5D.name=tim&test=4&lines%5B0%5D.town=milton&lines%5B1%5D.name=tom&test=4&lines%5B1%5D.town=wilton&lines%5B2%5D.name=todd&test=4&lines%5B2%5D.town=dilton&lines%5B3%5D.name=ted&test=4&lines%5B3%5D.town=hilton&operation=Submit&ams=1258

The indexed properties (ie ines%5B0%5D.name=tim )are not being parsed, I presume because of the % sign. The following method is never invoked:



Question:
1) Do I need to set a <form-property > in struts-config.xml to handle indexed propertiesin the ActionForm?

2) How do I tell my browser (Firefox) ont to encode the brackets [ and ]? I presume that is the source of the problem.

3) How do I tell Struts to decode the %5d %5b characters before the request is parsed?

4) Am I making the wrong assumptions as to where the problem is?

Thanks again for your help on this problem.
Tim

13 years ago