Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...If I'd only had resource like eng-tips when I was just getting started! I might have dazzled them with my brilliance instead of my BS..."

Geography

Where in the world do Tek-Tips members come from?

JSP expression not resolving correctly in <html:textarea> tag

vulcand4 (Programmer)
25 Aug 06 14:16
I have an iterate process set up to loop through the values in an ArrayList.

I then want the value of the loop index (specified by the "indexId" attribute) to be used to get an indexed parameter from my ActionForm.

Here's a snippet:

CODE

<logic:iterate id="field" name="Template0Form" property="questions" indexId="idx">
   <div id="q<%=idx+1%>" class="showMe">
      Question <%= idx+1 %>:<br/>
      <html:textarea style="margin-left:10px;" property="questionsIndexed[<%= idx %>]" rows="3" cols="50"></html:textarea>
   </div>
</logic:iterate>

Here's the problem:

the "<html:textarea>" tag resolves before the jsp expression "<%= idx %>" which results in an error stating that I don't have a property in my ActionForm called "questionsIndexed[<%= idx %>]"

What I want is for the <%= idx %> to resolve to it's integer value before the <html:textarea> tag is resolved.

The two lines above the <html:textarea> tag have the <%= idx+1 %> resolve correctly.

Any Idea where I'm going wrong?
ronnyjljr (IS/IT--Management)
28 Aug 06 15:52
How is the the questionsIndexed defined in your ActionForm?

CODE


String questionsIndexed[];  //Like this?


-Ron

typedef map<GiantX,gold, less<std::shortestpathtogold> > AwesomeMap;

vulcand4 (Programmer)
28 Aug 06 16:32
It's coded as

CODE

String [] questions;

public String[] getQuestionsIndexed(int index) {
   return questions[index];
}

The getter method matches the property field in the <html:textarea> tag.  That is done so that I can change the underlying collection without having to change to contract with the JSP.

But the problem is not with the ActionForm, it is with the JSP not resolving the expression within the <%=  %> tags at all.

It's as if the <html:textarea... tag is being handled first and that code takes "<%=...%> as a literal instead of a JSP expression.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Back To Forum

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close