aspose file tools*
The moose likes Struts and the fly likes logic:match , logic:notEqual not working Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "logic:match , logic:notEqual not working" Watch "logic:match , logic:notEqual not working" New topic
Author

logic:match , logic:notEqual not working

James Workmen
Greenhorn

Joined: Oct 06, 2004
Posts: 26
I am iterating an list object and within the iterate tag I have to check
for some value againt the value in the list and print. But it is not allowing to use any other logic tag inside 'logic:iterate' tag.
I tried, logic:match, logic:equal, logic:notEqual. Everytime
it is trowing the following error:
org.apache.jasper.JasperException: /mySearch.jsp(71,56) equal symbol expected.

Here's the code:


I even tried jsp:getProperty tag


Help!!
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 5288
    
  10

You can't nest tags this way:

<logic:equal name="<bean:write name="PROJECT" property="statusCode"/>" value="<bean:write name="codebean" property="id"/>">

Use a JSP runtime expression instead. You might also want to try using JSTL instead of the logic tags. They're much easier to learn, write, and read, IMO.



Third, IMO, filtering the items in the collection at the JSP level is a poor design choice. You should filter the collection items in the Java code before displaying the JSP. That way, you won't have to put all that iteration/test logic in your JSP.

Lastly, if you're going to filter the items in the collection, then why present it as an option? A select list with just one option doesn't make sense to me.


Junilu - [How to Ask Questions] [How to Answer Questions]
James Workmen
Greenhorn

Joined: Oct 06, 2004
Posts: 26
Thanks for the reply.

Actually, I am populating an option list using an iterate tag.
When the project is new I have to display an empty JSP page for the user to fill in the page and submit the data.
But when the user selets the already existing project, I am displaying all the details pertaing to that project.
For both I am displaying the same JSP.

When the user selects an existing project, I actually I wanted to display an option list with an selected list item, like this,




Thanks
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 5288
    
  10

Then just use the htmlptionsCollection or htmlptions tag. This will eliminate the need to do all that stuff with logic:equal, etc.
[ November 29, 2004: Message edited by: Junilu Lacar ]
James Workmen
Greenhorn

Joined: Oct 06, 2004
Posts: 26
Oh really, can you please give an example on how to use these tags...
html ptionsCollection or html ptions
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 5288
    
  10

see http://www.reumann.net/struts/lesson2/step14.do
saivenu madhav
Greenhorn

Joined: Nov 15, 2007
Posts: 29
Hi friends i am using the same thing ,

see my below code



instead of the above code i am going for c:foreach

please look at the below code


But it is throwing Error
This attribute does not support request time values.

Could any one suggest me how can i using form attribute values in c:forEach

Or is there any other way to get same thing in struts without using scriptlets


ThanksInAdvance
Madhav
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: logic:match , logic:notEqual not working