aspose file tools*
The moose likes JSP and the fly likes how to throw error in jsp, if i dont get a value in the map as in below code. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "how to throw error in jsp, if i dont get a value in the map as in below code." Watch "how to throw error in jsp, if i dont get a value in the map as in below code." New topic
Author

how to throw error in jsp, if i dont get a value in the map as in below code.

Venkata krishna rao kvk
Greenhorn

Joined: Feb 14, 2013
Posts: 4
protected void bootlink() throws IOException,JDOMException {

String filePath = VBBaseHelper.getValue("groups_xml_path");
// ResourceBundle bundle = ResourceBundle.getBundle(RESOURCE_PATH);


SAXBuilder builder = new SAXBuilder();
FileInputStream fis = new FileInputStream(new File(filePath));
Document doc= builder.build(fis);
Element root = doc.getRootElement();

Iterator iter = root.getChildren().iterator();
String scope = null;
String groupName = null;
List allActionEvents = null;
Element actionEvent = null;
Element group = null;
VBActionEvents actionEvents = null;
String actionPath = null;

while(iter.hasNext()){
actionEvents= new VBActionEvents();
group = (Element)iter.next();
// scope = group.getAttributeValue(SCOPE_ATTR);
groupName = group.getAttributeValue(GROUP_NAME_ATTR);
actionEvents.setScope(scope);
actionEvents.setGroupName(groupName);
Iterator groupIter = group.getChildren().iterator();
allActionEvents = new ArrayList();
while(groupIter.hasNext()){
actionEvent = (Element)groupIter.next();
actionPath = actionEvent.getAttributeValue(GROUP_NAME_ATTR);
allActionEvents.add(actionEvent.getText());
actionMap.put(actionEvent.getText(), actionPath);
}
actionEvents.setAcionEventList(allActionEvents);
acmMap.put(groupName, actionEvents);
}

}
T Mishra
Ranch Hand

Joined: Apr 04, 2006
Posts: 108

Please post your code within tags.
Have you declared method inside JSP ? What do you want to do after throwing an error in JSP ? If the value of map is null, I suggest you to display a error page with a understandable message.


Thanks,
Tushar (SCJP 1.5)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to throw error in jsp, if i dont get a value in the map as in below code.