Results 1 to 2 of 2

Thread: Problem JSP / JSP -> Servlet Comunication

  1. #1
    Join Date
    Nov 2011

    Problem JSP / JSP -> Servlet Comunication

    Hi! Can someone help me? I'm a starter in Java-WebDeveloping and i have a question.
    I have some Strings in a servlet that i want to send to a JSP (with setAttribute()). So far so good. After this, i want to show them in my JSP. Because there are a variable number of them i need to make a for.

    for(int i=1;i<=j;i=++){
    Contine: <input type="text" name="<%out.print("Aller"+i);%>" value="<%out.print("${Message"+i+"}");%>" readonly="readonly"/>

    All variables here are ok, tested...But my JSP instead of showing me the attribute i set in the Servlet, i get ${Message1}. The conclusion is that the JSP does the commands in order, and it doesn t know what ${Message1} means because it passed to next lines of code.
    Does anyone knows how to make "<%out.print("${Message"+i+"}");%>" work?

    P.S. Sorry for my english, it's not my native language

  2. #2
    Join Date
    Oct 2005

    First use [CODE] tags please

    Second try this for the line instead:
    Contine: <input type="text" name="Aller<&#37;= i %>" value="<%= request.getAttribute("Message" + i) %>" readonly="readonly"/>
    Generally you use ${Message1} when you use JSTL's and even then it would be ${requestScope.Message1}

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center