| Author |
Total newby JSP if block question is this legal
|
Tony Evans
Ranch Hand
Joined: Jun 29, 2002
Posts: 521
|
|
If this block legal
in psdo code its
if(serverName = 'serverProd)
link = somethin1
else if(serverPort = 8080)
link = serverName:serverport
else
link = serverName
Thanks for any help
|
 |
Tony Evans
Ranch Hand
Joined: Jun 29, 2002
Posts: 521
|
|
sorry if blocks did not end right is this legal
|
 |
Albareto McKenzie
Ranch Hand
Joined: Apr 08, 2009
Posts: 268
|
|
Almost, you have to do the set to the variable, you cannot declare things like "value link" in the middle of the page because that is only text (have you tried your example?) You have to set the value via <c:set tag
|
 |
Tony Evans
Ranch Hand
Joined: Jun 29, 2002
Posts: 521
|
|
Thanks link was only a placeholder I was more interested in getting the if then else block correct
|
 |
Albareto McKenzie
Ranch Hand
Joined: Apr 08, 2009
Posts: 268
|
|
Well, actually you have a tag that doesn't end (<c:when test="${pageContext.request.serverPort}"> ) and a </c:otherwise> that doesn't close anything (line 19)
It's also a bit weird that param.number can have value serverProd or 8080, seems somehow strange.
For only two conditions I would use c:if instead of <c:choose, check this:
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56180
|
|
|
Remember that you can have as many when's as you like.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Tony Evans
Ranch Hand
Joined: Jun 29, 2002
Posts: 521
|
|
Cheers I got confused by an examples if you only doing one check when if you are doing a if/else blocl
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56180
|
|
|
And remember that you can nest <c:choose> tags inside <c:when> tags.
|
 |
Tony Evans
Ranch Hand
Joined: Jun 29, 2002
Posts: 521
|
|
The finished working product, its a choose within a choose
|
 |
Sai Hegde
security forum advocate
Ranch Hand
Joined: Oct 26, 2010
Posts: 183
|
|
|
Please post code within code blocks.
|
 |
 |
|
|
subject: Total newby JSP if block question is this legal
|
|
|