• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

logic:match , logic:notEqual not working

 
James Workmen
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7600
53
Android Eclipse IDE IntelliJ IDE Java Linux Mac Scala Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
James Workmen
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7600
53
Android Eclipse IDE IntelliJ IDE Java Linux Mac Scala Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh really, can you please give an example on how to use these tags...
html ptionsCollection or html ptions
 
Junilu Lacar
Bartender
Posts: 7600
53
Android Eclipse IDE IntelliJ IDE Java Linux Mac Scala Spring Ubuntu
 
saivenu madhav
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic