Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

logic:match , logic:notEqual not working

 
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!!
 
Sheriff
Posts: 15749
264
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • 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
Sheriff
Posts: 15749
264
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Then just use the html:optionsCollection or html:options 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
Sheriff
Posts: 15749
264
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
see http://www.reumann.net/struts/lesson2/step14.do
 
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
 
We're all out of roofs. But we still have tiny ads:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic