Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

jstl request parameter  RSS feed

 
pramod reddy katanguri
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i'm new to jstl......till now i was using java request.getParameter() method in the scriplets to aquire the values given in the previous page.

recently, iv started using jstl tags(${param.paramname}) to request the parameters from the previous page.

i mostly use beans to store the user entered data.....but in my jsp page i have to update many (approx. 100) text fields depending upon the user input,which forces me to request the data from the previous page.for simplicity iv named all these text fields using integer values.When i used scriplets iv parsed these integer values into string values and then requested the appropriate data.

Now,when im using the jstl syntax for requesting the data(which were named with integer values in the previous page) .......im unable to get those values which were entered in the previous page (here im requesting the data using the integer value ).......

Is there any need to parse the integer values before requesting the data???if yes what is the method which is used to parse the integer values into strings in jstl...................

I'm using jstl1.1


~~~with regards~~~
pramod
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66141
141
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're going to have to include some examples as I really have no idea what you are doing. But it does sounds like you are making things needlessly complicated.
 
pramod reddy katanguri
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:You're going to have to include some examples as I really have no idea what you are doing. But it does sounds like you are making things needlessly complicated.



for example:


<c:set var="r" value="11" />
<form .....>
enter name:<input type="text" name="${r}" />
</form>


in the above way im naming a text field in the previous page....

how can i retrieve the value of the text field in my current page......................???


regards,
pramod
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66141
141
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why would you do that? It's very uncommon (to the point that I've never even see it before) to use numbers for request param names. Why make more work for yourself?
 
pramod reddy katanguri
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:Why would you do that? It's very uncommon (to the point that I've never even see it before) to use numbers for request param names. Why make more work for yourself?




i need to update my database table which consists of 15 columns and n rows(n>=50)....as the no: of rows goes on increasing depending upon the user input...........

iv used a matrix logic....naming the first row fields in the table as....11 12 13 14 ................115
second row as 21 22 23 24 .................215
third row as 31 32 33 34 .................315
. . . .. ....
91 92 93........................915

so.....iv used numbers for naming th particular text field......

 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66141
141
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why not use an alphabetic prefix, which is much more common?

In any case, the general solution to this problem is to use the correct notation. In the EL, only property names that are valid identifiers can be referenced with the . notation. For any property name, including those not forming valid identifiers, you can always use the more general [] notation.
 
pramod reddy katanguri
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:Why not use an alphabetic prefix, which is much more common?

In any case, the general solution to this problem is to use the correct notation. In the EL, only property names that are valid identifiers can be referenced with the . notation. For any property name, including those not forming valid identifiers, you can always use the more general [] notation.



thank you very much sir for clarifying my doubt.........
im an undergraduate student started using jsp from the past two months.. where i used scriplets in my application

just recently started using jstl tags.........

can you explain me what is the ' general [] notation' here means

regards,
pramod
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66141
141
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's all explained in the specification. And, by the way, this is an EL topic, not a JSTL topic.

In a nutshell, the following are equivalent:


Even though you can use the latter notation to address your all-numeric parameter names, I recommend altering the names to be more conventional. Doing weird things just makes your code harder to understand.
 
pramod reddy katanguri
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:It's all explained in the specification. And, by the way, this is an EL topic, not a JSTL topic.

In a nutshell, the following are equivalent:


Even though you can use the latter notation to address your all-numeric parameter names, I recommend altering the names to be more conventional. Doing weird things just makes your code harder to understand.




thank you sir.....i'll definitely implement your recommendations.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!