how to display data obtained from dao in jsp

后端 未结 1 1719
余生分开走
余生分开走 2021-01-17 06:21

in jsp


        <         
1条回答
  •  猫巷女王i
    2021-01-17 06:52

    I spot several mistakes:

    Here,

     
    

    You're overriding the list value with the value of the list item everytime. Don't do that. Give the var an unique variable name. The entity name is the most straightforward choice.

     
    

    Note that I'd personally also rename the nothing-saying resultList to a more self-explaining projects.


    And here,

the flow is wrong. You should print a new row inside each loop. Swap them.

 
    

And here,

${resultList.Projid}
${resultList.Projname}
${resultList.Cost}
${resultList.Manager}

the property names must start with lowercase (and fix the item name to be the same as in var).

${project.projid}
${project.projname}
${project.cost}
${project.manager}

Note that I'd personally also get rid of proj prefix in some property names.


And finally you're forgotten a closing .

    

Unrelated to the concrete problem, your JDBC code is sensitive to SQL injection attacks and is leaking resources. Fix it as well.

0 讨论(0)
提交回复
热议问题