Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JSP update question - why need question mark  RSS feed

 
tangara goh
Ranch Hand
Posts: 179
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm trying to use this code in my project, since I don't have to re-invent the wheel.



My problem is I don't understand why need to put a question mark there? What's the purpose.

And netbean IDE is giving me error on that part so I hope someone can kindly point out where's my mistakes.

Thanks alot.
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 36396
453
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tangara,
The question mark tells the link that id is a parameter to the update jsp. There shouldn't be a space before/after it though.

Also, note that it is bad practice to havae Java code (especially JDBC code) in a JSP. Better to have it in a Java class.
 
tangara goh
Ranch Hand
Posts: 179
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I saw these codes from the same forum.

Is this what you meant? Did you mean MVC model?

<%
Person p = (Person)request.getAttribute("pObj");
String name = p.getName();
%>
<%= name%><br>

<jsp:useBean id="person" class="com.beans.Person" scope="request"/>
<jsp:getProperty name="person" property="name"/>
<br>
${person.name}

Just a couple of question, if this is the method to do then what is scope? Is this a standard like the action in form?

And also getProperty?

And also ${person.name} - is this jsp code?

Hope you can enlighten me on above. Thank you very much.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65824
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
tangara goh wrote:And also ${person.name} - is this jsp code?

Yes it is an EL (Expression Language) expression. That's the way JSPs should be written instead of using Java code in a JSP.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!